AnsweredAssumed Answered

avoid erase of user space flash when debugging

Question asked by Zoyhar on Jul 14, 2016
Latest reply on Jul 15, 2016 by dembek.radoslaw.001

I use a STM32F205RG6 chip and splitted the flash into 2 parts, 512K for the program and 512K for user's data:

FLASH (rx)      : ORIGIN = 0x8000000, LENGTH = 512K
DATA (rwx)      : ORIGIN = 0x8080000, LENGTH = 512K
RAM (xrw)      : ORIGIN = 0x20000000, LENGTH = 128K
  .user_data :
        . = ALIGN(4);
        . = 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,