Does this CPU architecture allow to keep constant data in flash memory, similar to other Harvard CPU architectures (AVR for example) or is constant data always copied from flash to RAM on start-up?
If flash based constant data access is possible, what is the proper declaration to do this? Is there a PROGMEM attribute or something similar which can be added to a declaration?
Constant data in flash memory / program space?
Re: Constant data in flash memory / program space?
Constant data is stored in flash by default, and can be accessed on byte, half-word and word basis. You need to use 'const' qualifier in your program to mark the data constant.
Internally, data in cache is mapped into the CPU address space via a transparent cache. See the chapter on Flash MMU in the TRM for more details.
Internally, data in cache is mapped into the CPU address space via a transparent cache. See the chapter on Flash MMU in the TRM for more details.
Re: Constant data in flash memory / program space?
Thank you for the clarification. So I understand this architecture does not have to copy init data from flash to RAM but uses the MMU to map the memory segments into either IRAM or normal RAM. Very nice.
I ran some tests too and can confirm that places the string nicely in the drom0_0_seg segment which is flash and counting towards the "text" size.
Same applies for and
Compared to which places the string into dram0_0_seg segment which is RAM and counting towards the "data" size.
I ran some tests too and can confirm that
Code: Select all
const char constString[] = "0123456789";
Same applies for
Code: Select all
const char * const constString = "0123456789";
Code: Select all
char * const constString = "0123456789";
Code: Select all
char constString[] = "0123456789";
Who is online
Users browsing this forum: No registered users and 160 guests