Skip to content

Commit 0376a40

Browse files
committed
Document how to use custom mbed-os version in platformio
1 parent c9c5b9c commit 0376a40

File tree

1 file changed

+86
-0
lines changed

1 file changed

+86
-0
lines changed

frameworks/mbed_extra.rst

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,92 @@ An example of :ref:`projectconf` with enabled ``rtos``
101101
build_flags = -D PIO_FRAMEWORK_MBED_RTOS_PRESENT
102102
103103
104+
Custom version of Mbed
105+
^^^^^^^^^^^^^^^^^^^^^^
106+
107+
PlatformIO only has certain versions of mbed-os in the official package package
108+
registry, as queryable through `the API
109+
<https://api.registry.platformio.org/v3/packages/platformio/tool/framework-mbed>`_.
110+
111+
If you want to use another release of the Mbed framework, you can use the
112+
`plateform_packages` config option as described below.
113+
114+
.. warning::
115+
116+
Using a custom version of mbed-os is not officially supported by platformio. There is
117+
no guarantee a given version of mbed-os will work with platformio. This is
118+
recommended for Advanced Users only and may require knowledge of the Python ecosystem
119+
to install missing dependencies etc.
120+
121+
122+
The `platformio.ini` file should have a `plateform_packages` config entry which
123+
references a directory containing `mbed-os <https://github.com/ARMmbed/mbed-os>`_
124+
itself, plus the platformio `mbed builder code
125+
<https://github.com/platformio/builder-framework-mbed>`_ and a `package.json` file like:
126+
127+
.. code-block:: json
128+
129+
{
130+
"name": "framework-mbed",
131+
"version": "6.61500.211003",
132+
"description": "Arm Mbed OS is a platform operating system designed for the internet of things",
133+
"keywords": [
134+
"framework",
135+
"os",
136+
"arm",
137+
"hal"
138+
],
139+
"homepage": "http://mbed.org",
140+
"repository": {
141+
"type": "git",
142+
"url": "https://github.com/ARMmbed/mbed-os"
143+
}
144+
}
145+
146+
For example, to use the version 6.15 of mbed-os, you may:
147+
148+
.. code-block:: bash
149+
150+
~$ git clone https://github.com/ARMmbed/mbed-os framework-mbed
151+
~$ cd framework-mbed
152+
~/framework-mbed$ git checkout mbed-os-6.15.0
153+
~/framework-mbed$ git clone https://github.com/platformio/builder-framework-mbed# platformio
154+
~/framework-mbed$ cat >package.json <<EOF
155+
{
156+
"name": "framework-mbed",
157+
"version": "6.61500.211003",
158+
"description": "Arm Mbed OS is a platform operating system designed for the internet of things",
159+
"keywords": [
160+
"framework",
161+
"os",
162+
"arm",
163+
"hal"
164+
],
165+
"homepage": "http://mbed.org",
166+
"repository": {
167+
"type": "git",
168+
"url": "https://github.com/ARMmbed/mbed-os"
169+
}
170+
}
171+
EOF
172+
173+
Then add the `platform_packages
174+
<https://docs.platformio.org/en/latest/projectconf/section_env_platform.html#platform-packages>`_
175+
config optin in the `platformio.ini` file like:
176+
177+
.. code-block:: ini
178+
179+
[env:mproject]
180+
platform = ststm32
181+
framework = mbed
182+
platform_packages =
183+
framework-mbed @ file://framework-mbed
184+
board = nucleo_f303ze
185+
186+
to build the project for a NUCLEO-F303ZE board using mbed-os 6.15.0 (and make the
187+
USBDevice work).
188+
189+
104190
Build profiles
105191
~~~~~~~~~~~~~~
106192

0 commit comments

Comments
 (0)