Isidora Milivojević
/
19E042PIM_T2_2020_0214
Isidora Milivojevic 2020/0214
README.md@0:114829cedd35, 2021-11-13 (annotated)
- Committer:
- soconstruct
- Date:
- Sat Nov 13 09:17:07 2021 +0000
- Revision:
- 0:114829cedd35
Isidora Milivojevic 2020/0214
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
soconstruct | 0:114829cedd35 | 1 | ![](./resources/official_armmbed_example_badge.png) |
soconstruct | 0:114829cedd35 | 2 | # Blinky Mbed OS example |
soconstruct | 0:114829cedd35 | 3 | |
soconstruct | 0:114829cedd35 | 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/). |
soconstruct | 0:114829cedd35 | 5 | |
soconstruct | 0:114829cedd35 | 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). |
soconstruct | 0:114829cedd35 | 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).) |
soconstruct | 0:114829cedd35 | 8 | |
soconstruct | 0:114829cedd35 | 9 | 1. [Install Mbed CLI](https://os.mbed.com/docs/mbed-os/latest/quick-start/offline-with-mbed-cli.html). |
soconstruct | 0:114829cedd35 | 10 | |
soconstruct | 0:114829cedd35 | 11 | 1. Clone this repository on your system, and change the current directory to where the project was cloned: |
soconstruct | 0:114829cedd35 | 12 | |
soconstruct | 0:114829cedd35 | 13 | ```bash |
soconstruct | 0:114829cedd35 | 14 | $ git clone git@github.com:armmbed/mbed-os-example-blinky && cd mbed-os-example-blinky |
soconstruct | 0:114829cedd35 | 15 | ``` |
soconstruct | 0:114829cedd35 | 16 | |
soconstruct | 0:114829cedd35 | 17 | Alternatively, you can download the example project with Arm Mbed CLI using the `import` subcommand: |
soconstruct | 0:114829cedd35 | 18 | |
soconstruct | 0:114829cedd35 | 19 | ```bash |
soconstruct | 0:114829cedd35 | 20 | $ mbed import mbed-os-example-blinky && cd mbed-os-example-blinky |
soconstruct | 0:114829cedd35 | 21 | ``` |
soconstruct | 0:114829cedd35 | 22 | |
soconstruct | 0:114829cedd35 | 23 | |
soconstruct | 0:114829cedd35 | 24 | ## Application functionality |
soconstruct | 0:114829cedd35 | 25 | |
soconstruct | 0:114829cedd35 | 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. |
soconstruct | 0:114829cedd35 | 27 | |
soconstruct | 0:114829cedd35 | 28 | ## Building and running |
soconstruct | 0:114829cedd35 | 29 | |
soconstruct | 0:114829cedd35 | 30 | 1. Connect a USB cable between the USB port on the board and the host computer. |
soconstruct | 0:114829cedd35 | 31 | 2. <a name="build_cmd"></a> Run the following command to build the example project and program the microcontroller flash memory: |
soconstruct | 0:114829cedd35 | 32 | ```bash |
soconstruct | 0:114829cedd35 | 33 | $ mbed compile -m <TARGET> -t <TOOLCHAIN> --flash |
soconstruct | 0:114829cedd35 | 34 | ``` |
soconstruct | 0:114829cedd35 | 35 | The binary is located at `./BUILD/<TARGET>/<TOOLCHAIN>/mbed-os-example-blinky.bin`. |
soconstruct | 0:114829cedd35 | 36 | |
soconstruct | 0:114829cedd35 | 37 | Alternatively, you can manually copy the binary to the board, which you mount on the host computer over USB. |
soconstruct | 0:114829cedd35 | 38 | |
soconstruct | 0:114829cedd35 | 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: |
soconstruct | 0:114829cedd35 | 40 | |
soconstruct | 0:114829cedd35 | 41 | ```bash |
soconstruct | 0:114829cedd35 | 42 | $ mbed compile -S |
soconstruct | 0:114829cedd35 | 43 | ``` |
soconstruct | 0:114829cedd35 | 44 | |
soconstruct | 0:114829cedd35 | 45 | ## Expected output |
soconstruct | 0:114829cedd35 | 46 | The LED on your target turns on and off every 500 milliseconds. |
soconstruct | 0:114829cedd35 | 47 | |
soconstruct | 0:114829cedd35 | 48 | |
soconstruct | 0:114829cedd35 | 49 | ## Troubleshooting |
soconstruct | 0:114829cedd35 | 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. |
soconstruct | 0:114829cedd35 | 51 | |
soconstruct | 0:114829cedd35 | 52 | ## Related Links |
soconstruct | 0:114829cedd35 | 53 | |
soconstruct | 0:114829cedd35 | 54 | * [Mbed OS Stats API](https://os.mbed.com/docs/latest/apis/mbed-statistics.html). |
soconstruct | 0:114829cedd35 | 55 | * [Mbed OS Configuration](https://os.mbed.com/docs/latest/reference/configuration.html). |
soconstruct | 0:114829cedd35 | 56 | * [Mbed OS Serial Communication](https://os.mbed.com/docs/latest/tutorials/serial-communication.html). |
soconstruct | 0:114829cedd35 | 57 | * [Mbed OS bare metal](https://os.mbed.com/docs/mbed-os/latest/reference/mbed-os-bare-metal.html). |
soconstruct | 0:114829cedd35 | 58 | * [Mbed boards](https://os.mbed.com/platforms/). |
soconstruct | 0:114829cedd35 | 59 | |
soconstruct | 0:114829cedd35 | 60 | ### License and contributions |
soconstruct | 0:114829cedd35 | 61 | |
soconstruct | 0:114829cedd35 | 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. |
soconstruct | 0:114829cedd35 | 63 | |
soconstruct | 0:114829cedd35 | 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. |