Skip to main content
lee
Associate II
January 23, 2014
Question

Hex file for production

  • January 23, 2014
  • 12 replies
  • 3240 views
Posted on January 23, 2014 at 15:47

I am using the STM32L100. How I can combine the hex file for my bootloader with the hex file for my application into one hex file for production?

#spi-program
This topic has been closed for replies.

12 replies

Tesla DeLorean
Guru
January 23, 2014
Posted on January 23, 2014 at 15:54

I am using the STM32L100. How I can combine the hex file for my bootloader with the hex file for my application into one hex file for production?

Use NOTEPAD and merge them, lose the last line of the first file.
Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
lee
leeAuthor
Associate II
January 23, 2014
Posted on January 23, 2014 at 16:06

OK! I was hoping for something more automated but if that is the simplest way then why not. Thanks.

chen
Associate II
January 23, 2014
Posted on January 23, 2014 at 16:17

Hi

If they are Intel Hex (or Motorola SRecords) then you can simply use command line :

type file1.txt file2.txt > out.txt

to concatenate the 2 files together. You can even turn it into a batch file.
waclawek.jan
Super User
January 23, 2014
Posted on January 23, 2014 at 16:20

http://srecord.sourceforge.net/ -> srec_cat

JW

Tesla DeLorean
Guru
January 23, 2014
Posted on January 23, 2014 at 17:56

I don't think you want to concatenate them, you need to lose the terminal record, unless the device programmers code is too stupid to see it, or simple ignores it.

Any way the format is pretty simple, I'd expect a college grad to be able to code some automation either explicitly, or using a script in AWK or PERL or something.
Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
chen
Associate II
January 23, 2014
Posted on January 23, 2014 at 17:59

Yeah, only spotted what I had posted after I hit send.

Point taken.

trevor23
Associate III
January 24, 2014
Posted on January 24, 2014 at 10:56

Hate this forum, has eaten my post three times now.......

Not hard to automate as other have said but if you want another option you could program a processor as you need it to be (bootloader and app) and upload a complete image (in hex or binary) from it using something like the ST Flash Loader. Then use that image for production. Programming time is not increased as empty pages are not sent if a global erase was performed first.

ivani
Visitor II
January 24, 2014
Posted on January 24, 2014 at 11:28

Most probably your IDE has such an option.

For IAR Embedded Workbench it could be done by Linker->Input->Raw binary image (the included file should be binary, not Intel Hex but the output could be of any kind). Don't fotget to put the symbol associated with the image in 'Keep symbols' list otherwise the linker will skip it.

lee
leeAuthor
Associate II
January 24, 2014
Posted on January 24, 2014 at 13:07

Very helpful, thanks everyone.

Tesla DeLorean
Guru
January 24, 2014
Posted on January 24, 2014 at 13:15

Keil, some what less so, although you can run external tools as part of the build/link process.

I'm generally of the opinion that the developer should create and package the final production image. The manipulation, securing and signing of ROM/FLASH images is very implementation specific, and needs to be owned by the design team, not the tool vendor.

Intel and Motorola HEX formats have been around for >30 years, and are simple and well documented. As Jan points out there's tools like SRecord. The ELF/AXF file formats also have a lot of documentation and examples, and are of medium complexity.
Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..