Procedure to change EEPROM default sector/base address using STM32Duino?
Posted: Fri Apr 18, 2025 4:14 am
Hi,
I have a project in a STM32F410CBT (128KB) compiled with STM32duino version 2.10.1. This is for existing hardware that has been using eeprom emulation for quite some time. This project has been growing and now crossing the 64KB flash line that would not be an issue if I could move the EEPROM for the default last sector of 64KB. The F410 has 5 sectors 0 to 3 of 16KB and last of 64KB! No idea why this, but I think I found the bad way in this device, that from the EEPROM library that any EEprom writing will wipe the whole last 64KB sector (as flashes do). So this means that currently my 128KB device is limited to 64KB if I use EEprom.
If so far I am understanding the problem right, one possibility, would be to move the EEPROM emulation to sector 3 (16KB) and then to have the rest of the space to program flash. No idea if this is possible without getting too crazy, but so far I failed with the information I found on line, particularly to constrain the EEPROM library to sector 3 starting in 0x08000C000 (16KB). The initial (failed plan) was: first constrain the flash memory to sector 3, and then modify the linking memory space in ldscript.ld to reflect this and avoid that code gets compiled in this area. But apparently I cannot get the EEProm reading or writing in that sector 3, I am using the memory window from the cube programmer to verify that. I tried some defines other people has mentioned and then I found that you can define FLASH_EEPROM_BASE, but it appears this is more related with the HAL?
Did anybody achieve this successfully? Or is any documentation I am not aware that can direct me on it? Any help would be appreciated. Alternatively a procedure using HAL I could try.
Thank you,
Rick.
I have a project in a STM32F410CBT (128KB) compiled with STM32duino version 2.10.1. This is for existing hardware that has been using eeprom emulation for quite some time. This project has been growing and now crossing the 64KB flash line that would not be an issue if I could move the EEPROM for the default last sector of 64KB. The F410 has 5 sectors 0 to 3 of 16KB and last of 64KB! No idea why this, but I think I found the bad way in this device, that from the EEPROM library that any EEprom writing will wipe the whole last 64KB sector (as flashes do). So this means that currently my 128KB device is limited to 64KB if I use EEprom.
If so far I am understanding the problem right, one possibility, would be to move the EEPROM emulation to sector 3 (16KB) and then to have the rest of the space to program flash. No idea if this is possible without getting too crazy, but so far I failed with the information I found on line, particularly to constrain the EEPROM library to sector 3 starting in 0x08000C000 (16KB). The initial (failed plan) was: first constrain the flash memory to sector 3, and then modify the linking memory space in ldscript.ld to reflect this and avoid that code gets compiled in this area. But apparently I cannot get the EEProm reading or writing in that sector 3, I am using the memory window from the cube programmer to verify that. I tried some defines other people has mentioned and then I found that you can define FLASH_EEPROM_BASE, but it appears this is more related with the HAL?
Did anybody achieve this successfully? Or is any documentation I am not aware that can direct me on it? Any help would be appreciated. Alternatively a procedure using HAL I could try.
Thank you,
Rick.