20170908

Dependencies:   Hexi_OLED_SSD1351 W25Q64FVSSIG

Committer:
i_am_kitsune
Date:
Fri Sep 08 05:53:38 2017 +0000
Revision:
0:87831c311089
20170908

Who changed what in which revision?

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