Skip to main content
umesh_patil
Associate III
May 1, 2020
Question

Storing hex file in particular address of flash memory

  • May 1, 2020
  • 4 replies
  • 4094 views

Hello, I want to store a hex file in the particular address of flash memory . I am using the stm32L083cz which has 192 kb flash memory.

Flash starts at : 0x0800 0000

Want to store hex file at the address : 0x0801 50001

Please guide me through this. I am developing over the air firmware upgrade application for this microcontroller.

Thank you In advance.

This topic has been closed for replies.

4 replies

TDK
May 1, 2020

Are you trying to build a firmware file that has the file at that location? Or are you trying to write to that location within your program?

"If you feel a post has answered your question, please click ""Accept as Solution""."
umesh_patil
Associate III
May 1, 2020

At first I wanted to store the hex file at the particular address location. so I can afterwards copies it to the start of flash so I can run the hex file.

Tesla DeLorean
Guru
May 1, 2020

It is just data, put it where ever you want.

The .HEX file encoding isn't that efficient, you might want to unpack it or use binary.

The Intel HEX format has several decades of usage, should be some material you can reference, or copy

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
umesh_patil
Associate III
May 1, 2020

So I have to change the hex file into binary and then store into the location ?

Is it right?

Tesla DeLorean
Guru
May 1, 2020

It is just data (collection of bytes), you can just store, it or process it, your call.

Perhaps if you're unfamiliar, you could write some PC side software, using basic File IO and process and digest the data until you are comfortable with managing it and manipulating it, and then migrate the working understanding into your embedded platform.

Once you've staged the data in the holding location (0x08015000) you can move it elsewhere to replace the code at 0x08000000

.HEX files will typically be about 2.5x larger than the binary data they are describing. So inefficient to transmit over the network, and to stage on the device.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
ilyaz yilmaz
Associate II
May 1, 2020

There is a simple project for starting you can use this.

https://github.com/niekiran/BootloaderProjectSTM32

umesh_patil
Associate III
May 1, 2020

Thank you.I am looking at it