forked from ARMmbed/mbed-os
-
Notifications
You must be signed in to change notification settings - Fork 26
Implement support for building Mbed as a PlatformIO framework #494
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
JohnK1987
approved these changes
Sep 18, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary of changes
This PR implements very basic support for using Mbed OS CE as a PlatformIO framework.
The bulk of of the work here is in implementing a script that will load the target information created by CMake and pass it to SCons, PlatformIO's build system. Luckily, some PIO devs pointed out that someone else had already done this for ESP-IDF, which also uses CMake. I used this script as a base, but also made a number of improvements:
cmake_to_scons_converter.py
which contains the non-Mbed-CE-specific logic for converting CMake API data to SCons format, andbuild_mbed_ce.py
which is a PlatformIO-SCons script for Mbed CE.With these changes, and a patched platform repo, and a patched PIO core library (5 line change), it is possible to build and use Mbed CE with PlatformIO.
Also, I put some effort into making sure that rebuilds/reconfigures are done when needed. I have made sure that:
pio run
vspio debug
causes a rebuild with the correct flagsNote that since this has only basic platformIO support, it does not yet support linking libraries other than
mbed-os
. This means you cannot use mbed-baremetal or other libraries like netsocket.Impact of changes
Mbed CE can be used as a PlatformIO framework
Migration actions required
Documentation
None yet but will work with PlatformIO developers
Pull request type
Test results
Able to flash and run code on my K64F board using this branch!