This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

UNINIT section gets initialized

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

Parents
  • Problem did not exist!

    Hi,
    Thanks all for your help. After further analysis I found that the problem did not exist.
    The keyword UNINIT in the scatter file with the keyword NOINIT in the assembly area (as explained in my first message of this thread) do the job very well. My test case was not well done and the memory was cleared by another source.

    Note that --bss_threshold=0 is also useless.

    Sorry for that.
    Thanks again.

    Best regards,
    Antoine

Reply
  • Problem did not exist!

    Hi,
    Thanks all for your help. After further analysis I found that the problem did not exist.
    The keyword UNINIT in the scatter file with the keyword NOINIT in the assembly area (as explained in my first message of this thread) do the job very well. My test case was not well done and the memory was cleared by another source.

    Note that --bss_threshold=0 is also useless.

    Sorry for that.
    Thanks again.

    Best regards,
    Antoine

Children
No data