HexiHub code

Dependencies:   Hexi_KW40Z Hexi_OLED_SSD1351

Committer:
cwl35
Date:
Fri Feb 16 22:14:24 2018 +0000
Revision:
0:efcad8f28b0f
Master HexiHub code

Who changed what in which revision?

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