??? 02/08/06 20:52 Modified: 02/08/06 20:55 Read: times |
#109557 - memcpy() Responding to: ???'s previous message |
Billy Fairhurst said:
QUESTION: is MEMCPY a keil function? or is it ANSI? It is part of the library defined by the ANSI standard, although not a part of the core C language standard. Keil includes implementations of standard library functions that they believe are relevant in 8051-based applications. The folks at Keil are generally pretty sharp, and have probably hand-coded in assembly derivative-specific versions of memcpy() that leverage special features of the target device. Many devices feature multiple data pointers, auto-increment data pointers, etc. which can accelerate memcpy() operations. In this example they do the following observation:
"The example program writes stuff into memory ONLY for demonstration purposes. You should not use this method of writing into memory in structured, high-level programming languages." QUESTION: if thisway of writing works, whats wrong with using it? Where is this example from? Do you have a link to the whole thing? I've used memcpy() before on 8051's, but of course special care must be taken to avoid writing outside of the intended memory area. Especially since the Keil compiler does memory overlaying (necessary because of the 8051's anemic stack), writing out of bounds can cause subtle problems for which the source may be difficult to find. In addition, simple use of memcpy() may be inappropriate in some cases. In the case of a DS89C450, for example, it may be necessary to increase the number of stretch cycles before copying from/to a slow external memory device. Also, Keil's memcpy() is only implemented for the native architecturally supported memory of your device. Thus, you cannot use Keil memcpy() to copy to/from your I2C/SPI/one wire/other serial flash/EEPROM/NVRAM/other storage and so on. --Sasha Jevtic [EDIT: Erik already hit my last point before I did, which was the result of a telephone interruption. He also arguably stated it more cleanly than I did.] |
Topic | Author | Date |
storing serial data in memory | 01/01/70 00:00 | |
after 100.000 writes it dies | 01/01/70 00:00 | |
if internal memory is the problem | 01/01/70 00:00 | |
Battery backed NVRAM from Dallas | 01/01/70 00:00 | |
he seems not to need permanent storage | 01/01/70 00:00 | |
not permanent storage | 01/01/70 00:00 | |
if the problem is pin shortage | 01/01/70 00:00 | |
PCR8750 | 01/01/70 00:00 | |
Keil example-- writing to 8051 mem---- | 01/01/70 00:00 | |
nope | 01/01/70 00:00 | |
Not quite... | 01/01/70 00:00 | |
memcpy() | 01/01/70 00:00 | |
yes, ANSI, but not really '51 | 01/01/70 00:00 | |
Rubbish! | 01/01/70 00:00 | |
Rubbish? I said "on the edge" | 01/01/70 00:00 | |
Not quite... | 01/01/70 00:00 | |
Very clever | 01/01/70 00:00 | |
indeed, if you have the time | 01/01/70 00:00 | |
Do you know that? | 01/01/70 00:00 | |
there is a large advantage when reading | 01/01/70 00:00 | |
1 - 4 byte types supported | 01/01/70 00:00 | |
example link | 01/01/70 00:00 | |
Demo only | 01/01/70 00:00 | |
Grrr | 01/01/70 00:00 | |
i think this got a bit off track![]() | 01/01/70 00:00 |