Store variable in EEPROM STM32L011
I am experiencing an issue when I try to store arrays of data in EEPROM. My intention is to define these arrays in code and have the compiler store them in EEPROM memory space.
I am using an STM32L011E4 device which has 512 bytes of EEPROM at memory location 8080000h.
I have adjusted the .ld-file so that the EPROM memory and a segment called .eep are added.
MEMORY
{
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 2K
FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 16K
EEPROM (rx) : ORIGIN = 0x8080000, LENGTH = 512
}
.eep :
{
. = ALIGN(4);
*(.eep)
} >EEPROM
Then I define an array eepromvars in main.c to contain the array data.
const __attribute__ ((section(".eep"))) __IO uint16_t eepromvars[] = {
0x52FD,
0x0C15,
0x4001,
0x4421,
0x0ee0,
0x2023,
0x5400,
0x5104,
0x0603,
0x0582,
0x5083
};
However, the array is never defined, and the associated memory is never reserved. The program compiles without error, but the variable eepromvars is not pointing to the right location.
Any suggestions on what I am doing wrong?