xcvcx

Committer:
wbqaston
Date:
Mon Dec 26 07:33:51 2016 +0000
Revision:
1:9e60464b3c72
Parent:
0:7b4fe69d1af5
fdgvd

Who changed what in which revision?

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