Support for Mbed OS 6: Stable and mature APIs, Cloud services support, Enhancements to the Bare Metal Profile

The basic gist is that you fork mbed-os, add a package.json (see old C:\Users\<user>\.platformio\packages\framework-mbed file and adapt version) and add the platformio folder (builder scripts, GitHub - platformio/builder-framework-mbed: ARM mbed build script for PlatformIO Build System). You can then reference that fork as the source for framework-mbed through platform_packages.

Since the mbed-os version is above what the builder scripts expect, you may occassionally run into errors. I did when I just tested this using my fork and platformio.ini

[env:nucleo_f103rb]
platform = ststm32
board = nucleo_f103rb
framework = mbed
platform_packages =
   framework-mbed@https://github.com/maxgerhardt/mbed-os.git
monitor_speed = 9600

and src\main.cpp and mbed_app.json from platform-ststm32/examples/mbed-rtos-blink-baremetal at develop · platformio/platform-ststm32 · GitHub

with the error

ModuleNotFoundError: No module named ‘jsonschema’:

A missing Python dependency. So I opened a CLI, used pio system info to find the Python executable and then executed

<python path> -m pip install jsonschema

to install the missing dependency.

After that, a “Upload & Monitor” gives

PACKAGES:
 - framework-mbed 6.601500.210922+sha.d3c2a6db
 - tool-dfuutil 1.9.200310
 - tool-openocd 2.1100.0 (11.0)
 - tool-stm32duino 1.0.2
 - toolchain-gccarmnoneeabi 1.90201.191206 (9.2.1)
Collecting mbed sources...
..
--- Miniterm on COM3  9600,8,N,1 ---
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
This is the bare metal blinky example running on Mbed OS 6.15.0.

--- exit ---

So this is running mbed-os 6.15.0 now, compared to the latest framework-mbed 6.9.0 package available.