Marco Peciola
/
Marco Peciola MBED
My personal projects
README.md@0:ecd984e9f637, 2021-01-19 (annotated)
- Committer:
- macez
- Date:
- Tue Jan 19 11:27:16 2021 +0200
- Revision:
- 0:ecd984e9f637
1st Update
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
macez | 0:ecd984e9f637 | 1 | ![](./resources/official_armmbed_example_badge.png) |
macez | 0:ecd984e9f637 | 2 | # Blinky Mbed OS example |
macez | 0:ecd984e9f637 | 3 | |
macez | 0:ecd984e9f637 | 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/). |
macez | 0:ecd984e9f637 | 5 | |
macez | 0:ecd984e9f637 | 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). |
macez | 0:ecd984e9f637 | 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).) |
macez | 0:ecd984e9f637 | 8 | |
macez | 0:ecd984e9f637 | 9 | 1. [Install Mbed CLI](https://os.mbed.com/docs/mbed-os/latest/quick-start/offline-with-mbed-cli.html). |
macez | 0:ecd984e9f637 | 10 | 1. From the command-line, import the example: `mbed import mbed-os-example-blinky` |
macez | 0:ecd984e9f637 | 11 | 1. Change the current directory to where the project was imported. |
macez | 0:ecd984e9f637 | 12 | |
macez | 0:ecd984e9f637 | 13 | ## Application functionality |
macez | 0:ecd984e9f637 | 14 | |
macez | 0:ecd984e9f637 | 15 | 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. |
macez | 0:ecd984e9f637 | 16 | |
macez | 0:ecd984e9f637 | 17 | ## Building and running |
macez | 0:ecd984e9f637 | 18 | |
macez | 0:ecd984e9f637 | 19 | 1. Connect a USB cable between the USB port on the board and the host computer. |
macez | 0:ecd984e9f637 | 20 | 1. Run the following command to build the example project and program the microcontroller flash memory: |
macez | 0:ecd984e9f637 | 21 | |
macez | 0:ecd984e9f637 | 22 | ```bash |
macez | 0:ecd984e9f637 | 23 | $ mbed compile -m <TARGET> -t <TOOLCHAIN> --flash |
macez | 0:ecd984e9f637 | 24 | ``` |
macez | 0:ecd984e9f637 | 25 | |
macez | 0:ecd984e9f637 | 26 | Your PC may take a few minutes to compile your code. |
macez | 0:ecd984e9f637 | 27 | |
macez | 0:ecd984e9f637 | 28 | The binary is located at `./BUILD/<TARGET>/<TOOLCHAIN>/mbed-os-example-blinky.bin`. |
macez | 0:ecd984e9f637 | 29 | |
macez | 0:ecd984e9f637 | 30 | Alternatively, you can manually copy the binary to the board, which you mount on the host computer over USB. |
macez | 0:ecd984e9f637 | 31 | |
macez | 0:ecd984e9f637 | 32 | 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: |
macez | 0:ecd984e9f637 | 33 | |
macez | 0:ecd984e9f637 | 34 | ```bash |
macez | 0:ecd984e9f637 | 35 | $ mbed compile -S |
macez | 0:ecd984e9f637 | 36 | ``` |
macez | 0:ecd984e9f637 | 37 | |
macez | 0:ecd984e9f637 | 38 | ## Expected output |
macez | 0:ecd984e9f637 | 39 | The LED on your target turns on and off every 500 milliseconds. |
macez | 0:ecd984e9f637 | 40 | |
macez | 0:ecd984e9f637 | 41 | |
macez | 0:ecd984e9f637 | 42 | ## Troubleshooting |
macez | 0:ecd984e9f637 | 43 | 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. |
macez | 0:ecd984e9f637 | 44 | |
macez | 0:ecd984e9f637 | 45 | ## Related Links |
macez | 0:ecd984e9f637 | 46 | |
macez | 0:ecd984e9f637 | 47 | * [Mbed OS Stats API](https://os.mbed.com/docs/latest/apis/mbed-statistics.html). |
macez | 0:ecd984e9f637 | 48 | * [Mbed OS Configuration](https://os.mbed.com/docs/latest/reference/configuration.html). |
macez | 0:ecd984e9f637 | 49 | * [Mbed OS Serial Communication](https://os.mbed.com/docs/latest/tutorials/serial-communication.html). |
macez | 0:ecd984e9f637 | 50 | * [Mbed OS bare metal](https://os.mbed.com/docs/mbed-os/latest/reference/mbed-os-bare-metal.html). |
macez | 0:ecd984e9f637 | 51 | * [Mbed boards](https://os.mbed.com/platforms/). |
macez | 0:ecd984e9f637 | 52 | |
macez | 0:ecd984e9f637 | 53 | ### License and contributions |
macez | 0:ecd984e9f637 | 54 | |
macez | 0:ecd984e9f637 | 55 | 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. |
macez | 0:ecd984e9f637 | 56 | |
macez | 0:ecd984e9f637 | 57 | This project contains code from other projects. The original license text is included in those source files. They must comply with our license guide. |