[Help Wanted] Mbed CE: A community fork of Mbed OS

Hello friends in the community. For those who don’t know me, I’m Jamie Smith. I worked on Mbed-based avionics code at USC Rocket Propulsion Lab for three years, and I helped send an Mbed board to space in 2019 (I still have it sitting on my desk). It’s been a fun few years, sharing our projects and helping each other out.

However, I think that it’s time to accept what we’ve all been fearing: It seems like the Mbed OS project is on life support. Most of the devs have been unresponsive for the last 6+ months, ever since the ARM restructuring and the project “pause” were announced. The only activity on the Mbed repo is merging bugfix patches from contributors: there’s no first-party development happening, and significant changes aren’t even being accepted. The silence gets more ominous every day, and I’m worried that someday ARM will declare Mbed a failed experiment and shut down this site entirely.

But they aren’t figuring on us! I’m sure there are quite a few of us like me and my lab, who have built large systems relying on Mbed OS, and are not ready to change all that just because ARM made an arbitrary decision to stop support. I believe that Mbed has a lot of great ideas, and I want to keep using it for a long time coming. To that end, I’d like to announce a project I’ve been working on for the last several months: a community edition/fork of Mbed OS.

Mbed CE

Mbed OS Community Edition (CE)

Mbed CE is going to be very similar to Mbed OS, except that it can be managed by us in the community. We will be able to make our own changes and bugfixes, without waiting for ARM’s badly understaffed review process. We can also choose to make breaking changes that fix some of the long-standing issues with Mbed, if we so decide.

However, the hard part is that we’ll need to break Mbed’s current dependence on ARM infrastructure. Things like Mbed Studio, the online compiler, and Mbed’s CI system / device farm will not necessarily be available to us for much longer. While this might sound daunting, I have a plan for how we can replace these things, and have already made a lot of progress

First and foremost, I almost completely rewrote Mbed OS’s build system to improve its capabilities and bring it more inline with standard CMake. First of all, you can now have as many executables and libraries as you want in a single project, and Mbed OS will only be compiled once. Also, the new system also allows you to upload and debug code on a target using only CMake commands – no dragging files around, no futzing around with multiple commands. The need to use custom Mbed python programs has been nearly eliminated – they still exist under the hood but they are called automatically by CMake. Last but not least, the build system has official support and automatic config generation for two IDEs: VS Code and CLion.

Second, I wrote up a full set of docs for the new build system. This includes an example project, a toolchain install guide, an upload method guide, and the aforementioned IDE guides.

Lastly, I’ve set up a prototype Jenkins server which can run tests on actual hardware. It took a while to get things operational, but I am now able to get a good part of the Mbed OS test suite to automatically run and pass for one target (LPC1768). The next step would be to use the test shield PCB I designed to create test cases that test the hardware and buses on each MCU. Eventually, I want to scale this up into a device farm even bigger and better than what ARM has (I’ve heard it’s only 8 devices?)

This is a good start, but with the time I’m able to commit, I am not sure I’ll be able to take things much further on my own. This is enough for Mbed CE to live on its own as a fork, but not really for it to be a sustainable project. But I think that this has the potential to become a great resource to those of us with projects that depend on Mbed. I just need your help to make it happen.

Where can we take this project?

  • Fix Bugs: There are hundreds of open Mbed OS bugs, especially if you count the ones ARM sneakily closed for no good reason. We can fix them, without being bogged down by such an arduous review process.
  • Improve Docs: Mbed’s documentation is very spotty – some parts are good, other parts are very lacking. We can improve it, and centralize it into one place so people can actually find what they’re looking for.
  • 3rd Party Dev Tools: I added support for a number of 3rd party flashing and debugging tools, but there are even more that we could support.
  • New MCUs: Some MCU manufacturers, e.g. Microchip and Infineon, didn’t want to support their chips in Mbed, so ARM did not add them. We can add community ports for these missing MCUs.

