Error - The Load Image Header was not found for this application.

I'm trying to create a BCH file and I'm running into the error Error - The Load Image Header was not found for this application.

Ultimately I want the bootloader to pull a file from the USB thumbdrive and load it into flash. I'm looking over the example from this thread https://renesasrulz.com/synergy/f/synergy---forum/7103/bootloader-from-usb-for-s7/32283#32283 and in preparation I'm trying to get a couple of application images I can upload to verify I'm actually pushing the files into flash.

I started with the downloader from the Flashloader examples (USB CDC non_blocking), I'm using an SK-SG7 dev. kit so I commented out the code inside the Downloader_entry function so it's not trying to check for the presence of an SD card. I'm using IAR and generating an srec, but when I try and run the python script c:\python27\python.exe r_fl_mot_converter.py -i downloader_usb_cdc_non_blocking.srec -o downloader_slow.bch -m 1024 -f 256 -e 0x100000 -l 0x100800 -s 0x300000 I'm running into the error "Error - The Load Image Header was not found for this application. Look at structure of Load Image Header for what is supposed to be found"

Given this is the Flashloader example and it already has the downloader threads, I thought this information should have already been present. I'd prefer not to have any of the Flashloader stuff loaded in my application code though, so I thought this post https://renesasrulz.com/synergy/f/synergy---forum/8553/flashloader-r_fl_mot_converter-py-question/27893#27893 would be promising to solve both my current problem, and let me move to my actual application without having to add in the Flashloader. However, with that added custom array into blinky_thead_entry.c at the top, and <version>, <image_id>, replaced with 1, 1, I'm still getting the error.

