We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello,
I am trying to define an RAM area that should not be initialized by the C library init function. I found an old thread about that (http://www.keil.com/forum/11937/) but the proposed solution does not work.
I use a scatter file that define the section like that :
RW_BOOTLOADER 0x10000020 UNINIT 0x0000FFE0 { *.o (Bootram) *.o (Bootstack) }
I try to define the area in assembly code or also in C code by :
BLStackSize EQU 0x00004000 AREA Bootstack, NOINIT, READWRITE, ALIGN=3 BLStackMem SPACE BLStackSize BLStackTop
U32 __attribute__((section("Bootstack"),zero_init)) Bootstack[0x1000];
In any case I get the following result in the map file :
Execution Region RW_BOOTLOADER (Exec base: 0x10000020, Load base: 0x0001ef14, Size: 0x00005030, Max: 0x0000ffe0, ABSOLUTE, UNINIT, COMPRESSED[0x00000024]) Exec Addr Load Addr Size Type Attr Idx E Section Name Object 0x10000020 COMPRESSED 0x00001030 Data RW 328 Bootram fiveco_bootloader.o 0x10001050 - 0x00004000 Zero RW 329 Bootstack fiveco_bootloader.o
My understand is that any zero init or uninit area in any section with UNINIT keyword should not be initialized by the C lib as explained in www.keil.com/.../armlink_pge1362075670305.htm
But tests with standard lib (or microlib) with Keil toolchain 5.24.1 show always an initialization by __scatter_zi.o object.
What is wrong in my approach ??
Many thanks by advance ! Antoine
Only ZI data in UNINIT sections remain un-initialized, however any RW data in the UNINIT section does get initialized.
Everything posted so far addresses how to make a Zero Init section to not initialize. It explains why if your Zero Init data gets optimized into a RW region that even though you said it should not be initialized, it will still be initialized.