What can I do?

  • Cloud Services: We will need to create a cloud-hosted instance of Jenkins (or another CI server) to run our CI jobs. We may also need a website and/or a forum, if this one were to go down. I could really use some help on this, it’s not my area!
  • Device Farm: Got space for a Raspberry Pi and a few Mbed boards to hook it to? You, yes, you, can be a part of the distributed CI system. We can send you the needed PCB, and you can set it up and watch the builds go by!
  • Area Maintainer: We will need at least one or two people who are familiar with each area of Mbed who can review PRs and fix bugs in that part of the code. Like, I can work on low level Ethernet drivers, but what I know about Bluetooth could fit in a 128 byte string. If we work together, we could probably figure this out!
  • Device Maintainer: Learned a lot about a specific MCU for your job? We all have one or two of em, right? Well, you could put that knowledge to good use by becoming the maintainer for that device in Mbed!
  • Bug Fixer: We have the Mbed OS bug list to go through, and also a few more usability-oriented issues I filed on Mbed CE. Got a patch? Make a pull request!
  • Beta Tester: If you want to start using Mbed CE, that provides valuable feedback to us too. Be sure to post any issues you have here or on GitHub!

If you want to help out, please comment on this thread or DM me! I believe that we can turn this project into something better than what Mbed 6.15 ever was, but only with your help! If no one is able to assist me, then, well… maybe Mbed OS will end up dying after all.

How do I use Mbed CE?

Just like Mbed OS, Mbed CE needs to be included in a top-level project in order for you to use it. You can either clone the sample project and base your project off of that, or you can follow the new project setup guide to create a blank project with the Mbed submodule added.

13 Likes

This looks like an amazing project, and I would absolutely love to see Mbed CE reinvigorate the development effort on one of the best HALs out there. I’ll shoot you a message about contributing!

1 Like

It sounds like a small step for a man but it could definitely be a giant leap for mbed-os. I am going to take a look to your project right now.

Thanks!

The day Mbed OS cease to exist will be a sad day. I have used the LPC1768 board for many nice projects, its supported APIs really helps. Would love to see Mbed CE succeed.

Well, you’ll be happy to hear that LPC1768 was actually one of the first boards I added to Mbed CE (it’s what my lab used to use, until it became unbuyable). So it’s supported out of the box for uploading and debugging. I even managed to work out the correct OpenOCD config to debug it – which is needed because pyOCD doesn’t support it anymore.

Hello @MultipleMonomials ,

I looked to your work what you have done and without much experience, with this method of building, I was able to upload the example relatively soon. It is really nicely written step by step - Home · mbed-ce/mbed-os Wiki (github.com)
Only with debugging via VScode I have some troubles.

I would like to help, but I am not sure if I have anything to offer, because I’m a slow self-taught = Bad English and not so high programing skill and knowledge. However I like to learn new things, so I will try something small for beginning.

The question is whether it is needed

Of course, it has some limitations, but all is on one place (that can be important because then are people more in contact with the source code), seems to be easy to implement, easy to manage and no resources are needed. This is good for start, full-fledged web could added later, if it will be still necessary.

BR, Jan

1 Like

I would absolutely appreciate your help! You’ve been a massive help to a ton of people here on the forums! And honestly, you are already helping me a lot by using the code and reporting any problems that you see.

Only with debugging via VScode I have some troubles.

What’s the problem? Feel free to DM me or make a github issue

The question is whether it is needed

Yeah that’s a good point. I had forgotten about GitHub Discussions, seems like it could potentially work as a forum for us to use.

Regarding GitHub Pages, I was actually thinking the same thing. What I want to do is create another repo that collects the Mbed static documentation together with the doxygen docs from the Mbed code and publishes it using GitHub Pages. It would also be good to merge the current wiki pages into there, so that all the docs are together in one place. I’ve asked @Jay_Sridharan to look into this when he has time.

1 Like

I will also check this CE version.
For debugging, I’m using the cortex-debug extension in VSC which works fine and it can connect using severals gdb servers, also the the STLink with V3 which is pretty fast. It needs only a few lines of configuration for a connection, I guess it will work also with the Mbed CE.

