123

Dependencies:   WS2812 PixelArray DebounceIn

Committer:
turumputum
Date:
Thu Jul 02 10:33:57 2020 +0000
Revision:
1:af17c65e86dc
Parent:
0:ea88f8c194d2
233

Who changed what in which revision?

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