We all know when the -show=total_size option is specified, the total sizes of RAM, ROM, and program sections are output.
The output example of the total section size is shown below.
*** Total Section Size *** RAMDATA SECTION: 00000660 Byte(s)ROMDATA SECTION: 00000174 Byte(s)PROGRAM SECTION: 000016d6 Byte(s)
here is the memory layout of my RH850 (pardon me its Japanese Version).
I don't really understand what section exactly RAMDATA, ROMDATA, and PROGRAM is.
Can anyone mapping RAMDATA, ROMDATA, PROGRAM section to the memory layout?
here is what I though.
RAMDATA : Local RAM (CPU1), Retention RAM (CPU1), Local RAM (Self), Retention RAM (Self)
PROGRAM: Code Flash, Code Flash (Extension)
RAMDATA you already summarized well. ROMDATA are constants which go to Code Flash, like PROGRAM.
the linker have to know where to place the different sections of the program.
RAMDATA points obviously to variables.
ROMDATA is either constant data, which is directly accessed by your code…
ROMDATA is either constant data, which is directly accessed by your code, or constant data, which is initialized data for your variables (e.g. int x=5);
PROGRAM is also obvious only the code for the CPU, which is compiled and assembled.
Most data can be stored in local RAM for fast access. Retention RAM can be used to retain data also accross DeepSTOP standby modes, where the CPU system and local RAM is powered down and would loose all data.
The difference between normal and self area is just the address window to access the same memory. In a multi-CPU system, the normal areas are always using different address windows to access the RAM. But, the self-area window would be the same address range for all CPU's, but accessing only their own local RAM. Or in other words, if all CPU's are using the self-area for the local RAM, you could run the same code on different CPU's, all CPU's access theis own local RAM via the same self-area address range, but physically the RAM is different. This allows to execute the same code on different CPU's without taking care about which CPU is used to access the local RAM. (The self-area cannot be used for DMA access).
Thank for the answer, and I appreciate it.