[MBED/SMT32] rtos.h not found

Hello,

After few weeks without any issue, today I got the rtos.h not found error again. After some research, I found out my platformio seems confused with compiler flags:

[env:MainController]
platform = ststm32
board = nucleo_f446re
framework = mbed
upload_port=/dev/cu.usbmodem14733
src_filter = +<*> +<MainController> -<Device*>
build_flags = -D PIO_FRAMEWORK_MBED_RTOS_PRESENT

[env:Device1]
platform = ststm32
board = nucleo_f446re
framework = mbed
upload_port=/dev/cu.usbmodem14713
src_filter = +<*> -<MainController> -<*Test> +<Device1>

[platformio]
default_envs = Device1 , MainController

produce rtos.h not found.

  1. How would I solve that without adding an extra build_flags ?
  2. I noticed all the upload goes to one board only, usually Device1 instead of their own respective board whatever the upload option i’m choosing. I need to disconnect the unwanted board to upload the code.

Thanks for your help!

Isn’t this upload port a serial device? The default upload protocol is stlink which will take the first available STLink device and upload to it.

If you want to upload it seperately you would need to use mbed as upload_protocol and then give the path to the virtual USB disks in the upload_port for each board.

Could you explain this further? What research, what’s the wrong behaviour (with minimal example)?

The project got 2 boards as describe in the platformio.ini file.
When both got the option -D PIO_FRAMEWORK_MBED_RTOS_PRESENT, intellisence is happy and won’t complain about missing header files like rtos.h.

When the -D option is removed from Device1 as it doesn’t need rtos, intellisense got mad and complains about missing header like rtos.h.

It seems to me the -D is deal globally instead of locally to each board.

Is this expected ?

thanks