Fork of the GitHub

Committer:
DiegoOstuni
Date:
Thu Nov 14 11:17:28 2019 +0000
Revision:
0:57b2ec89b3bc
TEST

Who changed what in which revision?

UserRevisionLine numberNew contents of line
DiegoOstuni 0:57b2ec89b3bc 1 ![](./resources/official_armmbed_example_badge.png)
DiegoOstuni 0:57b2ec89b3bc 2 # Blinky Mbed OS example
DiegoOstuni 0:57b2ec89b3bc 3
DiegoOstuni 0:57b2ec89b3bc 4 The example project is part of the [Arm Mbed OS Official Examples](https://os.mbed.com/code/) and is the [getting started example for Mbed OS](https://os.mbed.com/docs/mbed-os/v5.14/quick-start/index.html). It contains an application that repeatedly blinks an LED on supported [Mbed boards](https://os.mbed.com/platforms/).
DiegoOstuni 0:57b2ec89b3bc 5
DiegoOstuni 0:57b2ec89b3bc 6 You can build the project with all supported [Mbed OS build tools](https://os.mbed.com/docs/mbed-os/latest/tools/index.html). However, this example project specifically refers to the command-line interface tool [Arm Mbed CLI](https://github.com/ARMmbed/mbed-cli#installing-mbed-cli).
DiegoOstuni 0:57b2ec89b3bc 7 (Note: To see a rendered example you can import into the Arm Online Compiler, please see our [import quick start](https://os.mbed.com/docs/mbed-os/latest/quick-start/online-with-the-online-compiler.html#importing-the-code).)
DiegoOstuni 0:57b2ec89b3bc 8
DiegoOstuni 0:57b2ec89b3bc 9 1. [Install Mbed CLI](https://os.mbed.com/docs/mbed-os/latest/quick-start/offline-with-mbed-cli.html).
DiegoOstuni 0:57b2ec89b3bc 10
DiegoOstuni 0:57b2ec89b3bc 11 1. Clone this repository on your system, and change the current directory to where the project was cloned:
DiegoOstuni 0:57b2ec89b3bc 12
DiegoOstuni 0:57b2ec89b3bc 13 ```bash
DiegoOstuni 0:57b2ec89b3bc 14 $ git clone git@github.com:armmbed/mbed-os-example-blinky && cd mbed-os-example-blinky
DiegoOstuni 0:57b2ec89b3bc 15 ```
DiegoOstuni 0:57b2ec89b3bc 16
DiegoOstuni 0:57b2ec89b3bc 17 Alternatively, you can download the example project with Arm Mbed CLI using the `import` subcommand:
DiegoOstuni 0:57b2ec89b3bc 18
DiegoOstuni 0:57b2ec89b3bc 19 ```bash
DiegoOstuni 0:57b2ec89b3bc 20 $ mbed import mbed-os-example-blinky && cd mbed-os-example-blinky
DiegoOstuni 0:57b2ec89b3bc 21 ```
DiegoOstuni 0:57b2ec89b3bc 22
DiegoOstuni 0:57b2ec89b3bc 23
DiegoOstuni 0:57b2ec89b3bc 24 ## Application functionality
DiegoOstuni 0:57b2ec89b3bc 25
DiegoOstuni 0:57b2ec89b3bc 26 The `main()` function is the single thread in the application. It toggles the state of a digital output connected to an LED on the board.
DiegoOstuni 0:57b2ec89b3bc 27
DiegoOstuni 0:57b2ec89b3bc 28 ## Building and running
DiegoOstuni 0:57b2ec89b3bc 29
DiegoOstuni 0:57b2ec89b3bc 30 1. Connect a USB cable between the USB port on the board and the host computer.
DiegoOstuni 0:57b2ec89b3bc 31 2. <a name="build_cmd"></a> Run the following command to build the example project and program the microcontroller flash memory:
DiegoOstuni 0:57b2ec89b3bc 32 ```bash
DiegoOstuni 0:57b2ec89b3bc 33 $ mbed compile -m <TARGET> -t <TOOLCHAIN> --flash
DiegoOstuni 0:57b2ec89b3bc 34 ```
DiegoOstuni 0:57b2ec89b3bc 35 The binary is located at `./BUILD/<TARGET>/<TOOLCHAIN>/mbed-os-example-blinky.bin`.
DiegoOstuni 0:57b2ec89b3bc 36
DiegoOstuni 0:57b2ec89b3bc 37 Alternatively, you can manually copy the binary to the board, which you mount on the host computer over USB.
DiegoOstuni 0:57b2ec89b3bc 38
DiegoOstuni 0:57b2ec89b3bc 39 Depending on the target, you can build the example project with the `GCC_ARM`, `ARM` or `IAR` toolchain. After installing Arm Mbed CLI, run the command below to determine which toolchain supports your target:
DiegoOstuni 0:57b2ec89b3bc 40
DiegoOstuni 0:57b2ec89b3bc 41 ```bash
DiegoOstuni 0:57b2ec89b3bc 42 $ mbed compile -S
DiegoOstuni 0:57b2ec89b3bc 43 ```
DiegoOstuni 0:57b2ec89b3bc 44
DiegoOstuni 0:57b2ec89b3bc 45 ## Expected output
DiegoOstuni 0:57b2ec89b3bc 46 The LED on your target turns on and off every 500 milliseconds.
DiegoOstuni 0:57b2ec89b3bc 47
DiegoOstuni 0:57b2ec89b3bc 48
DiegoOstuni 0:57b2ec89b3bc 49 ## Troubleshooting
DiegoOstuni 0:57b2ec89b3bc 50 If you have problems, you can review the [documentation](https://os.mbed.com/docs/latest/tutorials/debugging.html) for suggestions on what could be wrong and how to fix it.
DiegoOstuni 0:57b2ec89b3bc 51
DiegoOstuni 0:57b2ec89b3bc 52 ## Related Links
DiegoOstuni 0:57b2ec89b3bc 53
DiegoOstuni 0:57b2ec89b3bc 54 * [Mbed OS Stats API](https://os.mbed.com/docs/latest/apis/mbed-statistics.html).
DiegoOstuni 0:57b2ec89b3bc 55 * [Mbed OS Configuration](https://os.mbed.com/docs/latest/reference/configuration.html).
DiegoOstuni 0:57b2ec89b3bc 56 * [Mbed OS Serial Communication](https://os.mbed.com/docs/latest/tutorials/serial-communication.html).
DiegoOstuni 0:57b2ec89b3bc 57 * [Mbed OS bare metal](https://os.mbed.com/docs/mbed-os/latest/reference/mbed-os-bare-metal.html).
DiegoOstuni 0:57b2ec89b3bc 58 * [Mbed boards](https://os.mbed.com/platforms/).
DiegoOstuni 0:57b2ec89b3bc 59
DiegoOstuni 0:57b2ec89b3bc 60 ### License and contributions
DiegoOstuni 0:57b2ec89b3bc 61
DiegoOstuni 0:57b2ec89b3bc 62 The software is provided under Apache-2.0 license. Contributions to this project are accepted under the same license. Please see contributing.md for more info.
DiegoOstuni 0:57b2ec89b3bc 63
DiegoOstuni 0:57b2ec89b3bc 64 This project contains code from other projects. The original license text is included in those source files. They must comply with our license guide.