Suzu Tomo / Mbed OS 2020_ChristmasLED

Dependencies:   WS2812B_SPI

Committer:
Suzutomo
Date:
Sat Nov 07 13:40:03 2020 +0000
Revision:
0:943dfa56009a
first?

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Suzutomo 0:943dfa56009a 1 # Getting started with Blinky on mbed OS
Suzutomo 0:943dfa56009a 2
Suzutomo 0:943dfa56009a 3 This guide reviews the steps required to get Blinky working on an mbed OS platform.
Suzutomo 0:943dfa56009a 4
Suzutomo 0:943dfa56009a 5 Please install [mbed CLI](https://github.com/ARMmbed/mbed-cli#installing-mbed-cli).
Suzutomo 0:943dfa56009a 6
Suzutomo 0:943dfa56009a 7 ## Import the example application
Suzutomo 0:943dfa56009a 8
Suzutomo 0:943dfa56009a 9 From the command-line, import the example:
Suzutomo 0:943dfa56009a 10
Suzutomo 0:943dfa56009a 11 ```
Suzutomo 0:943dfa56009a 12 mbed import mbed-os-example-blinky
Suzutomo 0:943dfa56009a 13 cd mbed-os-example-blinky
Suzutomo 0:943dfa56009a 14 ```
Suzutomo 0:943dfa56009a 15
Suzutomo 0:943dfa56009a 16 ### Now compile
Suzutomo 0:943dfa56009a 17
Suzutomo 0:943dfa56009a 18 Invoke `mbed compile`, and specify the name of your platform and your favorite toolchain (`GCC_ARM`, `ARM`, `IAR`). For example, for the ARM Compiler 5:
Suzutomo 0:943dfa56009a 19
Suzutomo 0:943dfa56009a 20 ```
Suzutomo 0:943dfa56009a 21 mbed compile -m K64F -t ARM
Suzutomo 0:943dfa56009a 22 ```
Suzutomo 0:943dfa56009a 23
Suzutomo 0:943dfa56009a 24 Your PC may take a few minutes to compile your code. At the end, you see the following result:
Suzutomo 0:943dfa56009a 25
Suzutomo 0:943dfa56009a 26 ```
Suzutomo 0:943dfa56009a 27 [snip]
Suzutomo 0:943dfa56009a 28 +----------------------------+-------+-------+------+
Suzutomo 0:943dfa56009a 29 | Module | .text | .data | .bss |
Suzutomo 0:943dfa56009a 30 +----------------------------+-------+-------+------+
Suzutomo 0:943dfa56009a 31 | Misc | 13939 | 24 | 1372 |
Suzutomo 0:943dfa56009a 32 | core/hal | 16993 | 96 | 296 |
Suzutomo 0:943dfa56009a 33 | core/rtos | 7384 | 92 | 4204 |
Suzutomo 0:943dfa56009a 34 | features/FEATURE_IPV4 | 80 | 0 | 176 |
Suzutomo 0:943dfa56009a 35 | frameworks/greentea-client | 1830 | 60 | 44 |
Suzutomo 0:943dfa56009a 36 | frameworks/utest | 2392 | 512 | 292 |
Suzutomo 0:943dfa56009a 37 | Subtotals | 42618 | 784 | 6384 |
Suzutomo 0:943dfa56009a 38 +----------------------------+-------+-------+------+
Suzutomo 0:943dfa56009a 39 Allocated Heap: unknown
Suzutomo 0:943dfa56009a 40 Allocated Stack: unknown
Suzutomo 0:943dfa56009a 41 Total Static RAM memory (data + bss): 7168 bytes
Suzutomo 0:943dfa56009a 42 Total RAM memory (data + bss + heap + stack): 7168 bytes
Suzutomo 0:943dfa56009a 43 Total Flash memory (text + data + misc): 43402 bytes
Suzutomo 0:943dfa56009a 44 Image: .\.build\K64F\ARM\mbed-os-example-blinky.bin
Suzutomo 0:943dfa56009a 45 ```
Suzutomo 0:943dfa56009a 46
Suzutomo 0:943dfa56009a 47 ### Program your board
Suzutomo 0:943dfa56009a 48
Suzutomo 0:943dfa56009a 49 1. Connect your mbed device to the computer over USB.
Suzutomo 0:943dfa56009a 50 1. Copy the binary file to the mbed device.
Suzutomo 0:943dfa56009a 51 1. Press the reset button to start the program.
Suzutomo 0:943dfa56009a 52
Suzutomo 0:943dfa56009a 53 The LED on your platform turns on and off.
Suzutomo 0:943dfa56009a 54
Suzutomo 0:943dfa56009a 55 ## Export the project to Keil MDK, and debug your application
Suzutomo 0:943dfa56009a 56
Suzutomo 0:943dfa56009a 57 From the command-line, run the following command:
Suzutomo 0:943dfa56009a 58
Suzutomo 0:943dfa56009a 59 ```
Suzutomo 0:943dfa56009a 60 mbed export -m K64F -i uvision
Suzutomo 0:943dfa56009a 61 ```
Suzutomo 0:943dfa56009a 62
Suzutomo 0:943dfa56009a 63 To debug the application:
Suzutomo 0:943dfa56009a 64
Suzutomo 0:943dfa56009a 65 1. Start uVision.
Suzutomo 0:943dfa56009a 66 1. Import the uVision project generated earlier.
Suzutomo 0:943dfa56009a 67 1. Compile your application, and generate an `.axf` file.
Suzutomo 0:943dfa56009a 68 1. Make sure uVision is configured to debug over CMSIS-DAP (From the Project menu > Options for Target '...' > Debug tab > Use CMSIS-DAP Debugger).
Suzutomo 0:943dfa56009a 69 1. Set breakpoints, and start a debug session.
Suzutomo 0:943dfa56009a 70
Suzutomo 0:943dfa56009a 71 ![Image of uVision](img/uvision.png)
Suzutomo 0:943dfa56009a 72
Suzutomo 0:943dfa56009a 73 ## Troubleshooting
Suzutomo 0:943dfa56009a 74
Suzutomo 0:943dfa56009a 75 1. Make sure `mbed-cli` is working correctly and its version is `>1.0.0`
Suzutomo 0:943dfa56009a 76
Suzutomo 0:943dfa56009a 77 ```
Suzutomo 0:943dfa56009a 78 mbed --version
Suzutomo 0:943dfa56009a 79 ```
Suzutomo 0:943dfa56009a 80
Suzutomo 0:943dfa56009a 81 If not, you can update it:
Suzutomo 0:943dfa56009a 82
Suzutomo 0:943dfa56009a 83 ```
Suzutomo 0:943dfa56009a 84 pip install mbed-cli --upgrade
Suzutomo 0:943dfa56009a 85 ```
Suzutomo 0:943dfa56009a 86
Suzutomo 0:943dfa56009a 87 2. If using Keil MDK, make sure you have a license installed. [MDK-Lite](http://www.keil.com/arm/mdk.asp) has a 32 KB restriction on code size.