cancel
Showing results for 
Search instead for 
Did you mean: 

Debugger *.elf file erase the data.

roboSaga
Associate II

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.

6 REPLIES 6
AvaTar
Lead

> ... *.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.

roboSaga
Associate II

Thank you for the your advice.

I will check the tool settings a little more.

Pavel A.
Evangelist III

In Eclipse this option is in the debug configuration:

roboSaga
Associate II

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.

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.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
roboSaga
Associate II

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