Variable in NOINIT section

Hi all,

Apparently not the first time discussed In this forum but I still could use some expertise:

I have a Cortex M0+ device and need a variable that is not cleared by a WDT reset.  I have added a "noinit" section in the scatter file which now looks like this:

; *************************************************************
; *** Scatter-Loading Description File generated by uVision ***
; *************************************************************

LR_IROM1 0x08000000 0x00006000 { ; load region size_region
ER_IROM1 0x08000000 0x00006000 { ; load address = execution address
*.o (RESET, +First)
*(InRoot$$Sections)
.ANY (+RO)
.ANY (+XO)
}
RW_IRAM1 0x20000000 0x00000BFC { ; RW data
.ANY (+RW +ZI)
}

RW_NOINIT 0x20000BFC UNINIT 0x00000004 { ; Uninitialized data, 4 bytes
.ANY (+RW)
}
}

In my code a declare a variable like this:

uint32_t testVariable __attribute__((section("NOINIT"), aligned(4)));

However, after compilation, my .map file says this:

    testVariable                             0x2000003c   Data           4  main.o(NOINIT)

I.e. it is still in the IRAM1 section and is, consequently, zeroed after WDT reset. 

How do I fix this ?

Cheers 

Eric

Parents Reply Children
No data