AnsweredAssumed Answered

Programming independent regions in the flash

Question asked by hornang on Sep 26, 2014
Latest reply on Sep 26, 2014 by Clive One
I'm currently using emIDE (GNU ARM) with Segger J-Link on the discovery board STM32F407VG (1 MB flash).

To be able to store configuration data in sector 1 in the flash I have modified the linker script to not generate any data for the the 16 KB between 0x08004000 and 0x08008000. The map from the linker seems to show that stuff is placed correctly.

The question is now. When programming the chip, I'm assuming that emIDE converts the ELF file to hex or similar before invoking the J-Link tool. But I guess a hex file is not descriptive enough to describe non-continuous/independent flash regions to be programmed?

When I try to run my code after I modified the linker script the application jumps into totally unrelated code. I can also confirm using the J-link memory inspector that the sector 1 of the flash is not empty at all. To me there seems to be a limitation in emIDE's interface to J-link, not supporting "multiple load regions". I would expect multiple hex files.

An alternative approach which actually works is to simply skip 16 KB in the linker script using . = 32K like this (snippet):

.text :
{
    . = ALIGN(4);
  KEEP(*(.isr_vector))
  
  . = 32K;



But using this approach the debug probe will overwrite the config data during program upload which very inconvenient when developing the configuration code.

Outcomes