ASHUTOSH NAIK / Mbed OS mbed-GSR
Committer:
a7ashh14
Date:
Wed Aug 30 19:07:24 2017 +0000
Revision:
0:e77e18a5ec60
Initial commit

Who changed what in which revision?

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