Arm Mbed OS support forum

Creating and using a bootloader per mbed OS 6.13

Created a bootloader(bare) and application combo as per the basic managed bootloader in the mbed V6.13 documentation. I then tried to add the application header example mbed_lib.json file to both the bootloader and application root directories. The bootloader project goes from compiling and linking correctly to getting a “Linker script not found” error. I can rename/remove the mbed_lib.json file from the bootloader project and it goes back to compiling and linking correctly. The application with the same mbed_lib.json file compiles with the old bootloader .bin file without a hitch.

Without mbed_lib.json

Scan: sniiBootloader
Using ROM regions application, post_application in this build.
Region application: size 0x20000, offset 0x8000000
Region post_application: size 0x1e0000, offset 0x8020000
Using RAM region application_ram in this build.
Region application_ram: size 0x80000, offset 0x24000000
Link: sniiBootloader
[Warning] @0,0: L3912W: Option 'legacyalign' is deprecated.
Elf2Bin: sniiBootloader
Merging Regions
Filling region application with BUILD/SNII_HUB_MAIN/ARMC6\sniiBootloader_application.bin
Space used after regions merged: 0xc044
Merging Regions
Filling region application with BUILD/SNII_HUB_MAIN/ARMC6\sniiBootloader_application.bin
Space used after regions merged: 0xc044
| Module                       |     .text |  .data |     .bss |
|------------------------------|-----------|--------|----------|
| [lib]\libcppabi_w.l          |    44(+0) |  0(+0) |    0(+0) |
| [lib]\mc_w.l                 |   924(+0) | 12(+0) |   40(+0) |
| anon$$obj.o                  |    32(+0) |  0(+0) | 4352(+0) |
| main.o                       |   752(+0) |  0(+0) |  708(+0) |
| mbed-os\drivers              |  1182(+0) |  0(+0) |   16(+0) |
| mbed-os\hal                  |  1362(+0) |  8(+0) |  114(+0) |
| mbed-os\platform             |  5132(+0) |  0(+0) |  327(+0) |
| mbed-os\rtos                 |     4(+0) |  0(+0) |    0(+0) |
| mbed-os\storage              | 22405(+0) |  0(+0) |   16(+0) |
| mbed-os\targets              | 15943(+0) | 16(+0) | 1524(+0) |
| targets\TARGET_SNII_HUB_MAIN |  1316(+0) |  0(+0) |    0(+0) |
| Subtotals                    | 49096(+0) | 36(+0) | 7097(+0) |
Total Static RAM memory (data + bss): 7133(+0) bytes
Total Flash memory (text + data): 49132(+0) bytes
Update Image: BUILD/SNII_HUB_MAIN/ARMC6\sniiBootloader_update.bin
Image: BUILD/SNII_HUB_MAIN/ARMC6\sniiBootloader.bin
Building project sniiBootloader (SNII_HUB_MAIN, ARMC6)

**With mbed_lib.json:**

Scan: sniiBootloader
Using ROM regions application, post_application in this build.
Region application: size 0x20000, offset 0x8000000
Region post_application: size 0x1e0000, offset 0x8020000
Using RAM region application_ram in this build.
Region application_ram: size 0x80000, offset 0x24000000
No Linker Script found
Could not compile for SNII_HUB_MAIN: No Linker Script found

mbed_lib.json:

{
    "name": "application_header",
    "target_overrides": {
        "*": {
            "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"]
            ]
        }
    }
}