Bootloader option adding in header by mistake in online compiler

To reproduce, add a bootloader file to the blinky project for a XDOT_L151CC and add the following mbed_app.json to project (change bootloader name where required)

{
“target_overrides”: {

    "XDOT_L151CC": {
        "target.bootloader_img": "bootloader/lorawan-fota-bootloader.bin"
    }
}

}

In my case the file lorawan-fota-bootloader.bin is 0x7000 bytes

When compiled by the online compiler, there is an unknown section of 0x100 bytes being added at address 0x7000 and the actual blinky code starts at 0x7100

The code will not run as the bootloader will read 0x08007000 as the start address from POST_APPLICATION_ADDR location

Adding a header_format override in target

{
“target_overrides”: {

    "XDOT_L151CC": {
        "target.bootloader_img": "bootloader/lorawan-fota-bootloader.bin",
        "target.header_format": [
            ["magic", "const", "32be", "0x5a51b3d4"],
            ["headerVersion", "const", "32be", "2"],
            ["firmwareVersion", "timestamp", "64be", null],
            ["firmwareSize", "size", "64be", ["application"]],
            ["firmwareHash", "digest", "SHA256", "application"],
            ["headerCRC", "digest", "CRCITT32be", "header"]
        ]
    }
}

}

Then ends up with the fake header “0D 0A FF …” still at the 0x7000 address in the binary output, and the actual header at 0x7100 and the code at 0x7200

So something is generating this fake header. The mbed ide compiler does not have this issue.