University of Plymouth - Stages 1, 2 and 3 / Mbed OS Task690-mbed-os-FZ429ZI

Dependencies:   BMP280 ELEC350-Practicals-FZ429 BME280

Fork of Task690-mbed-os-FZ429ZI by University of Plymouth - Stages 1, 2 and 3

Committer:
martinsimpson
Date:
Fri Oct 20 11:29:41 2017 +0000
Revision:
0:1ce5a958aaf8
First draft

Who changed what in which revision?

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