📄 c_copy.htm
字号:
<title>The copy Command</title><h1>copy</h1><!--INDEX "copy command" -->The copy command copies a specified number of bytes from one location in memory to another.<p></dl><h2>Format</h2><dl><dd>The format of the copy command is:<p><pre>copy [-f] from to size</pre>where:<p><table><tr><td>from </td><td>declares the source address location. </td></tr><tr><td>to </td><td>declares the target address location. </td></tr><tr><td>size </td><td>is the size of the block of memory to be copied. This quantity is specified in bytes.</td></tr><tr><td>-f </td><td>Specifies that the destination is flash memory.</td></tr></table></dl><h2>Functional Description</h2><dl><dd>The copy command replicates a specified number of bytes from one place in memory to another. <p>The -f option is used when copying to flash memory. This requires thatthe board supports writes to that address range, and that the flashmemories support sector erase.<p>If to is less than from, copying is performed in ascending order starting at from. If from is less than to, copying is performed in descending order starting at from + size.<p>When moving a data block down, the source data is copied from thebottom of the block upwards: and when moving a data block up, thesource data is copied from the top of the block downwards. By thistechnique, there is no risk of copying over data in overlapping blockmove operations; as the data in the overlapping area is copied first.However, if the -f option is specified, copying is always performedin ascending address order.<p></dl><h2>Examples</h2><dl><dd><ul><li>This example shows how to copy a block of memory, 8 Kbytes insize, with a base address of 0x80020000, to another 8-Kbyte areastarting at the address 0x80060000.<p><pre>PMON> copy 80020000 80060000 2000</pre><li>This example shows how to copy a block of memory, 4 Kbytes insize, with a base address of 0x80020000, to a 4-Kbyte area offlash memory starting at the address 0x80060000.<p><pre>PMON> copy -f 80020000 bfc40000 1000</pre><li>This example shows how an application program may be copied into flash.This example is applicable to PMON only.<p><pre>pmcc -prom -crt0 -T 9fc40000 -D 80020000 -o bubble crt1.s bubble.cPMON> load e03e0000-- download bubble.rectotal = 146ePMON> copy -f 80020000 bfc40000 1500</pre>Note:<ol><li>The file crt1.s is exactly the same as lib/crt1.s, except that thefollowing lines have been added before the call to clrbss.<p><pre> li a0,0x80020000 jal cpdata</pre><li>The value e03e0000 is the difference between the link address 9fc40000and the load address 80020000 (0x180020000-0x9fc40000=0xe03e0000).<p><li>The size argument for the copy command has been rounded up. The valuemust be the total as reported by the load command plus at least 32.<p></ol>To run the application, type,<p><pre>PMON> g 9fc40000</pre></ul></dl><h2>Files</h2><dl><dd>The copy command is located in <a href="../mon/copy.c">mon/copy.c</a>.</dl><h2>See Also</h2><dl><dd><a href="c_compare.htm">compare command</a></dl><p><hr><b>Navigation:</b> <a href="index.htm">Document Home</a> | <a href="doctoc.htm">Document Contents</a> | <a href="docindex.htm">Document Index</a> <p>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -