example FatFS, LittleFileSystem, BlockDevice

Committer:
romanstrizhev
Date:
Sun Jan 23 08:01:31 2022 +0000
Revision:
3:21cb7bb297e5
Parent:
2:63a76921d121
update

Who changed what in which revision?

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