my first blinky test

Committer:
ilg
Date:
Wed Aug 31 22:19:16 2016 +0000
Revision:
0:fcfcebd5a471
first test

Who changed what in which revision?

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