5 years, 2 months ago.

Setting a configuration variable to compiler or mbed system

Hello guys,

I'm trying overwrite a variable that is set in the file "mbed-os/targets/targets.json", but I don't having success. The default of the variable that I want set is "default_lib": "small", and I'm needing set to "default_lib": "std", the only way that work for me is set directilly in the file "mbed-os/targets/targets.json", but I think that isn't the rigth way. Is there another way of editing just a file in the application part of the project and don't a file of the framework? I tried to set it in the mbed_app.json, but didn't work (or I don't set it).

Thanks,

1 Answer

5 years, 2 months ago.

Hi Willian,

You are correct - the proper way to modify the build configuration is through the local project file (at your project root) called mbed_app.json. You can read about the configuration system here:

The syntax for the file needs to be exact. In your instance, if you want to override the small library with "std" you can use this for your mbed_app.json. In this example I've used a LPC11U24 target:

{
    "target_overrides": {
        "LPC11U24": {
            "target.default_lib": "std"
        }
    }
}

If you think this isn't working, could you post your mbed_app.json with the final few lines of the build output which shows the libraries being included as shown here:

[DEBUG] LPC Patch: os2_test.bin
| Module            |         .text |       .data |     .bss |
|-------------------|---------------|-------------|----------|
| BUILD\LPC11U24    |        68(+0) |       4(+0) |   24(+0) |
| [fill]            |        91(+4) |       0(+0) |    6(+3) |
| [lib]\c.a         | 18147(+18147) | 2472(+2472) |  89(+89) |
| [lib]\c_nano.a    |      0(-3511) |     0(-100) |   0(-12) |
| [lib]\gcc.a       |   9228(+8184) |       0(+0) |    0(+0) |
| [lib]\mbed.a      |      1130(+8) |       4(+0) |   13(+0) |
| [lib]\misc        |       244(+0) |       8(+0) |   28(+0) |
| mbed\97feb9bacc10 |      3258(+0) |       8(+0) |  280(+0) |
| Subtotals         | 32166(+22832) | 2496(+2372) | 440(+80) |

Regards,

Ralph, Team Mbed