Compiling the code
-
Get the code
After the installation of Mbed CLI is complete, import the example by opening a command-line shell and entering:
$ mbed import https://github.com/ARMmbed/mbed-os-example-blinky $ cd mbed-os-example-blinky
-
Compile and program your board:
Invoke
mbed compile
, and specify the name of your platform and your installed toolchain (GCC_ARM
,ARM
,IAR
). For example, for the K64F platform and Arm Compiler 5 toolchain:$ mbed compile --target K64F --toolchain ARM --flash
The
--flash
argument automatically flashes the compiled program onto your board if it is connected to your computer.Tip: You can get the name of the board plugged into your computer by running
mbed detect
, and you can get a full list of supported toolchains and targets by running thembed compile --supported
command.Note: To build with the Mbed OS bare metal profile, add
"requires": ["bare-metal"]
to thembed_app.json
file:{ "requires": ["bare-metal"], "target_overrides": { "*": {
-
Press the board's reset button. The LED blinks.