cancel
Showing results for 
Search instead for 
Did you mean: 

Generating a HEX File with Custom Linker Modifications for STM32F407G-DISC

Meczup
Associate

I have a code that toggles only four LEDs on the STM32F407G-DISC. I want to generate a HEX file for this code and then make changes to the addresses using a linker file. After modifying the linker file, I want to see these changes reflected in the HEX file. Additionally, I plan to add three uint32_t variables with known addresses to my LED toggle code and locate their addresses in the HEX file. However, I have no knowledge about HEX and linker files. How can I achieve this?

4 REPLIES 4
SofLit
ST Employee

Hello @Meczup and welcome to the community,

It's very vague question. Need to give more details: why you need to locate the addresses in HEX file? what Toolchain are you using?

 "After modifying the linker file, I want to see these changes reflected in the HEX file" do a diff between the HEX files using for example Beyond Compare tool. It can do HEX file comparison.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
Meczup
Associate

I received an internship task where I need to compare two HEX files by modifying the address stored in the linker file. Therefore, I need to analyze the HEX files. I am currently using a text comparator to compare them, but I am not very proficient in changing the address. After observing these changes, I will try to analyze the variables with addresses I have defined myself on the HEX file.

As I said, do what to do with linker file and do the HEX file comparison. I suggested  Beyond Compare as it's an efficient tool in HEX compare: https://www.scootersoftware.com/v5help/viewhex.html

SofLit_0-1734692498973.png

See for studying HEX file format:

https://developer.arm.com/documentation/ka003292/latest/

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

 

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

The .HEX file formats aren't overly complex, should be able to do with basic level file interaction and processing.

From there loading as binary, patching, and rewriting.

Probably rate that as High School level stuff. Basically shows an understanding of data representation, code/data in memory and files, code in micro-controllers, file manipulation. 

Perhaps look also at tools like SRecords for inspiration. 

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