u-boot/doc/usage/cmd/cp.rst
Tom Rini bdaa0b27b3 Documentation:
* add generated index to table of contents
 * create index entries for commands
 * update Python packages used to build the documentation
 * fix typos in dfu documentation
 
 UEFI:
 
 * split unrelated code from efi_bootmgr.c
 * rename CONFIG_BOOTEFI_BOOTMGR to CONFIG_EFI_BOOTMGR
 * net: tftp: remove explicit EFI configuration dependency
 * fs: remove explicit EFI configuration dependency
 
 Other:
 
 * Add Goldfish RTC driver and make it available on RISC-V QEMU
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEK7wKXt3/btL6/yA+hO4vgnE3U0sFAmWnit8ACgkQhO4vgnE3
 U0uI5hAAiIx3GO7KM/T+xLYZksCyPLKoQZ8zCHcfguuB4pHtv5JeyBO4xbuWGCq4
 0P3uDsrCBYJREd7MMRcuY0u7rQVTTMxlS59JvUuIaSJ4qYPEVS3ZsPnW7CrtT5ue
 P6E/anEZK3e2xzQk3YMdAuxquLt6C9xIzFX0mMIRsRkRlYYVEqTeAtwMF+DaJzOy
 5mO+6vbYEmuF+Oakt4OJkxjuJ2lbcNv1OxgmbgQehCtahtZyqC4/AGskq2BO4kEK
 vB4N+orJThYQ2iqkMQmRJHifnuoxLoVS63YLbuDapzR216JusiZbVwqlKZgsNSiq
 6fpHAC+l5Cam3KcCmQgmjEnyadXvdaHFvAP+a8ID4AX84F3zyrXKVBByiTB4M6ge
 NPC4c6uhq+A6L9TLiGQ171y6Z8cKQiJdMG48EdOJeUlfFc8kROjPOalNY4LREsnx
 I+Ma4SQY5MHBoqP9XQf3//5mLB4InElvEh8Up+r1i0QNuIuXjke3zEGIA/Zb0x1C
 HqZ5HQDJKineIJDMU78iJCzC3uP74ZwTixGzTtW1c5eDSHPNoW/FTxZYlpge8yk1
 LjmI+un5RS08dBMPWCGP9buDTMfnjQfbGYGT3In/yYbHOS/TE9REJdjFES1j4UpS
 c9IMc5m+wF2h+cU4eFtUHFm9Pfn2hZkMeInauMumfQS7stj1Qdk=
 =q+5u
 -----END PGP SIGNATURE-----

Merge tag 'efi-2024-04-rc1-2' of https://source.denx.de/u-boot/custodians/u-boot-efi

Documentation:

* add generated index to table of contents
* create index entries for commands
* update Python packages used to build the documentation
* fix typos in dfu documentation

UEFI:

* split unrelated code from efi_bootmgr.c
* rename CONFIG_BOOTEFI_BOOTMGR to CONFIG_EFI_BOOTMGR
* net: tftp: remove explicit EFI configuration dependency
* fs: remove explicit EFI configuration dependency

Other:

* Add Goldfish RTC driver and make it available on RISC-V QEMU
2024-01-17 09:27:23 -05:00

87 lines
1.9 KiB
ReStructuredText

.. SPDX-License-Identifier: GPL-2.0+:
.. index::
single: cp (command)
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. When the *target* address points at ordinary memory,
memmove() is used, so the two regions may overlap.
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) is only available on 64-bit targets. 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.