Okz

Committer:
ofosakar
Date:
Tue Sep 27 10:53:59 2016 +0000
Revision:
0:f9e6c5692d8b
Publish;

Who changed what in which revision?

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