This is a sample launch.json with many different debug probes the servertype=stlink is now from STM, the stutil is old and should not be used. I like also the BMP which includes the gdbserver in the firmware. For STM targets, the V3Mini is great. The STLink gdbserver is not a single setup, it is included in the cube IDE in some deep deep subdirectory and this changes with updates.

launch.json

{
“version”: “0.2.0”,
“configurations”: [
{
“cwd”: “${workspaceRoot}”,
“executable”: “…/…/BUILD/${workspaceFolderBasename}/DEBUG/${workspaceFolderBasename}.elf”,
“name”: “debug JLink”,
“request”: “launch”,
“type”: “cortex-debug”,
“servertype”: “jlink”
},
{
“cwd”: “${workspaceRoot}”,
“executable”: “…/…/BUILD/${workspaceFolderBasename}/DEBUG/${workspaceFolderBasename}.elf”,
“name”: “debug pyOCD”,
“request”: “launch”,
“type”: “cortex-debug”,
“servertype”: “pyocd”
},
{
“cwd”: “${workspaceRoot}”,
“executable”: “…/…/BUILD/${workspaceFolderBasename}/Debug/${workspaceFolderBasename}.elf”,
“name”: “debug stutil”,
“request”: “launch”,
“type”: “cortex-debug”,
“servertype”: “stutil”,
“v1”: false,
“showDevDebugOutput”: true
},
{
“cwd”: “${workspaceRoot}”,
“executable”: “…/…/BUILD/${workspaceFolderBasename}/Release/${workspaceFolderBasename}.elf”,
“name”: “release stutil”,
“request”: “launch”,
“type”: “cortex-debug”,
“servertype”: “stutil”,
“v1”: false,
“runToEntryPoint”: “main”
},
{
“cwd”: “${workspaceRoot}”,
“executable”: “cmake_build/DEVEBOX_H743VI/debug/GCC_ARM/${workspaceFolderBasename}.elf”,
“name”: “debug stlink H743VI”,
“request”: “launch”,
“type”: “cortex-debug”,
“servertype”: “stlink”,
“runToEntryPoint”: “main”,
“v1”: false
},
{
“cwd”: “${workspaceRoot}”,
“executable”: “cmake_build/DEVEBOX_H743VI/release/GCC_ARM/${workspaceFolderBasename}.elf”,
“name”: “release stlink H743VI”,
“request”: “launch”,
“type”: “cortex-debug”,
“servertype”: “stlink”,
“runToEntryPoint”: “main”,
“v1”: false
},
{
“cwd”: “${workspaceRoot}”,
“executable”: “cmake_build/STM32F407VE_BLACK/release/GCC_ARM/${workspaceFolderBasename}.elf”,
“name”: “release stlink F407”,
“request”: “launch”,
“type”: “cortex-debug”,
“servertype”: “stlink”,
“runToEntryPoint”: “main”,
“v1”: false
},
{
“cwd”: “${workspaceRoot}”,
“executable”: “cmake_build/STM32F407VE_BLACK/debug/GCC_ARM/${workspaceFolderBasename}.elf”,
“name”: “debug stlink F407”,
“request”: “launch”,
“type”: “cortex-debug”,
“servertype”: “stlink”,
“runToEntryPoint”: “main”,
“v1”: false
},
{
“cwd”: “${workspaceRoot}”,
“executable”: “cmake_build/STM32F407VE_BLACK/develop/GCC_ARM/${workspaceFolderBasename}.elf”,
“name”: “develop stlink F407”,
“request”: “launch”,
“type”: “cortex-debug”,
“servertype”: “stlink”,
“v1”: false
},
{
“cwd”: “${workspaceRoot}”,
“executable”: “…/…/BUILD/${workspaceFolderBasename}/DEBUG/${workspaceFolderBasename}.elf”,
“name”: “debug OpenOCD F4 STLink-2.0”,
“request”: “launch”,
“type”: “cortex-debug”,
“servertype”: “openocd”,
“configFiles”: [
“…/scripts/interface/stlink-v2.cfg”,
“…/scripts/target/stm32f4x.cfg”
]
},
{
“name”: “debug OpenOCD F4 STLink-2.1”,
“type”: “cortex-debug”,
“request”: “launch”,
“servertype”: “openocd”,
“executable”: “…/…/BUILD/${workspaceFolderBasename}/DEBUG/${workspaceFolderBasename}.elf”,
“configFiles”: [
“…/scripts/interface/stlink-v2-1.cfg”,
“…/scripts/target/stm32f4x_stlink.cfg”
]
},
{
“cwd”: “${workspaceRoot}”,
“name”: “debug COM12”,
“BMPGDBSerialPort”: “//./COM12”,
“interface”: “swd”,
“type”: “cortex-debug”,
“request”: “launch”,
“servertype”: “bmp”,
“device”: “STM32F407VE”,
“executable”: “…/…/BUILD/${workspaceFolderBasename}/DEBUG/${workspaceFolderBasename}.elf”
},
{
“cwd”: “${workspaceRoot}”,
“name”: “release COM12”,
“BMPGDBSerialPort”: “//./COM12”,
“interface”: “swd”,
“type”: “cortex-debug”,
“request”: “launch”,
“servertype”: “bmp”,
“device”: “STM32F407VE”,
“executable”: “…/…/BUILD/${workspaceFolderBasename}/Release/${workspaceFolderBasename}.elf”
},
{
“cwd”: “${workspaceRoot}”,
“name”: “develop COM12”,
“BMPGDBSerialPort”: “//./COM12”,
“interface”: “swd”,
“type”: “cortex-debug”,
“request”: “launch”,
“servertype”: “bmp”,
“device”: “STM32F407VE”,
“executable”: “…/…/BUILD/${workspaceFolderBasename}/Develop/${workspaceFolderBasename}.elf”
},
{
“cwd”: “${workspaceRoot}”,
“name”: “release COM5”,
“BMPGDBSerialPort”: “//./COM5”,
“interface”: “swd”,
“type”: “cortex-debug”,
“request”: “launch”,
“servertype”: “bmp”,
“executable”: “…/…/BUILD/${workspaceFolderBasename}/Release/${workspaceFolderBasename}.elf”
},
{
“cwd”: “${workspaceRoot}”,
“name”: “develop COM5”,
“BMPGDBSerialPort”: “//./COM5”,
“interface”: “swd”,
“type”: “cortex-debug”,
“request”: “launch”,
“servertype”: “bmp”,
“executable”: “…/…/BUILD/${workspaceFolderBasename}/Develop/${workspaceFolderBasename}.elf”
},
{
“cwd”: “${workspaceRoot}”,
“name”: “debug COM5”,
“BMPGDBSerialPort”: “//./COM5”,
“interface”: “swd”,
“type”: “cortex-debug”,
“request”: “launch”,
“servertype”: “bmp”,
“executable”: “…/…/BUILD/${workspaceFolderBasename}/Debug/${workspaceFolderBasename}.elf”
},
{
“cwd”: “${workspaceRoot}”,
“name”: “develop COM4”,
“BMPGDBSerialPort”: “//./COM4”,
“interface”: “swd”,
“type”: “cortex-debug”,
“request”: “launch”,
“servertype”: “bmp”,
“executable”: “cmake_build/STM32F407VE_BLACK/develop/GCC_ARM/${workspaceFolderBasename}.elf”
},
{
“cwd”: “${workspaceRoot}”,
“name”: “debug COM4”,
“BMPGDBSerialPort”: “//./COM4”,
“interface”: “swd”,
“type”: “cortex-debug”,
“request”: “launch”,
“servertype”: “bmp”,
“executable”: “cmake_build/STM32F407VE_BLACK/debug/GCC_ARM/${workspaceFolderBasename}.elf”
},
{
“cwd”: “${workspaceRoot}”,
“name”: “release COM4”,
“BMPGDBSerialPort”: “//./COM4”,
“interface”: “swd”,
“type”: “cortex-debug”,
“request”: “launch”,
“servertype”: “bmp”,
“executable”: “cmake_build/STM32F407VE_BLACK/release/GCC_ARM/${workspaceFolderBasename}.elf”
}
]
}

