rt

Committer:
compiler2test
Date:
Thu Oct 19 15:01:10 2017 +0000
Revision:
0:71bdb85d44f7
Initial commit

Who changed what in which revision?

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