2019-03-04 04:00 PM
If loading the on-chip flash from a .hex file, the Write Memory command can be used to write the hex file data records. However, what should done with the start address? Where does that get written? (Assumming an STM32G0, in my case.)
Solved! Go to Solution.
2019-03-04 05:33 PM
In the HEX files I've used, I've never run across an 05 record. The stack pointer is the first 4 bytes, and the starting address is the next 4 bytes of the data that you are downloading. (Remember, little endian format). Therefore the 05 record wouldn't need to be used.
2019-03-04 04:14 PM
I think you are asking about the start address in flash where the bootloader should start writing the data. The start address is contained in the Intel HEX file. The first line of the HEX file is a type 04 record, which is the extended linear starting address. The type 00 (data) records contain the lower bits of the address. I have found this article on Wikipedia useful in learning how to decode Intel HEX files.
2019-03-04 04:37 PM
Thanks for the answer. Indeed I found the same Wikipedia article very helpful. I do read and process the type 04 record, using it to modify the type 00 record addresses.
However, my question is regarding the 05 record, which provides the application starting address. Does this also need to be written to a location in flash, or is it already taken care of by the vectors that are presumably part of the rest of the data?
2019-03-04 05:33 PM
In the HEX files I've used, I've never run across an 05 record. The stack pointer is the first 4 bytes, and the starting address is the next 4 bytes of the data that you are downloading. (Remember, little endian format). Therefore the 05 record wouldn't need to be used.
2019-03-04 06:03 PM
It is a historic parameter used by debuggers. Here I'd expect it to point to the Reset_Handler where it could place a breakpoint.
With. HEX files the address of the data is inferred directly, unlike a .BIN which is just a blob of data.
2019-03-05 08:58 AM
Ah yes, thanks. I see the same address as the second 4 bytes.