views:

80

answers:

2

I'm trying to upload a compiled program to a microcontroller.. well my problem is not in programming or uploading things.. my problem is what to upload u.u

The program is in C and was compiled with SDCC. The mcu is an AT89S8252 by ATMEL.

I built a simple parallel port programmer following MCU protocols for serial programming as stated in its datasheet.

So far so good.. but.. what shoud I upload to the mcu??

when compiling, SDCC generates a lot of text reports.. and then an .ihx.. I suspect I should not upload this file directly but post-process it in some way to get the actual raw bytes to upload??

any help will be highly appreciated =)

+3  A: 

Is the .ihx file an Intel hex format file by any chance ? If it is you don't have too much more work to do before you can put your programmer to work. Intel hex format is just a specialized text format. Google Intel hex format to find what it looks like. There's a page on Wikipedia for example. Compare that to your .ihx file. If you get a match you should be able to find something to convert it to a raw binary format, ready to push down to your MCU. If you can't, you should be able to write something to do the job in an hour or so, it's very simple. I could possibly email you a tool I have written previously if you are really stuck. Good luck.

Bill Forster
Thanks =)! well I managed to convert it using Hex2Bin http://sourceforge.net/projects/hex2bin/ (I'm on linux so it works great). There is also another package called srecord that seems more sophisticated.. but I don't need that much functionality.
conejoroy
Good work. I've used srecord for several projects, and found it very useful (e.g. we used it to add a CRC for our bootloader to verify).
Craig McQueen
+1  A: 

Your .ihx file is an Intel hex file I reckon. That, or the similar Motorola S-record format, is usually a good format for programmer software to read. Those formats contain the data to program, as well as the address that the data should be written to. It is more useful than a binary file, which contains no address information.

What software are you using to drive the parallel programmer, and does it accept Intel hex format or Motorola S-record files? Or, do you mean you're writing your own?

You can open an Intel hex file in a text editor and make some sense of its contents. There are many references that explain the format. E.g. Intel HEX in Wikipedia.

Craig McQueen
I built my own parallel port programmer.. thanks for your answer, is as useful and clear as the first.
conejoroy