Steps for Using EDATA as extended flash in STM32-C562RE
- September 16, 2026
- 0 replies
- 6 views
How to use EDATA as extended flash in STM32-C562RE?
I disabled the EDATA_EN
Verified CubeProgrammer can read 0x08400000
Created a project from MX2
Added EDATA_CODE (rx) in stm32c562xe_flash.ld in memory block as EDATA_CODE (rx) : org = 0x08400000, len = 0x10000
Added the following section:
.edata_code :
{
. = ALIGN(16);
KEEP(*(.edata_code))
KEEP(*(.edata_code.*))
. = ALIGN(16);
} > EDATA_CODE
Added the simple EDATA_Add() function in main:
__attribute__((section(".edata_code")))
__attribute__((noinline))
uint32_t EDATA_Add(uint32_t a, uint32_t b)
{
return a + b;
}
Called it once from main()
Build it and build was successfull
Before flashing, check the .map lines containing .edata_code and EDATA_Add and foundsomething similar to:
.edata_code 0x08400000 ...
0x08400000 EDATA_Add
Now, when I am going to flash through cubeprogrammer or cbeIDE, it is not writing to the address 0x08400000 and cubeprogrammer is giving an error
