CLion Embedded: How to disable auto erase in OpenOCD configuration



I use CLion 2020.1. I try to run/debug my stm32 project with custom bootloader. My bootloader is located at the beginning of the flash, I can run and debug it. But when I load the main firmware, the flash is erased, of course the bootloader is erased too and all doesn't work. 

OpenOCD log:

** Programming Started **
auto erase enabled
Info : Device: STM32L1xx (Cat.2)
Info : STM32L flash size is 128kb, base address is 0x8000000


How can I disable auto erase at startup?

评论操作 固定链接

I found a solution.

When I write the ELF file, the writing happens from the base flash address 0x8000000 instead of the address 0x8005000 from linker script and the bootloader is erased. But with the HEX file - all ok, recording is done at the address from the file without erasing. But in the second case, debugging does not work due to the lack of necessary information in the HEX file.

I create two configurations, one for loading and another for debugging.

Maybe it can be done differently?