Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
6 years, 11 months ago.
Mbed-os 5.4, offline, purpose of mbed_config.h file? SW4STM32
Hi, looking for some insight.
I'm working with 5.4.4 in System Workbench 1.14. When you export a project from mbed-cli and you get a file called mbed_config.h. It appears to have helpful configuration parameters like this:
#define MBED_CONF_RTOS_PRESENT 1 // set by library:rtos #define MBED_CONF_PLATFORM_STDIO_BAUD_RATE 9600 // set by library:platform
Except that by default mbed_config.h is NOT included anywhere, so is ignored. Values here do nothing. On first compile you get an error because RawSerial.h and Serial.h are both looking for MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE value and can't find it. It seems like the intention was to use mbed_config.h, but these modules can't see it by default.
Also in mbed.h, the rtos.h include is conditional on MBED_CONF_RTOS_PRESENT being defined. rtos.h is NOT included in the default project mbed-cli gives you, again because mbed_config.h is not referenced anywhere. But if I turn this flag on, there are a lot of new compile errors inside Events folder.
So mbed_config.h:
- Looks like it is meant for us to include
- But is not actually included by default
- Starts breaking things if you manually include it
Are we meant to include mbed_config.h in our project?
Thanks!
1 Answer
6 years, 11 months ago.
Hi, it should be built actually. If I export to Makefile the file is included in the build command (so no need to #include yourself):
C_FLAGS += mbed_config.h CXX_FLAGS += mbed_config.h
If that's not the case when exporting to Systems Workbench then that would be a bug.
The file is ignored when building with mbed CLI as you can override using mbed_app.json.