2019-04-01 01:21 AM
I use NUCLEO-H743ZI with TrueSTUDIO.
I write some datas to flash memory 0x081e 0000 (bank=2,sector=7).
This address is separate from the program downloaded,
but when I start Debugger, *.elf file erase the data.
What's the problem?
I confirmed the data is correctly written on memory using ST-LINK utility.
2019-04-01 02:04 AM
> ... *.elf file erase the data
No, ELF files don't erase data. The debugger does.
I'm not familiar with TrueStudio, but doing a mass-erase before flashing is a IDE/debugger setting.
All modern toolchains I'm familiar with have an option to update only modified sectors.
2019-04-01 02:27 AM
Thank you for the your advice.
I will check the tool settings a little more.
2019-04-01 06:50 AM - edited 2023-11-20 03:14 AM
In Eclipse this option is in the debug configuration:
2019-04-02 05:36 PM
Thank you for your polite advice.
I noticed another problem.
When I write code to operate flash memory, the data written to flash memory
does not disappear. for example, HAL_FLASH_Unlock() etc.
Even before the code is actually executed.
However, if I delete this code (HAL_FLASH_Unlock() etc.), and launch the debugger,
the data written to flash memory will disappear.
I may have missed something or misunderstood it.
I will try hard more.
Thank you very much.
2019-04-02 07:17 PM
With the level of information it is going to be very hard to guess what you're really doing and why it is failing.
Cherry picking one line of code with HAL_FLASH_Unlock() provides no context to the larger issues and interactions.
Perhaps dump the ELF object and see if it touches any of the regions involved.
Instrument your code so you can see what it is doing, and put bounds checking around any write or erase functions so it prevents you from touching the memory blocks the code is executing from.
Perhaps create a simple/minimal project that demonstrates your issue, and zip up the project including the output files, and attach the .ZIP here.
2019-04-03 02:41 AM
Thank you for your kind suggestion.
I found a new condition.
If I write a *.hex file by STLink tool one time I can debug with TrueStudio.
The data written to the flash memory remains .
I will try by myself a little more.
Thank you