example FatFS, LittleFileSystem, BlockDevice

Committer:
romanstrizhev
Date:
Sat Jan 22 18:01:37 2022 +0000
Revision:
0:08256a8320ed
Child:
1:a821bfb46e0e
FatFS example

Who changed what in which revision?

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