Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork213
arduino/ArduinoCore-mbed
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
The repository contains the Arduino APIs and IDE integration files targeting a generic mbed-enabled board
Question: "I want to debug my ArduinoCore-mbed based sketch using traditional debugging tools, i.e. gdb via SWD interface. However, the debugger is unable to locate the sources for all files, particular the mbed-os files."
Answer: This is due to the fact that we pre-compile the mbed-os code into a static librarylibmbed.a
. Information on how to recompilelibmbed.a
for source code debugging can be foundhere. TheArduino Documentation also contains articles explaining how to debug viaSegger J-Link andLauterbach TRACE32.
Note:
mkdir -p$sketchbook/hardware/arduino-gitcd$sketchbook/hardware/arduino-gitgit clone git@github.com:arduino/ArduinoCore-mbed mbed
Clonehttps://github.com/arduino/ArduinoCore-API into a directory of your choice.
git clone git@github.com:arduino/ArduinoCore-API
Create a symlink toArduinoCore-API/api
in$sketchbook/hardware/arduino-git/mbed/cores/arduino
.
Open the Arduino IDE.
You should now see three new targets under theMBED boards
label.
This procedure does not automatically install the required ARM compiler toolchain.
If the toolchain is missing, you'll see errors like this when you try to build for an mbed-os enabled board.:
fork/exec /bin/arm-none-eabi-g++: no such file or directory
To install ARM build tools, use theBoards Manager
option in the Arduino IDE to add theArduino mbed-enabled Boards
package.
The backbone of the packaging process is thehttps://github.com/arduino/ArduinoCore-mbed/blob/master/mbed-os-to-arduino script. It basically compiles a blank Mbed OS project for any supported target board, recovering the files that will be needed at compile time and copying them to the right location. This script is compatible only with Linux. If you are using macOS, use thehttps://github.com/arduino/ArduinoCore-mbed/blob/master/mbed-os-to-arduino-macos script.
It can be used for a variety of tasks including:
cd $sketchbook/hardware/arduino-git/mbed./mbed-os-to-arduino -a -g PORTENTA_H7_M7:PORTENTA_H7_M7
In this case-a
applies all the patches frompatches
folder into a mainlinembed-os
tree, and-g
restores the debug info.
cd $sketchbook/hardware/arduino-git/mbedPROFILE=release ./mbed-os-to-arduino -a NANO_RP2040_CONNECT:NANO_RP2040_CONNECT
ThePROFILE
environment variable tunes the compilation profiles (defaults toDEVELOP
). Other available profiles areDEBUG
andRELEASE
.
cd $sketchbook/hardware/arduino-git/mbed./mbed-os-to-arduino -r /path/to/my/mbed-os-fork NICLA_VISION:NICLA_VISION
-r
flag allows using a custommbed-os
fork in place of the mainline one; useful during new target development.
Adding a new target (core variant)
Adding a target is a mostly automatic procedure.
For boards already supported by Mbed OS, the bare minimum is:
cd $sketchbook/hardware/arduino-git/mbedmkdir -p variants/$ALREADY_SUPPORTED_BOARD_NAME/{libs,conf}./mbed-os-to-arduino $ALREADY_SUPPORTED_BOARD_NAME:$ALREADY_SUPPORTED_BOARD_NAME# for example, to create a core for LPC546XX# mkdir -p variants/LPC546XX/{libs,conf}# ./mbed-os-to-arduino LPC546XX:LPC546XX
This will produce almost all the files needed. To complete the port, add the board specifications toboards.txt
(giving it a unique ID) and providepins_arduino.h
andvariants.cpp
invariants/$ALREADY_SUPPORTED_BOARD_NAME
folder.Feel free to take inspirations from the existing variants :)
For boards not supported by mainline Mbed OS, the same applies but you should provide the path of your Mbed OS fork
cd $sketchbook/hardware/arduino-git/mbedmkdir -p variants/$BRAND_NEW_BOARD_NAME/{libs,conf}./mbed-os-to-arduino -r /path/to/mbed-os/fork/that/supports/new/board $BRAND_NEW_BOARD_NAME:$BRAND_NEW_BOARD_NAME
Most Mbed OS defines can be tuned using a project file calledmbed_app.json
. In case you need to tune a build you can add that file to your variant'sconf
folder. One example ishttps://github.com/arduino/ArduinoCore-mbed/blob/master/variants/PORTENTA_H7_M7/conf/mbed_app.json .Providing an invalid json or replacing a non-existing property will make the build fail silently, so it's always better to validate that file with a standard Mbed OS project.
You can use this core as a standard mbed library; all APIs are underarduino
namespace (so they must be called likearduino::digitalWrite()
)
The opposite is working as well; from any sketch you can call mbed APIs by prependingmbed::
namespace.
About
Resources
Security policy
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.
Packages0
Uh oh!
There was an error while loading.Please reload this page.