Mbed forum

A minor change to mbed_app.json results in full re-build

(Jacob Torres) #1

I am using mbed CLI offline compiler. When I make a small change to mbed_app.json (e.g. change wifi AP to connect to), I have to wait for a full re-build of the whole OS which really cuts into development time (extremely slow process on my side). Is there any way to prevent this for minor changes?

(Austin Blackstone) #2

Yes, put the minor changes as #defines in your main.cpp and it will compile faster.

The mbed_app.json and mbed_lib.json are meant to store configuration defines for turning on / off core services, thus any change in them requires a full rebuild as they are used to enable thing like BLE, Wifi …etc.

(Jacob Torres) #3

Can you share an example of how to define SSID and password as a #define?

All of the example code puts configs into the JSON that could reasonably be changed on a regular basis with no impact on the compilation of the OS. Dynamic buffer allocations (HTTP buffers, thread stack), wifi SSID, baud rate, etc.

(Austin Blackstone) #4

any change to the json file should result in a clean recompile.

Per the rules of the config file (https://os.mbed.com/docs/mbed-os/v5.11/reference/configuration.html) anythiing defined in the json file should effectively just be a macro thats prepended with MBED_CONF_APP, so if you define ssid in the .json file it would be the same as defining #define MBED_CONF_APP_SSID xxxx where ‘xxxx’ is the SSID of your network.

So if you’re having trouble with re-compiles, just move the value to your main (assuming its something like a sside, or a password). For things like turning libraries on or off or using core utilities a rebuild is just a fact of life, just as much as turning on debug symbols would trigger a rebuild.