We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi all
I am working on STM32F030R8 chip,using Keil MDK. For every unit, it carries it own characteristics, and hence for every calibrated unit, I need to re-flash a part of the flash to put the characteristic in.
For example, the characteristics is an array of bytes, so I create a characteristic.c file to put the data at specific location: (0x0800F000)
const unsigned char array[] __attribute__(at(0x0800F000)) = {1, 2, 3, 4, 5, 6} ;
The compiler will generates object file: characteristic.o
Now the question is, how can I get this object file converted to a hex file, that I can just page flash into the target? I think there should have simple command from the MDK suite.
Thanks
Calvin
I suspect you don't know the full implications of what your asking.
Converting an object file to a hex file is not normally a requirement. Object files normally contain (at least some) relocatable items that are resolved during the link.
If it really is complex, then another alternative might be to link your module into a dummy executable, create a hex file from that fully linked executable and then extract the portion that interests you.
Documentation, review http://www.keil.com/support/man/docs/armutil/
The underlying format is from an era when processors clock at 1 MHz and below, so it is not at all complex http://www.keil.com/support/docs/1584/
Dumping a C structure to a .HEX file is something a first year college student should be able to do in under half an hour.
create a hex file from that fully linked executable and then extract the portion that interests you.
Compilers tend to be too clever for such simple plans to work reliably, these days. Unused data will be removed from the executable, or the compiler will directly use the known values verbatim, instead of referring to the master instance of the constant indirectly. So patching the master copy may have hardly any effect at all, or it might only affect a fraction of the places where that number was used. Calling the result not exactly well-behaved will probably be a massive under-statement.