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

How to (easily) flash a custom .hex file with debugger?

Hello,

I am developping on a firmware using a bootloader which verifies main application's CRC prior to let it start. To do this, I am generating an extra .hex file with data for bootloader added to the .hex file created by Keil. 

I thought I just had to rename my .hex file with data to the name of the one generated by keil... But Keil's debugger is loading the .axf file, not the .hex one :-(

The only workaround I found was to load my .hex with data with another flash programmer, and then start debugging with Keil to have debug symbols. 

Does anyone know how I could do this directly with Keil ?

Thanks a lot in advance!

Parents Reply Children
  • Hi Ron,

    Thank you for the reply.

    I succeeded to load my custom .hex file with the debugger, but as it does not contain any debug information, this will not be very useful for debugging.

    Basically, I need to :

    1.  load a .hex file with application's CRC to be able to start the application

    2.  load application's .axf file which contains debugging data for application to be able to debug it.

    I manage to do step 1 or step 2 independently, but not one after the other with keil's debugger.

    Regards,

    Aina

  • If this is purely for debug, consider having your firmware understand this is the case via a magic value in RAM or the vector table, so it can skip the signing/checksum test for debugging. Perhaps probe the ITM/DWT registers to understand it is running via a debugger.

    The script may be able to LOAD two images (.AXF). I've not needed the symbols for both (loader/app) in order to run them and understand what's happening in the debugger, but if I did, I'd merge the .ELF/AXF files and the symbol tables.

  • You could also you the INCREMENTAL option with the LOAD debug command to load more than one hex file at once, without needing to merge / rerun a CRC on the result

  • This is what I am doing, but loading of my first .hex file (the one containing application's CRC) fails with keil's debugger, although I have no problem while loading it with STM32CubeProgrammer.

    I am getting the error "target memory verification failure", followed by "error 57: illegal address (0x800C000). (Note: 0x800C000 is my application's starting point)

    Other strange thing: if I first load my .hex with STM32CubeProgrammer, and then start a debug session with Keil, I get no error.