Looking at the repo right now, I think we should institute a few repo conventions to keep things clean:

  • PRs should rebase on master
  • PRs should be squashed before rebasing
  • mbed-ce/mbed-os/master should rebase on upstream’s master

Rebasing on upstream will let us easily bring in the small bug-fixes that are still happening on upstream, and it shoudn’t get too complicated unless upstream starts getting large feature additions that Mbed-CE does not want (which I think will be pretty unlikely).

Unless anyone objects in the near future, I think @MultipleMonomials and I will get mbed-ce rebased on upstream and implement the new repo rules.

Let me know if this sounds right to you, @MultipleMonomials!

3 Likes

And hey, one of the fun things about it being a community project is that we can add in boards that ARM doesn’t seem interested in supporting. Tonight I was able to get a proof-of-concept Mbed build running on the Arduino Nano 33 BLE:
image
This includes having the stdio console auto-redirected to the USB serial port, and uploading using the native Arduino bootloader (no external debug probe required). With some more work, I’m pretty sure I can add it as a natively supported target, so that people can build for it using pure Mbed without the Arduino IDE.

I will say, I don’t want to get too ahead of ourselves adding boards – especially for boards not supported by Mbed 6, we should set up CI infrastructure to run tests on them before declaring them properly supported. Still, it’s an interesting experiment!

