This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Trying to convert HEX or BIN file to AFX or add Pages to AFX.

Hi.

I'm using a licensed µVision 4 and I'm trying to improve the programming of my devices.

First, this is how I do it now:

I create a AFX program file with µVision4 and I can flash the devices (usually Cortex M3) using an ULINK2 Programmer and the JTAG of the devices.
This is great for debugging as the AFX-file contains debugging information.

Besides this, I need to create a checksum of the binary and add the sum to the flash of the devices.
Therefore, I create a BIN file from the AFX file, calculate the checksum and program the flash of the device using a serial connection and the internal bootloader. This way I can add the checksum to the internal flash.

So, the problem is:

I need to switch on the boot-Pins for activating the internal boot loader of the STM32 (In my case, I have to press and hold some buttons on the device), this is a lot of annoying work. I would prefer a solution using the ULINK2 (and JTAG).

Maybe someone knows if there is a solution for one of the following scenarios:

1.) I can add the checksum (some numbers) to the AFX file and use the ULINK2 for programming and for adding flash (tool for calculating checksum from BIN or HEX file which is created automatically by µVision4, is already working). I won't need to activate the Bootloader of the device this way.

2.) I can convert AFX->BIN (done by fromelf, etc.), change BIN file (by adding checksum to the end) and convert BIN->AFX (by adding debugging information somehow??) and than use the ULINK2 for programming.

3.) Maybe someone else has a good idea how to do this automatically?

Any help would be greatly appreciated.

Parents
  • Add a "user program" that creates makes a bin file (fromelf.exe) adds a crc (your file.exe) and then coverts the bin file to hex (srec_cat.exe).

    Add an init file to the Utilities tab that contains the following

    Load hexfilename.HEX

    This allows you to take your AXF, add the CRC, create a hex file and then burn the hex file AND the AXF file is still fully associated for debugging.

Reply
  • Add a "user program" that creates makes a bin file (fromelf.exe) adds a crc (your file.exe) and then coverts the bin file to hex (srec_cat.exe).

    Add an init file to the Utilities tab that contains the following

    Load hexfilename.HEX

    This allows you to take your AXF, add the CRC, create a hex file and then burn the hex file AND the AXF file is still fully associated for debugging.

Children
  • Hi. Thanks a lot for this idea, this would be the best solution.

    I'm just wondering, if I need to add the whole content of the original program (firmware) + the checksum to the hex file, or the checksum only (which will need the possibility to set the address of the checksum in flash [somewhere in the bin/hex file?], too)?