cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L Program flash using bootloader over SPI

dstegs
Associate II
Posted on November 11, 2015 at 00:50

I'm trying to understand which file I should write to flash using the STM32L bootloader. For instance, if I write the whole *.hex file to flash at the correct start memory address will the application load? Why not? Or do I have to program a certain portion of a *.hex file to flash? Would it be better to use another file type like *.elf, *.axf, *.bin?

The bootloader documentation is linked below:

http://www.st.com/web/en/resource/technical/document/application_note/DM00081379.pdf

Thank you!

#stm32l-bootloader-program
3 REPLIES 3
Posted on November 11, 2015 at 01:39

The System Loader expects you to provide the executable code as it is presented in memory.

The .HEX and .BIN would be simplest, and should be manageable if you have basic grasp file and memory representations. Object file formats like .ELF/AXF are well described in available documentation, you'll have to judge if they are too complicated.

https://en.wikipedia.org/wiki/Intel_HEX

The .HEX written without decoding will crash the processor, because the ASCII lines are not executable opcodes. You must extract the address and data from the line records, and then write that to memory. It will help significantly if you understand the micro-processor architecture you have chosen.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
dstegs
Associate II
Posted on November 11, 2015 at 05:15

Thanks for your input. I am interested in the *.axf format. Sounds like I need to find out exactly how the *.axf file is constructed, pull out the program, parse it and program the flash. Hmmm...... Where to start? It seems like there should be applications out there to do this kind of thing. I must not be the only person trying to do this? Any idea about a utility to do this?

dstegs
Associate II
Posted on November 15, 2015 at 22:54

It turns out that this task was quite simple. I ended up writing a linux application to read an Intel Hex file and write it to flash in C. I found all the needed information in the Intel hex specification linked below. 

http://microsym.com/editor/assets/intelhex.pdf