cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4 Writing Additional Data to Program

bcornwellmott
Associate II
Posted on April 06, 2016 at 18:39

This might be more of a programming question than a micro-related question:

I have firmware that I am programming to my STM32F4 micro using the UART bootloader. My software loads a selected BIN file and then programs the micro. I want to include the firmware version and date information in the BIN file, so I don't have to rely on file naming to identify different versions, but can instead just read the firmware version when the file is loaded by the UART programmer.

What I would like to do is include that data at the same program memory address of each BIN file, so that I can easily find it every time. I also want the file to be compatible with using the ST-LINK utility, in case I decide to program it with that tool. 

Is there a way to do this using compiler directives in the source code? 

Any suggestions would be very appreciated!

1 REPLY 1
Posted on April 06, 2016 at 18:57

I tend to prefer signing the linker output, the tools can easily digest .HEX or .BIN files, the formats are simple and well defined.

You can presumably use the __DATE__ and __TIME__ defines, you could use a make file or script to push that into a specific file that would become part of the build process. You can push specific strings into specific locations using #pragma or attribute settings, and use the linker script or scatter file to place those in specific sections of the output.

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