Greetings:
Is it possible within the Keil environment to create a HEX file which contains just data, that is no startup, no main()?
We currently have a application which uses pointers to look to a specific flash address for its database. Rather than a single HEX file which contains both the application and its data, we would like to be able to load (via ULink, Flash Magic, etc) the application itself, then, depending on the requirements, any one of a quantity of different databases.
Obviously, the Keil environment works great to create the application including a main() function and the various requirements thereof.
What I would really like to do is write a C-file containing a structure (with an "AT" locator) and initializing data, then transform that into a HEX file.
With a significant amount of muscle, I think I see how I can achieve a HEX file with a binary editor and the HEX2BIN and BIN2HEX utilities, but is there a way do achieve that HEX file translation of a C type data with less manipulation?
Thanks for your thoughts, d
it will be a breeze in asm
Erik
One way of doing this would be to create a complete application with a dummy main() and everything. Then strip everything but your data from the resulting HEX file. This can be done with a tool like SRecord.
http://srecord.sf.net
By the way, the fromelf utility (which generates HEX files among other things) has a great deal of flexibility. You should be able to make it output only the data you want into the HEX file:
http://www.keil.com/support/man/docs/armutil/armutil_BABCHFEB.htm
First, why c? Well, if you must know I haven't don't anything but patchwork in assembler since my Z80 days (talk about dating ones self!). I'm a little intimidated by the ARM.
Actually I have done the cut operation on a main() enabled program HEX file output. That works, but I was hoping for a solution which I can be a bit more confidant will be done correctly if/when I get to the point of passing this project off to some other unlucky sole.
But, if you're just creating a data .HEX file, ARM is irrelevant.
If your data is already in a file, then there are plebty of utilities for converting to .hex...
Not sure if this helps but the uVision debugger's "SAVE" command generates HEX files from arbitrary memory ranges. If you have the data you want somewhere within RAM or flash you can use SAVE to write the file.
Andrew
Hey Andrew:
Your suggestion to save memory via the debugger is absolutely ideal! Thanks ever so much! Your suggestion has saved me from putting together unconscionable hack code.
I have grown soft in my advancing years and rarely go beyond the functions wrapped up in the IDE. Here is a case where knowledge of the command line functions offers just what I need. Lesson learned. Make that "lesson re-learned"!
doug
After finally creating a HEX file of my external flash database, I find I am still not quite where I want to be.
After much trial and error, I conclude a AXF file (not surprisingly) contains critical information which allows, in my case, my combined internal-flash-code and external-flash-database, to be loaded by the Keil debugger.
The Keil debugger will also allow one to load a simple HEX file including the internal-flash-code, as is described elsewhere in this forum.
The Keil debugger, however, does not like to load a HEX file which consists of my external-flash-database. A verification error is reported. I surmise the combined AXF file has means to vector the external flash addressed bytes through the supplied flash download setups whereas the HEX file handling is not equally sophisticated.
I haven't given up yet, but I've certainly wearied of this.
Okay! I'm done! Here's how to get that HEX file data into external flash:
http://www.keil.com/support/man/docs/uv4/uv4_fl_hexdownload.htm