test

Committer:
yuqlid
Date:
Sun Nov 19 13:40:14 2017 +0000
Revision:
0:2af8dd31afde
test;

Who changed what in which revision?

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