ARM Mbed: Difference between revisions
No edit summary |
|||
Line 36: | Line 36: | ||
mbed detect | mbed detect | ||
</pre> | </pre> | ||
which prints device information and whether MbedOS is supported: | |||
<br /> | |||
<br /> | |||
Also use ''mbed'' to build the project and (optionally) immediately flash to the device: | |||
<pre class="terminal"> | |||
mbed toolchain GCC_ARM | |||
mbed compile --clean --flash | |||
</pre> | |||
<br /> | |||
The ''compile'' step may require an older version of the GNU Arm Embedded Toolchain. You can download older versions from the same [https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads download page] as the latest version. | |||
<br /> | <br /> | ||
<pre class="terminal"> | <pre class="terminal"> | ||
[mbed] Detected NUCLEO_F411RE, port /dev/ttyACM1, mounted /media/kai/NODE_F411RE, interface version 0221: | [mbed] Detected NUCLEO_F411RE, port /dev/ttyACM1, mounted /media/kai/NODE_F411RE, interface version 0221: |
Revision as of 2019-07-23T23:38:21
Introduction
Mbed (official website) is a collection of APIs which simplify software development for microcontrollers with ARM Cortex kernel. Mbed is maintained by ARM, in cooperation with their partners.
Mbed OS
Mbed OS is a real-time operating system that comes with the Mbed APIs.
Web IDE
The web IDE is the most convenient of getting started with the Mbed API and Mbed OS. You can generate a blank Mbed project or a project based on one of the many example projects. You can build the project on the Web IDE and download the resulting binary. You can also download the complete source package as an archive file (ZIP file) with project file stubs for the popular embedded software development environments.
Command Line Tools
Mbed CLI is a collection of command line tools for generating Mbed project stubs in the same way that the Web IDE does. With the command line tools you can create a script that fetches the Mbed OS part and places it in a shared location, then create project stubs with the sources relevant to a specific application.
To install the tools on Ubuntu Linux type
sudo apt install git mercurial sudo pip3 install mbed-cli mbed config -G GCC_ARM_PATH <toolchain path>/bin
where <toolchain path> is the installation path of the GNU Arm Embedded Toolchain for Cortex M architecture.
Use the CLI tool mbed to generate project skeleton files:
mbed import mbed-os-latest # fetches the latest Mbed OS from GitHub mbed config -G MBED_OS_DIR ./mbed-os-latest # makes projects use the downloaded Mbed OS source mbed new --scm git mbed-test # generates new project files with a Git repository cd mbed-test # next commands require that the current working directory is the project root mbed target NUCLEO_F303K8 # sets the target device (the Nucleo-32 board STM32F303K8T6)
where the name of the target device can be determined by connecting the target board with your Ubuntu computer and typing
mbed detect
which prints device information and whether MbedOS is supported:
Also use mbed to build the project and (optionally) immediately flash to the device:
mbed toolchain GCC_ARM mbed compile --clean --flash
The compile step may require an older version of the GNU Arm Embedded Toolchain. You can download older versions from the same download page as the latest version.
[mbed] Detected NUCLEO_F411RE, port /dev/ttyACM1, mounted /media/kai/NODE_F411RE, interface version 0221: [mbed] Supported toolchains for NUCLEO_F411RE | Target | mbed OS 2 | mbed OS 5 | ARM | uARM | GCC_ARM | IAR | ARMC5 | |---------------|-----------|-----------|-----------|-----------|-----------|-----------|-------| | NUCLEO_F411RE | Supported | Supported | Supported | Supported | Supported | Supported | - | Supported targets: 1 Supported toolchains: 4 [mbed] Detected NUCLEO_F303K8, port /dev/ttyACM0, mounted /media/kai/NODE_F303K8, interface version 0221: [mbed] Supported toolchains for NUCLEO_F303K8 | Target | mbed OS 2 | mbed OS 5 | ARM | uARM | GCC_ARM | IAR | ARMC5 | |--------|-----------|-----------|-----|------|---------|-----|-------| Supported targets: 0
Note that even Mbed OS 2 is not supported on the STM32F303 Nucleo board because of the Python 3 environment instead of Python 2.