cancel
Showing results for 
Search instead for 
Did you mean: 

How can i read Hex file from STM32

simoBen47
Associate III

hey everyone,

I need to get access to device of STM32 board to read Hex file. any idea please ?

I am using STM32F401RE.

Simo

15 REPLIES 15

Use the ST-LINK Utilities, read memory, save as a .HEX file.

Use Keil Debugger, and SAVE command at console.

Use the System Loader, pull data with protocol and save to file.

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

Thank you for your reply.

What I need exactly, is to be able to manipulate in real time the firmware after having programmed STM32.

For example read it and check its integrity...

Simo

Exactly what I am trying to do. I have read in the binary modified it to contain a CRC32

and now want to read my modified hex file in, with the symbols coming from the

'elf' file. But the only file types I seem to be offered are elf and something called 'axf'.

 

I want to be able to use the hex file because that is what production get

rclar.6
Senior

me too. I know it used to read the hex file for the flash data and the lef file for the symbols. so you could debug the actual hex file that had , say, a CRC32 checksum in it.

 


@rclar.6 wrote:

the only file types I seem to be offered are elf and something called 'axf'.

I want to be able to use the hex file because that is what production get


Tools are available to convert from AXF or ELF to HEX; eg, objcopy

https://ftp.gnu.org/old-gnu/Manuals/binutils-2.12/html_node/binutils_5.html 

https://stackoverflow.com/questions/19458031/how-to-create-a-executable-hex-from-elf-file-format

 

offers_only_elf.png

 

It used to offer hex images, but now it only seems to offer the elf file

IDE -> project -> properties ->

AScha3_0-1707756883598.png

in debug -> hex file

AScha3_1-1707757061338.png

 

If you feel a post has answered your question, please click "Accept as Solution".

AXF files are ELF files, they are usually coming from Keil / Realview

Binary files might be easier to output. Generating HEX files shouldn't be that hard, Intel/Motorola have been using these forms since the 1970's, they are well documented, and well within the scope of an average programmer. Perhaps looks at SRECORDs project if you need source to work from.

.HEX and .BIN won't provide symbols, but you could derive lengths of file, or use vectors or unknown locations with size. The .MAP would have symbols.

One could also just process .ELF to .BIN or .HEX whilst adding CRC, SHA or SEC signing, and then exporting.

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

That's for INPUT to the DEBUGGER, you need options of OUTPUT from the LINKER

Could use OBJCOPY or FROMELF

 

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