Getting mbed OS actual configurations from platformio

Hi all,

I’m working with PlatformIO to program a nucleo with Mbed 5.
I need to configure the mbed framework, I’m trying to do that with the mbed_app.json file.
To do that I need to obtain the actual configuration of the mbed environment, with mbed CLI program I could do it with the command mbed compile --config.

How can I obtain the same result with PlatformIO?

Could you show an example what does return mbed compile --config for your project?

No, I can’t because my project is a platformio based one (I have initialized it with the command pio init).
This is the problem I cannot run the mbed command in this directory.

@valeros what is the best way to list mbed OS configuration options?

@NoeMurr a temporary solution is to take a look at Project/.pioenvs/***/mbed_config.h file and manually override configuration data. For example,


#ifndef __MBED_CONFIG_DATA__
#define __MBED_CONFIG_DATA__

// Configuration parameters
#define CLOCK_SOURCE                                       USE_PLL_HSE_XTAL|USE_PLL_HSI                                                   // set by target:DISCO_F407VG
#define LPTICKER_DELAY_TICKS                               1                                                                              // set by target:FAMILY_STM32
#define MBED_CONF_DRIVERS_UART_SERIAL_RXBUF_SIZE           256                                                                            // set by library:drivers
#define MBED_CONF_DRIVERS_UART_SERIAL_TXBUF_SIZE           256                                                                            // set by library:drivers
#define MBED_CONF_EVENTS_PRESENT                           1                                                                              // set by library:events
#define MBED_CONF_EVENTS_SHARED_DISPATCH_FROM_APPLICATION  0                                                                              // set by library:events
#define MBED_CONF_EVENTS_SHARED_EVENTSIZE                  256                                                                                                                                                         // set by library:platform
#define MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE        9600                                                                         // set by application[*]


So, let’s override MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE to 115200. We need to create mbed_app.json in the root of PlatformIO project:


  "target_overrides": {
    "*": {
      "platform.default-serial-baud-rate": 115200

The formula is very simple. Just remove MBED_CONF_ prefix, then convert macro to GROUP.some-option-name.

P.S: Don’t forget about docs Mbed — PlatformIO latest documentation

At the moment, the only way to observe configuration info is to open the mbed_config.h file.