Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
- "examples/picosdk-blink"
- "examples/picosdk-pioasm-blink"
- "examples/picosdk-pioasm-blink-auto"
- "examples/mbed-ce-hello-world"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
Expand Down
3 changes: 2 additions & 1 deletion boards/rpipico.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
},
"frameworks": [
"arduino",
"picosdk"
"picosdk",
"mbed-ce"
],
"name": "Pico",
"upload": {
Expand Down
26 changes: 26 additions & 0 deletions builder/frameworks/mbed-ce.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright 2014-present PlatformIO <contact@platformio.org>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
Mbed OS Community Edition
https://mbed-ce.dev/
"""

from os.path import join

from SCons.Script import Import, SConscript

Import("env")

SConscript(
join(env.PioPlatform().get_package_dir("framework-mbed-ce"), "tools", "python", "mbed_platformio", "build_mbed_ce.py"))
1 change: 1 addition & 0 deletions examples/mbed-ce-hello-world/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.pio
15 changes: 15 additions & 0 deletions examples/mbed-ce-hello-world/mbed_app.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

{
"target_overrides": {
"*": {
"platform.stdio-baud-rate": 9600,
"platform.stdio-buffered-serial": 1,

// Uncomment to use mbed-baremetal instead of mbed-os
// "target.application-profile": "bare-metal"
}
},
"link_libraries": [
"mbed-storage-sd"
]
}
16 changes: 16 additions & 0 deletions examples/mbed-ce-hello-world/platformio.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[env]
Comment thread
maxgerhardt marked this conversation as resolved.
platform = raspberrypi
framework = mbed-ce

[env:rpipico]
board = rpipico
14 changes: 14 additions & 0 deletions examples/mbed-ce-hello-world/src/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include "mbed.h"

int main()
{
while(true)
{
printf("Hello world from Mbed CE!\n");
ThisThread::sleep_for(1s);
}

// main() is expected to loop forever.
// If main() actually returns the processor will halt
return 0;
}
23 changes: 23 additions & 0 deletions platform.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@
"picosdk": {
"package": "framework-picosdk",
"script": "builder/frameworks/picosdk.py"
},
"mbed-ce": {
"package": "framework-mbed-ce",
"script": "builder/frameworks/mbed-ce.py",
"description": "Community edition of Mbed OS, an open-source operating system designed for the Internet of Things.",
"homepage": "https://mbed-ce.dev",
"title": "Mbed CE"
}
},
"packages": {
Expand Down Expand Up @@ -65,6 +72,12 @@
"owner": "platformio",
"version": "https://github.com/maxgerhardt/pico-sdk.git#4315984000afe20ac82c78c597a3c4a591f524b0"
},
"framework-mbed-ce": {
"type": "framework",
"optional": true,
"owner": "mbed-ce-project",
"version": ">=6.99.4"
},
"tool-picotool-rp2040-earlephilhower": {
"type": "uploader",
"optional": false,
Expand Down Expand Up @@ -94,6 +107,16 @@
"optional": true,
"owner": "earlephilhower",
"version": "~5.100300.0"
},
"tool-ninja": {
"optional": true,
"owner": "platformio",
"version": ">=1.7.0"
},
"tool-cmake": {
"optional": true,
"owner": "platformio",
"version": ">=3.21.0"
}
}
}
8 changes: 8 additions & 0 deletions platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,14 @@ def configure_default_packages(self, variables, targets):
sys.stderr.write(
"Error! Unknown build.core value '%s'. Don't know which Arduino core package to use." % build_core)
sys.exit(-1)
elif "mbed-ce" in frameworks:
# Mbed CE only supports ARM cores and needs CMake and Ninja.
# Note: Currently unable to link via the earlephilhower toolchain as that seems to have retargetable locking
# turned on in Newlib, which Mbed does not currently support.
self.packages["toolchain-rp2040-earlephilhower"]["optional"] = True
self.packages.pop("toolchain-rp2040-earlephilhower", None)
self.packages["tool-cmake"]["optional"] = False
self.packages["tool-ninja"]["optional"] = False
else:
# this is a pico-sdk or baremetal project. if it's for a rp2350-riscv, we need the RISC-V toolchain.
if chip == "rp2350-riscv":
Expand Down
Loading