Hi,
I'm using compiler version 6 and building M55 image for FVP SSE-300-MPS3.
I would like to get section actual size using the are arm linker auto generated variables and use it in c code.
Image$$section_name$$Length;Image$$section_name$$Base;image$$section_name$$Limit;
I'm using ARM scatter file below but can't get the correct info.
here is sample scatter file with 3 regions.
dtcm.bin 0x20000000 0x00060000 { ; Any R/W and/or zero initialised data .ANY(+RW +ZI) } ;----------------------------------------------------- ; 32 kiB of stack space within the DTCM region. See ; `dtcm.bin` for the first section. Note: by virtue of ; being part of DTCM, this region is only accessible ; from Cortex-M55. We use the last DTCM bank ;----------------------------------------------------- ARM_LIB_STACK 0x20060000 EMPTY ALIGN 8 0x00008000 {}
c main code part.
extern unsigned int Image$$ARM_LIB_STACK$$Length; extern unsigned int Image$$ARM_LIB_STACK$$Base; extern unsigned int Image$$ARM_LIB_STACK$$Limit; extern unsigned int Image$$dtcm$$Length; extern unsigned int Image$$dtcm$$Base; extern unsigned int Image$$dtcm$$Limit; extern unsigned int Image$$dtcm_ZI$$Length; extern unsigned int Image$$dtcm_ZI$$Base; extern unsigned int Image$$dtcm_ZI$$Limit; int main(int argc, char **argv) { printf("The ARM_LIB_STACK section Length 0x%x Base 0x%x Limit 0x%x \n", Image$$ARM_LIB_STACK$$Length, (unsigned int)&Image$$ARM_LIB_STACK$$Base, (unsigned int)Image$$ARM_LIB_STACK$$Limit); printf("The dtcm section Length 0x%x Base 0x%x Limit 0x%x \n", Image$$dtcm$$Length, (unsigned int)&Image$$dtcm$$Base, (unsigned int)Image$$dtcm$$Limit); printf("The dtcm_ZI section Length 0x%x Base 0x%x Limit 0x%x \n", Image$$dtcm_ZI$$Length, (unsigned int)&Image$$dtcm_ZI$$Base, (unsigned int)Image$$dtcm_ZI$$Limit); }
The map file out put indicates the following:
Execution Region ARM_LIB_STACK (Exec base: 0x20060000, Load base: 0x00003b98, Size: 0x00008000, Max: 0x00008000, ABSOLUTE)
Execution Region dtcm (Exec base: 0x20000000, Load base: 0x00003b80, Size: 0x00000014, Max: 0xffffffff, ABSOLUTE)
Execution Region dtcm_ZI (Exec base: 0x20000014, Load base: 0x00003b94, Size: 0x00008b10, Max: 0xffffffff, ABSOLUTE)
The output of the my code is as follw:
The ARM_LIB_STACK section Length 0x20068000 Base 0x20060000 Limit 0xdfdfdfcf The dtcm section Length 0x1ddd Base 0x20000000 Limit 0x0 The dtcm_ZI section Length 0x20068000 Base 0x20000014 Limit 0x0
Any idea how can I get the actual size of the regions? e.g. for dtcm_ZI size
Thanks Ronan - it is working.