2014-08-15 03:09 AM
Hello everybody.
I am having trouble writing data to the STM32F0 flash. I would like to store a look-up-table in a page of flash. My intention is to flash this in during production, so I have added it to the appropriate memory section of the bin file, which I then flash in using ST-Link.However, when my code interprets the values they have been converted to ASCII. eg if I store a 0, my code reads it as 0x30.Does anyone have any suggestions for storing the data in a correct hex format?Thank you in advanceMatt2014-08-15 03:59 AM
I see my issue.
I've manually entered the values in a text editor, which has automatically encoded in ASCII.I can write a script to decode and store in raw binary format; but does anyone have a better suggestion?Matt2014-08-15 04:18 AM
Dear Matt,
Try to open your file with Notepad++ (freeware) or windows editor (notepad.exe). If you see clear text data then you have a hex file and not a bin file.If you see a lot of garbage and only few readable text then you have a bin file.If you have a hex file (readable text) then you need only to say to load as hex file. in this case you need to rename the file to extension .hex then st-link knows how to manage that.Why your compiler/assembler creates a bin file with hex-file data, I cant see with the information you post here but I'm sure there is only a small wrong configuration.Regards2014-08-15 05:07 AM
I can write a script to decode and store in raw binary format; but does anyone have a better suggestion?
You can program in C right, and use standard file IO like fopen/fwrite/fclose?2014-08-15 05:16 AM
Thank you for your answers.
I just need to output the values in hex, I've implemented the C file functions.Matt2014-08-15 05:25 AM
The ST-Link utilities can read binary files directly, or you can provide that data in .HEX format (Intel or Motorola)
I would suggest you generate your data, and .BIN file, using a PC based C compiler, would take a minute. You could do it with a Hex Editor, but honestly that sounds like more work.2014-08-15 05:36 AM
Yes, you are correct.
I used excel to calculate the values of a LUT, copied the data into a text file and flashed it.Thus, started scratching my head when the algorithm using the LUT churned out random values!Matt