Json configuration file? [SOLVED]

After the shut down of the online IDE, everything seems to be much more difficult.
How would you add the json configuration file to a project?
For example, before I had this configuration with my project. Now I made a file called mbed_app.json in the root of my project which contains the following:


{
    "macros": [
        "MBED_HEAP_STATS_ENABLED=1",
        "MBED_STACK_STATS_ENABLED=1",
        "MBED_MEM_TRACING_ENABLED=1"
    ],
"target_overrides":
    {     
"NUCLEO_L476RG":
        {
"platform.stdio-baud-rate": 115200,
"target.components_add": ["SD"],
"target.components_add": ["STORAGE"],
"target.components_add":["InterruptIn"],
"platform.stdio-convert-newlines": true
        }
 
    }
 
}
    

But still the compiler cannot find the SDBlockDevice. It seems that the configuration is not working.
Kindly would you let me know how to add configuration files to the MBED studio projects?
It was supposed that the IDE help you in making that … but I cannot find any help inside the IDE.
Thanks in advance

Hello,

configuration system over .json files is nothing new it is here very long, was also in old Online compiler. It is in context in MbedOS version what you used until now - The configuration system - Program setup | Mbed OS 6 Documentation

This is necessary content just for SD block device API

{
    "target_overrides": {
        "*": {
            "target.components_add": ["SD"]
        }
    }
}

BR, Jan

Hi, I know, but now you don’t know why it is not working.
I have the mbed_app.json in the root where the mbed-os.lib file is and is the root of the other folders but still mbed studio cannot find the SDBlockDevice.h
That project was working at the online IDE using the same above json code.

EDIT:
It seems that you have to CLEAN the previous compilation as soon as you move or create the json file. I got error before and suddenly it works.
Anyone get the same issue, put the file in the root folder as I mentioned before where you have mbed-os.lib and other files.

Ok, I badly understood your description, sorry.

As soon as you change the content of mbed_app.json then MbedStudio should trigger complete rebuild, but times to times this not happen for some reason (seems to be your case) and Clean build have to be run manually.

BR, Jan

Sorry, maybe it was not so clear.
I moved the json file to many sub folders just to see why it was not working. so none of the sub folders worked either. So, I returned back the json file to the root and cleaned the build and compiled again and it worked.
That is what I meant before. sorry if I wasn’t clear.

1 Like