test

Committer:
David Yu
Date:
Fri Oct 06 13:30:32 2017 +0800
Revision:
1:94986ca0db0a
Parent:
0:5ec2204f1886
Revised baud rate

Who changed what in which revision?

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