Hi Group,
I am developing firmware for LPC1756 ARM Cortex-M3 processor, where I want to place my constant data into the internal flash(code memory) by specifying the address explicitly.
For example,
#define MyValue (*(volatile unsigned char *)(0x00001000)) MyValue = 10;
Here 0x00001000 is Internal Flash address, is it possible to access the Code memory directly by the C code or is there any commands available for it in ARM Compilers. Please suggest/advise me with your experience to satisfy the above requirement.
Regards, Vijay
C code can access the flash data just as it can access RAM. The ARM chips don't have separate data spaces for code and data.
But the C code can only read the flash contents, and a compiler can't solve that issue. But the chip manual have information about IAP - In Application Programming - that describes how your C program can change the contents of flash sectors.
Have you really spent time with the documentation available from NXP? They tend to have excellent documentation, but you still need to read it...
place my constant data into the internal flash(code memory) by specifying the address explicitly. (emphasis mine)
The usage of the word "by" in that place bodes trouble. I indicates you think fixing the address is necessary to locate the variable in flash. It's quite certainly not.
Placing constants in flash is a job for the tools --- but what you're doing is essentially an attempt to fight them. What's worse, the linker would have no idea what you're using that address for, because you're operating behind its back.
You really should look up the documentation (C compiler and linker) about how to put consts in ROM.