Hello,
We're writing software for a device where we need a bootloader-application system. We wan't to share some data between the bootloader and the application. This is done by creating a struct in a fixed memory section called GLOBAL_DATA. This section must not be initialized so we've declared it as UNINIT.
When we run the application and step throug the scatter file load code we see that this section is initialized to zero ?!?!?
This is our scatter file:
LR_IROM1 0x08000000 0x0000A000 { ER_IROM1 0x08000000 0x0000A000 { *.o (RESET, +First) * (InRoot$$Sections) .ANY (+RO) } IRQ_TABLE 0x20000000 0x00000100 { * (IRQ_TABLE, +First) } GLOBAL_DATA 0x20000100 UNINIT 0x00000020 { * (GLOBAL_DATA, +First) } RW_IRAM1 0x20000120 0x00004DD0 { .ANY (+RW +ZI) } }
We use the MDK v3.20 for ARM with a Cortex-M3 processor and we use the microlib arm library.
The declaration of the struct is done as following:
SGlobalData __attribute__((section("GLOBAL_DATA"))) g_sGlobalData;
Any idea why this is not working ?
Kind regards,
Erwin Steffens
Hello Erwin,
I had have the same problem. The KEIL support tells me to add the "zero_init" attribute to the definition. I don't know why, but this fixes the problem! Your definition should look like this: SGlobalData __attribute__((section("GLOBAL_DATA"),zero_init)) g_sGlobalData;
Regards Thomas
This does the trick !!!
In the manual they say that zero_init places the data in a +ZI section which means a zero initialize section.
I don't know what they mean with zero initialization. No initialization or initialize to 0x00 ??
Thanks for your reply,
Erwin