copy of mbed-os-example-blinky

Committer:
tulanthoar
Date:
Thu Apr 27 16:03:40 2017 -0600
Revision:
1:5127448aa699
Parent:
0:ea82a5a12af4
change to LED3 to distinguish from every other blinky

Who changed what in which revision?

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