Skip to content
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

Document how to use custom mbed-os version in platformio #214

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
86 changes: 86 additions & 0 deletions frameworks/mbed_extra.rst
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,92 @@ An example of :ref:`projectconf` with enabled ``rtos``
build_flags = -D PIO_FRAMEWORK_MBED_RTOS_PRESENT


Custom version of Mbed
^^^^^^^^^^^^^^^^^^^^^^

PlatformIO only has certain versions of mbed-os in the official package package
registry, as queryable through `the API
<https://api.registry.platformio.org/v3/packages/platformio/tool/framework-mbed>`_.

If you want to use another release of the Mbed framework, you can use the
`plateform_packages` config option as described below.

.. warning::

Using a custom version of mbed-os is not officially supported by platformio. There is
no guarantee a given version of mbed-os will work with platformio. This is
recommended for Advanced Users only and may require knowledge of the Python ecosystem
to install missing dependencies etc.


The `platformio.ini` file should have a `plateform_packages` config entry which
references a directory containing `mbed-os <https://github.com/ARMmbed/mbed-os>`_
itself, plus the platformio `mbed builder code
<https://github.com/platformio/builder-framework-mbed>`_ and a `package.json` file like:

.. code-block:: json

{
"name": "framework-mbed",
"version": "6.61500.211003",
"description": "Arm Mbed OS is a platform operating system designed for the internet of things",
"keywords": [
"framework",
"os",
"arm",
"hal"
],
"homepage": "http://mbed.org",
"repository": {
"type": "git",
"url": "https://github.com/ARMmbed/mbed-os"
}
}

For example, to use the version 6.15 of mbed-os, you may:

.. code-block:: bash

~$ git clone https://github.com/ARMmbed/mbed-os framework-mbed
~$ cd framework-mbed
~/framework-mbed$ git checkout mbed-os-6.15.0
~/framework-mbed$ git clone https://github.com/platformio/builder-framework-mbed# platformio
~/framework-mbed$ cat >package.json <<EOF
{
"name": "framework-mbed",
"version": "6.61500.211003",
"description": "Arm Mbed OS is a platform operating system designed for the internet of things",
"keywords": [
"framework",
"os",
"arm",
"hal"
],
"homepage": "http://mbed.org",
"repository": {
"type": "git",
"url": "https://github.com/ARMmbed/mbed-os"
}
}
EOF

Then add the `platform_packages
<https://docs.platformio.org/en/latest/projectconf/section_env_platform.html#platform-packages>`_
config optin in the `platformio.ini` file like:

.. code-block:: ini

[env:mproject]
platform = ststm32
framework = mbed
platform_packages =
framework-mbed @ file://framework-mbed
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. configuration is missing board = ... line to make it complete, does not mention to add it
  2. Maybe general link to https://docs.platformio.org/en/latest/projectconf/section_env_platform.html#platform-packages would be good

board = nucleo_f303ze

to build the project for a NUCLEO-F303ZE board using mbed-os 6.15.0 (and make the
USBDevice work).


Build profiles
~~~~~~~~~~~~~~

Expand Down