blob: 12a24e19fee6dad8dace074bddc058aa21075031 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
.. SPDX-License-Identifier: GPL-2.0+:
cp command
==========
Synopsis
--------
::
cp source target count
cp.b source target count
cp.w source target count
cp.l source target count
cp.q source target count
Description
-----------
The cp command is used to copy *count* chunks of memory from the *source*
address to the *target* address. If the *target* address points to NOR flash,
the flash is programmed.
The number bytes in one chunk is defined by the suffix defaulting to 4 bytes:
====== ==========
suffix chunk size
====== ==========
.b 1 byte
.w 2 bytes
.l 4 bytes
.q 8 bytes
<none> 4 bytes
====== ==========
source
source address, hexadecimal
target
target address, hexadecimal
count
number of words to be copied, hexadecimal
Examples
--------
The example device has a NOR flash where the lower part of the flash is
protected. We first copy to RAM, then to unprotected flash. Last we try to
write to protectd flash.
::
=> mtd list
List of MTD devices:
* nor0
- device: flash@0
- parent: root_driver
- driver: cfi_flash
- path: /flash@0
- type: NOR flash
- block size: 0x20000 bytes
- min I/O: 0x1 bytes
- 0x000000000000-0x000002000000 : "nor0"
=> cp.b 4020000 5000000 200000
=> cp.b 4020000 1e00000 20000
Copy to Flash... done
=> cp.b 4020000 0 20000
Copy to Flash... Can't write to protected Flash sectors
=>
Configuration
-------------
The cp command is available if CONFIG_CMD_MEMORY=y. Support for 64 bit words
(cp.q) depends on CONFIG_MEM_SUPPORT_64BIT_DATA=y. Copying to flash depends on
CONFIG_MTD_NOR_FLASH=y.
Return value
------------
The return value $? is set to 0 (true) if the command was successfully,
1 (false) otherwise.
|