Blink LED_GREEN

Committer:
andcor02
Date:
Wed Nov 01 13:01:19 2017 +0000
Revision:
0:cd2e5c2e7d07
Blink LED_GREEN

Who changed what in which revision?

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