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
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.