I want to emulate EEPROM over flash of STM32F103. Is there a way to use all free flash instead of the only page? How can I initialize starting point of my EEPROM emulation so that it would be after all sections? I tried to add section after .text like
.text: ...
.myvars :
{
. = ALIGN(1024);
KEEP(*(.myvars));
KEEP(*(.myvars*));
} > rom
and define variable as
__attribute__((section(".myvars"))) static const flash_storage Flash_Storage = {
.magick = "1234567890absdef0987654321",
.all_stored = USERCONF_INITIALIZER
};
but it doesn't helps me: I see some more data after this structure in binary dump.
UPD: the solution of this problem quite simple. The section .myvars
should be after last section in ram, i.e. after .data
!
Best Answer
The simplest solution of such problem is to put the section
.myvars
after latest section inram
. In my case it should be after section.data
. The full linker file:Here is the code.