2 Likes

yesterday, I downloaded all the tools (cmake, ninja, python) through Msys2, so there are a lot of error.
Today, all the tools were download through the offical websites.
At last, it works now.
My board is Nucleo-F070RB now,can you help to add it in mbed-ce supported lists.

Can you DM me with the full output of running cmake?

Nice! This could be handy, because in the past there were several people who were interested (usually about Portenta H7 and Arduino Nano 33 BLE) how use MbedOS directly without Arduino IDE.

BR, Jan

Today I have tried RP2040 with PlattformIO. You can mix Arduino and Mbed API and VSCode is better than the crippled Arduino IDE. But there are only a few targets where this magic works.
The Mbed branch for RP2040 has never merged?

Yeah, never - RASPBERRYPI: Add support for RP2040 MCU by facchinm · Pull Request #14488 · ARMmbed/mbed-os · GitHub
And probably it is not necessary for usage - ArduinoCore-mbed/variants/RASPBERRY_PI_PICO at master · arduino/ArduinoCore-mbed (github.com)

BR, Jan

Yes, strange. So there is already a lot working with Mbed and it should be possible to add this target to Mbed CE.

It is also important that custom targets can be easily added. Dev boards are one thing, but for real products you will have special hardware.

Interesting. Yes, I’d definitely be willing to merge that MR. Does one of you guys want to make an MR against mbed-ce? Also, does anyone have an RP2040 board they can use to test the changes on?

I have ordered two pieces yesterday, it is very very cheap board - 5$ each.
How the package arrive I can try to do something.

BR, Jan

1 Like

Custom target support is something I still need to work on. Currently, custom targets without their own source files (as in, they only have a custom_targets.json and nothing else) work fine – USC RPL already uses these with Mbed CE. But I need to nail down a procedure for custom targets that include their own source files. In particular, I need to create a way for them to override source files built in to Mbed (like you used to be able to do with Mbed CLI 1) in a sane way.

To track this, created: Create guide + API for custom targets with source files · Issue #48 · mbed-ce/mbed-os · GitHub

Created two new doc pages for you guys to reference:

These show how to run and debug the Mbed OS tests on a local machine with your own hardware. Feel free to try out any boards you have lying around and post the results!