180118 export test

Committer:
jmhong
Date:
Thu Jan 18 00:03:12 2018 +0000
Revision:
0:57cc2239a601
180118 export test

Who changed what in which revision?

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