I don't understand how to use the Mbed OS configuration system. I think the reference documentation regarding it is unclear. If I'm missing something(s) obvious, please point me to it. Otherwise, please clarify the documentation to answer questions such as those I pose below. (Also, I'd appreciate some quick answers here, if possible.)
For instance, the page linked above provides an example of how to configure the stack size for the main thread, by putting this in mbed_app.json
:
{
"config": {
"main-stack-size": {
"value": 2000
}
}
}
But how does this work? What does it do? I couldn't find "main-stack-size
" anywhere in the mbed-os
or mbed-cli
code trees. (I used grep -R
.)
On further searching (grep -Ri "main[^ ]stack[^ ]size" .
), I find the conditional #define MBED_CONF_APP_MAIN_STACK_SIZE
in mbed_boot.c
, so I infer that lower-case-hyphenated
labels in .json
files get somehow translated to MBED_CONF_ALL_CAPS
#define
s - but how? Where is the code that does this so I can learn more when the documentation falls short, or I want to improve something? How/where do the custom #define
s I configure get made visible to my code? (e.g. In makefiles, or is a new header file generated? What about when I use mbed export
?) [EDIT: I see that it generates mbed_config.h
. Please consider mentioning this in the documentation.]
Where can I find the list of configurable items? Are there more than what are listed on the pages linked below?
How does the info on the Platform, Drivers, RTOS, and Connectivity pages translate to what I should put in a .json
file? And how do the .json
files get named?
For instance, the Platform page begins with this:
Configuration parameters
------------------------
Name: platform.default-serial-baud-rate
Description: Default baud rate for a Serial or RawSerial instance (if not specified in the constructor)
Defined by: library:platform
Macro name: MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE
Value: 9600 (set by library:platform)
What do I put in a .json
file to #define MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE
to the desired value? How do I name the .json
file? What is the meaning of the .
separator in the Name
? What is the meaning of the :
separator in Defined by
?