2017-02-06 08:23 AM
Is there an easy way to programarbitrary date to on chip flash? We're using IAR Workbench and an ST-LINK/V2 JTAG debugger. I've done some looking in the IAR documentation and not found anything (but that doesn't mean it is not there.)
We need to flash a disk file to a specified location in the on chip flash (outside of the area where our code loads.)
Thanks!
2017-02-06 08:29 AM
Here's how to do it with IAR:
https://www.iar.com/support/tech-notes/general/programming-binary-files-into-flash-within-ewarm/
2017-02-06 08:36 AM
The ST-LINK Utilities also permit the loading of data (.BIN) to arbitrary locations. One could convert a file to .HEX with simple tools, like SRECORD
2017-02-06 09:35 AM
Hi David,
Thanks for the reply. I forgot to mention that I had already seen that and was hoping for an easier option.
thanks,
hank
2017-02-06 09:38 AM
The Keil debugger command line has LOAD / SAVE commands
Your firmware could also implement the ability to send a file and write it to memory.
The other alternative is to create a C array from the file, compile that and have the linker place it in a specific section/address of the micro.
2017-02-06 09:46 AM
1) We're not using Keil.
2) I've offered to do this. It will be needed eventually when we do not have access to JTAG. Right now we don't know what access we will have.
3) I'm using this technique to include the data in the program that uses it.
I'm downloading the
ST-LINK Utilities to see what I can do with that. It seems likely to be the lowest friction strategy at this point.
thanks,
hank
2017-02-06 10:10 AM
Yes, those documents look pretty daunting at first... in the end it's really a matter of adding one line of code to the ICF script and a simple linker option.
Another alternative with IAR would be to use the 'location' pragma to place your data to a specific address, e.g.:♯ pragma location=0x08004000
const char buffer[] = 'Hi There';You could use 'xxd -i' to produce a C array from your data file.
2017-02-06 10:20 AM
You can use bin2c and put it in the 'run before' box. Sure IAR has something like that?
https://sourceforge.net/projects/bin2c/
Just create a linker configuration and tell the downloader to skip all but that region.
2017-02-06 11:27 AM
I think that's the trick. It still requires that I change the file extension to .BIN but that's minimal 'post processing' And I may even be able to override that in the process that builds the data file. It faithfully burns the file to on chip flash.
thanks,
hank
2017-02-06 11:32 AM
Hi Jeroen3,
IAR does have a process to do that which they describe in 12 steps at
. (Hmmm I wonder if 12 steps is a coincidence. If my reference puzzles you, google '12 step program.' ) I'm looking for something simpler.