Question
avoid erase of user space flash when debugging
Posted on July 14, 2016 at 16:49
Hi,
I use a STM32F205RG6 chip and splitted the flash into 2 parts, 512K for the program and 512K for user's data:MEMORY
{
FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 512K
DATA (rwx) : ORIGIN = 0x8080000, LENGTH = 512K
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
}
#in SECTIONS
.user_data :
{
. = ALIGN(4);
*(.user_data)
. = ALIGN(4);
} > DATA
It works like a charm and I can use the .user_data part in my code without worrying about messing the other part.
The only issue that I have is that when I start the application (in debug or normal mode) via ST-link /v2 (through the IDE System workbench here but it shouldn't make any difference), The full flash is always erased.
I modified the openocd flashing script for stm32f2 family (stm32f2x.cfg) to specify a flash bank size of 512K
#flash bank $_FLASHNAME stm32f2x 0 0 0 0 $_TARGETNAME
flash bank $_FLASHNAME stm32f2x 0 0x80000 0 0 $_TARGETNAME
but than, the flashing algorithm complain about a checksum mismatch (indeed the second half still has my data, as I want)
Does someone know how to cope with such a situation, is there something to do to completely ignore the DATA part when flashing or should I just create a helper method to reload/reconfigure the second part of the flash everytime I start/debug the application via the ST-link?
Thanks and regards,
Zoyhar.
#flash-stm32-st-link-openocd