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
Hans-Bernhard Broeker
I do not 100% aware of all the clever bits of the compiler, but regarding the question in concern about addressing the constant record via the absolute address pointer should be able to address the issue that you brought up earlier on. (In fact, the constant record does not even exist in the project build hex file).
Hans-Bernhard Broeker, Per Westermark:
I agreed that my way may not be the correct and efficient way, and surely there are production equipment solution to address this. I would appreciate if anyone can point me to those kinds of information that I can look into.
To convert the constant structure through csv record file into patch binary can also be done using script or creating proprietary executable to do the job. It is because the compiler comes in handy (the free mdk-lite can do the job), not to mention about changing the definition of the structure as revision evolved.
(In fact, the constant record does not even exist in the project build hex file).
Which makes any use of that data undefined behaviour. That gives compilers leeway to do whatever they want with the entire program from that point on.
I hope you did remember to make sure the memory area you keep those data in is actually forbidden for use by the compiler of the main code.
(the free mdk-lite can do the job)
Can: possibly. Is allowed to for that purpose: quite certainly no. You'll want to re-read your license about that a bit more closely.
Hans-Bernhard Broeker, you are right about the constant area.
I have set the target IROM limited to 0xF000 (from 0x800000 to 0x800F000), so that the compiler and linker will not use the area from 0x800F000 onwards.