cancel
Showing results for 
Search instead for 
Did you mean: 

external file inclusion

Posted on March 17, 2011 at 19:12

external file inclusion

2 REPLIES 2
Posted on May 17, 2011 at 14:28

What compiler/tool chain?

What programming tools do you want to use?

There are multiple ways of achieving this kind of thing.

You could for example use XMODEM to download the file if you implement an update internal hex image function within your application code. (I've done this, and pulled from HTTP servers with wireless modems)

You could hard code it within an include file. You could make a simple app to generate such code.

char myHexImage[] =

'':0200000423F0E7\n''

'':1000000018F09FE518F09FE518F09FE518F09FE5C0\n''

'':1000100018F09FE50080000020FF1FE520FF1FE58E\n''

'':100020005800F0234000F0234400F0234800F02360\n''

'':100030004C00F023000000005000F0235400F02397\n''

..

'':04117000000000007B\n''

'':0400000523F000AC38\n''

'':00000001FF\n'';

You could also store the data in binary, and output Intel or Motorola hex on the fly.

Tools like J-FLASH, ST-LINK, and the ST Flash Loader, should all permit writing to arbitary addresses.

You could merge your file on the end of you application binary.

Insert it into an ELF file.

Generate a hex file from the hex file, and merge it with the hex file from your application.

The scatter file method might also work, depends on the tools, should be able to Google the syntax.

http://www.keil.com/forum/18585/

http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.kui0100a/armasm_caccaghf.htm

http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.faqs/ka3700.html

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on May 17, 2011 at 14:28

Clive, thank you so much. I am really impressed !

sorry, I forgot to mention the toolchain - it's Keil MDK-ARM.

the are few details related to my project.

- The controller i am using (STM32F103) is by itself programmed by another controller through the serial port, so programming tools wouldn't work.

- from my controller I need to program the NXP P89LPC922, and it accepts only Intel hex format in IAP mode.

- I am using a scatter file to add some metadata at the end of a code memory, so merging will complicate things

So it seems like in my case 2 methods are appropriate:

- using of an include file

- creation an assembler file and importing my hex file using INCBIN

Second method may be easier since it wouln't require an additional application to generate the proper array.

I used IAR with avr controllers before, and it had a special provision for such inclusion. It made things easier.

Thanks a lot again