How can I use the mbed_app.json to enable RTOS features in the MBED framework?

To enable the RTOS features in MBED I am trying to do something like this:

// mbed_app.json
{
    "target_overrides": {
        "*": {
            
        }
    },
    "config": {
        "rtos.present": true
    }
}

But the app won’t build and spits out an error saying Invalid parameter name 'rtos.present' in 'application'

I know I can use the build_flags = -D PIO_FRAMEWORK_MBED_RTOS_PRESENT in platformio.ini, but like… the above should work no?

Its just near impossible to find out which json keys are valid in the MBED docs. Its so vague! Yet so powerful.

The way to do it with the native toolset is to use mbed compile --config in the project directory (source). But that’s not available in PlatformIO as far as I can tell.

What the tool will do internally is scan all the mbed_lib.json files that apply for the project. E.g.

So here you can also see that it should have been called rtos-api.present. Also matches source. Another mbed_lib.json would be the one in drivers.

So I tried doing this in a native MBED project, but it wouldn’t spit out the content unless I did some more configuration ie. setup a dev environment for the MBED framework (without pio). I got frustrated and gave up.

However, I was able to find this page buried in the docs which seems to display all the possible values.

I wonder if I could make a script for pio to pull all this data out :thinking:

Someone on the mbed forum pointed me to a tool they made which does a similar thing