Any ideas on what I'm missing? Thanks.

  • Hi Mike,

    Have you already solved this issue? If not yet, please wait a little bit more until Synergy experts respond to your issue. Thank you for understanding.

    JB
    RenesasRulz Forum Moderator

    https://renesasrulz.com/
    https://academy.renesas.com/
    https://en-us.knowledgebase.renesas.com/

  • Hi Mike,

    Have you inserted the correct section into your linker script at 0x800 offset?

    Regards

  • In reply to Renesas Karol:

    I'm using the downloader example from the USB CDC non-blocking.

     

    Yes, that's in my linker script, at the 0x800 offset, as below. (I was hoping it was just a variable typo, so I've gone over that a couple times and didn't see anything)

     

    /* Hardware lock lookup array. */

    __Lock_Lookup_Start = .;

    KEEP(*(SORT_BY_NAME(.hw_lock_lookup.*)))

    __Lock_Lookup_End = .;

    __Lock_Lookup_Size = __Lock_Lookup_End - __Lock_Lookup_Start;

     

    /* Flash Loader App Header at 0x800. This offset is fixed in sf_firmware_image.h and in XML */

    . = __ROM_Start + 0x800; KEEP(*(.sf_firmware_image_file_header*))

    *(.text*)

     

    Thanks

  • In reply to Mike:

    Hi Luke,

    Is linker script in your application (not the bootloader) modified such that FLASH starts at 0x100000?

    Regards
  • In reply to Renesas Karol:

    Yes, I believe so.

    /* Linker script to configure memory regions. */
    MEMORY
    {
    FLASH (rx) : ORIGIN = 0x00100000, LENGTH = 0x0300000 /* 4M */
    RAM (rwx) : ORIGIN = 0x1FFE0000, LENGTH = 0x00A0000 /* 640K */
    DATA_FLASH (rx) : ORIGIN = 0x40100000, LENGTH = 0x0010000 /* 64K */
    QSPI_FLASH (rx) : ORIGIN = 0x60000000, LENGTH = 0x4000000 /* 64M, Change in QSPI section below also */
    SDRAM (rwx) : ORIGIN = 0x90000000, LENGTH = 0x2000000 /* 32M */
    }
  • In reply to Mike:

    Hello Mike,

    Seems like you have everything needed to run the BCH converter. Can you share the .map file from the Debug folder to verify the actual header placement?

    Regards
  • In reply to Renesas Karol:

    I can share the whole project, not sure if there's a way to upload this zip files, so I've just uploaded it to OneDrive and linking it here 1drv.ms/.../s!Aoqh2etBS-wrh6lZnmJ1DYQJ-RDLOw
  • In reply to Mike:

    Hello Mike,

    I've just read your original post and realised you're using IAR. IAR doesn't use .ld files (you've been applying modifications to) and instead .icf file should be modified. In order to change your image size and offset:
    * increase the addresses for symbols from region_VECT_start to region_FLASH_start by size of your bootloader (0x100000?).
    * in the code where image header is provided, replace BSP_PLACE_IN_SECTION part with @ 0x100800 (assuming your main app is offset by 0x100000 from the base of flash). IAR provides a way of specifying absolute placement which will take precedence before rules listed in the .icf file.

    Regards
  • In reply to Renesas Karol:

    I've updated the regions in my .icf file, and changed the struct definition to:

    const struct
    {
    uint8_t valid_mask;
    uint8_t version_number;
    uint16_t image_identifier;
    uint32_t unused[12];
    } image_file_header @ 0x100800 =
    {
    (uint8_t) 0xAF, 1, 1, {0}
    };

    Now I'm getting "Error - Valid mask in Application Header did not match the value it was supposed to be.
    Expected Value = 0xaf Actual Value = 0x0"

    If I take a look at the srec file:
    "S21410080000000000000000000000000000000000D3"

    So it looks like the struct isn't being created at the address I've defined.

    If I manually edit the file:
    "S214100800AF010001000000000000000000000000D3"

    Then I can create the BCH file using the Flashloader Utility, however when I try and use either that file, or any of the BCH files included in the images directory on in the Flashloader ZIP, I'm getting the error "SSP_ERR_NO_EMPTY_SLOTS" from the following line:

    "status = g_sf_firmware.p_api->newImagePrepare(g_sf_firmware.p_ctrl, p_header, &prepare_info);"

    So I've made some progress and maybe these errors are related, but still can't generate BCH files by script, and the had edited and examples included from Renesas don't actually work with the bootloader...
  • In reply to Mike:

    Oh, also I get a warning that "__vector_table symbol not found. e_entry values:0x00109CF0 does not match reset vector value: 0x00013BDC Initial SP_main value: 0x1FFE1000 uncertain." after moving the stuff in .icf
  • In reply to Mike:

    Okay, so I figured out the SSP_ERR_NO_EMPTY_SLOTS error, I had been trying a different example for the bootloader and it had the application starting at 0x040000, so once I updated it to 0x100000 to match what I was coming from the application that got around that error. That was using the BCH images that came with the Flashloader, I'm still having problems creating the BCH files.
  • In reply to Mike:

    Hello Mike,

    I think linker may be optimizing the image header out. Please insert BSP_DONT_REMOVE before "image_file_header" symbol. This will map to __root when using IAR and should provide the desired effect: www.iar.com/.../.

    Regards
  • In reply to Renesas Karol:

    The produced a keyword not allowed error, but it did work if I broke it out like this.

    typedef struct file_header
    {
    uint8_t valid_mask;
    uint8_t version_number;
    uint16_t image_identifier;
    uint32_t unused[12];
    } file_header;

    __root const file_header image_file_header @ 0x100800 =
    {
    (uint8_t) 0xAF, 1, 1, {0}
    };

    So that's working with the example code, now when I try and move this to my application (which I'm trying to get running without having the downloader portion of the Flashloader included in, I get the following error from the S-REC to BCH conversion tool ('Indexing Error, Slot:', 1073872976). I'm guessing this is related to information about memory location and size for the bootloader to use not being included in the image?
  • In reply to Mike:

    Hello Mike,

    1073872976 in hex is 0x40020050 and this becomes 0x40120050 once you add application start address. This is the address at which the ID bytes are inserted and such data seems to be confusing the BCH converter. Flashloader Framework doesn't perform programming of the ID bytes anyway so you can remove following highlighted elements from the .icf file and rebuild the project:

    Regards

  • In reply to Renesas Karol:

    Thanks Karol, that seems to have worked (at least I can build the BCH files, I'm working remote tonight so I can't copy the file over to the USB drive and test loading it from the bootloader till tomorrow) will update once I've given that a shot.