Keil Logo

UNINIT section gets initialized

Next Thread | Thread List | Previous Thread Start a Thread | Settings

Details Message
Read-Only
Author
Erwin Steffens
Posted
4-Mar-2008 08:24 GMT
Toolset
ARM
New! UNINIT section gets initialized

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

Read-Only
Author
Thomas Mattke
Posted
4-Mar-2008 14:12 GMT
Toolset
ARM
New! RE: UNINIT section gets initialized

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

Read-Only
Author
Erwin Steffens
Posted
4-Mar-2008 14:26 GMT
Toolset
ARM
New! RE: UNINIT section gets initialized

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

Next Thread | Thread List | Previous Thread Start a Thread | Settings

  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.