wenbo qi / Mbed OS mbed-os-example-blinky2

Dependencies:   SLCD

Committer:
wenbo
Date:
Mon Feb 20 12:55:47 2017 +0000
Revision:
0:7eceeb389bb9
test

Who changed what in which revision?

UserRevisionLine numberNew contents of line
wenbo 0:7eceeb389bb9 1 # Getting started with Blinky on mbed OS
wenbo 0:7eceeb389bb9 2
wenbo 0:7eceeb389bb9 3 This is a very simple guide, reviewing the steps required to get Blinky working on an mbed OS platform.
wenbo 0:7eceeb389bb9 4
wenbo 0:7eceeb389bb9 5 Please install [mbed CLI](https://github.com/ARMmbed/mbed-cli#installing-mbed-cli).
wenbo 0:7eceeb389bb9 6
wenbo 0:7eceeb389bb9 7 ## Get the example application!
wenbo 0:7eceeb389bb9 8
wenbo 0:7eceeb389bb9 9 From the command line, import the example:
wenbo 0:7eceeb389bb9 10
wenbo 0:7eceeb389bb9 11 ```
wenbo 0:7eceeb389bb9 12 mbed import mbed-os-example-blinky
wenbo 0:7eceeb389bb9 13 cd mbed-os-example-blinky
wenbo 0:7eceeb389bb9 14 ```
wenbo 0:7eceeb389bb9 15
wenbo 0:7eceeb389bb9 16 ### Now compile
wenbo 0:7eceeb389bb9 17
wenbo 0:7eceeb389bb9 18 Invoke `mbed compile` specifying the name of your platform and your favorite toolchain (`GCC_ARM`, `ARM`, `IAR`). For example, for the ARM Compiler 5:
wenbo 0:7eceeb389bb9 19
wenbo 0:7eceeb389bb9 20 ```
wenbo 0:7eceeb389bb9 21 mbed compile -m K64F -t ARM
wenbo 0:7eceeb389bb9 22 ```
wenbo 0:7eceeb389bb9 23
wenbo 0:7eceeb389bb9 24 Your PC may take a few minutes to compile your code. At the end you should get the following result:
wenbo 0:7eceeb389bb9 25
wenbo 0:7eceeb389bb9 26 ```
wenbo 0:7eceeb389bb9 27 [snip]
wenbo 0:7eceeb389bb9 28 +----------------------------+-------+-------+------+
wenbo 0:7eceeb389bb9 29 | Module | .text | .data | .bss |
wenbo 0:7eceeb389bb9 30 +----------------------------+-------+-------+------+
wenbo 0:7eceeb389bb9 31 | Misc | 13939 | 24 | 1372 |
wenbo 0:7eceeb389bb9 32 | core/hal | 16993 | 96 | 296 |
wenbo 0:7eceeb389bb9 33 | core/rtos | 7384 | 92 | 4204 |
wenbo 0:7eceeb389bb9 34 | features/FEATURE_IPV4 | 80 | 0 | 176 |
wenbo 0:7eceeb389bb9 35 | frameworks/greentea-client | 1830 | 60 | 44 |
wenbo 0:7eceeb389bb9 36 | frameworks/utest | 2392 | 512 | 292 |
wenbo 0:7eceeb389bb9 37 | Subtotals | 42618 | 784 | 6384 |
wenbo 0:7eceeb389bb9 38 +----------------------------+-------+-------+------+
wenbo 0:7eceeb389bb9 39 Allocated Heap: unknown
wenbo 0:7eceeb389bb9 40 Allocated Stack: unknown
wenbo 0:7eceeb389bb9 41 Total Static RAM memory (data + bss): 7168 bytes
wenbo 0:7eceeb389bb9 42 Total RAM memory (data + bss + heap + stack): 7168 bytes
wenbo 0:7eceeb389bb9 43 Total Flash memory (text + data + misc): 43402 bytes
wenbo 0:7eceeb389bb9 44 Image: .\.build\K64F\ARM\mbed-os-example-blinky.bin
wenbo 0:7eceeb389bb9 45 ```
wenbo 0:7eceeb389bb9 46
wenbo 0:7eceeb389bb9 47 ### Program your board
wenbo 0:7eceeb389bb9 48
wenbo 0:7eceeb389bb9 49 1. Connect your mbed device to the computer over USB.
wenbo 0:7eceeb389bb9 50 1. Copy the binary file to the mbed device .
wenbo 0:7eceeb389bb9 51 1. Press the reset button to start the program.
wenbo 0:7eceeb389bb9 52
wenbo 0:7eceeb389bb9 53 You should see the LED of your platform turning on and off.
wenbo 0:7eceeb389bb9 54
wenbo 0:7eceeb389bb9 55 Congratulations if you managed to complete this test!
wenbo 0:7eceeb389bb9 56
wenbo 0:7eceeb389bb9 57 ## Export the project to Keil MDK and debug your application
wenbo 0:7eceeb389bb9 58
wenbo 0:7eceeb389bb9 59 From the command line, run the following command:
wenbo 0:7eceeb389bb9 60
wenbo 0:7eceeb389bb9 61 ```
wenbo 0:7eceeb389bb9 62 mbed export -m K64F -i uvision
wenbo 0:7eceeb389bb9 63 ```
wenbo 0:7eceeb389bb9 64
wenbo 0:7eceeb389bb9 65 To debug the application:
wenbo 0:7eceeb389bb9 66
wenbo 0:7eceeb389bb9 67 1. Start uVision.
wenbo 0:7eceeb389bb9 68 1. Import the uVision project generated earlier.
wenbo 0:7eceeb389bb9 69 1. Compile your application and generate an `.axf` file.
wenbo 0:7eceeb389bb9 70 1. Make sure uVision is configured to debug over CMSIS-DAP (From the Project menu > Options for Target '...' > Debug tab > Use CMSIS-DAP Debugger).
wenbo 0:7eceeb389bb9 71 1. Set breakpoints and start a debug session.
wenbo 0:7eceeb389bb9 72
wenbo 0:7eceeb389bb9 73 ![Image of uVision](img/uvision.png)
wenbo 0:7eceeb389bb9 74
wenbo 0:7eceeb389bb9 75 ## Troubleshooting
wenbo 0:7eceeb389bb9 76
wenbo 0:7eceeb389bb9 77 1. Make sure `mbed-cli` is working correctly and its version is `>1.0.0`
wenbo 0:7eceeb389bb9 78
wenbo 0:7eceeb389bb9 79 ```
wenbo 0:7eceeb389bb9 80 mbed --version
wenbo 0:7eceeb389bb9 81 ```
wenbo 0:7eceeb389bb9 82
wenbo 0:7eceeb389bb9 83 If not, you can update it easily:
wenbo 0:7eceeb389bb9 84
wenbo 0:7eceeb389bb9 85 ```
wenbo 0:7eceeb389bb9 86 pip install mbed-cli --upgrade
wenbo 0:7eceeb389bb9 87 ```
wenbo 0:7eceeb389bb9 88
wenbo 0:7eceeb389bb9 89 2. If using Keil MDK, make sure you have a license installed. [MDK-Lite](http://www.keil.com/arm/mdk.asp) has a 32KB restriction on code size.