decs

Dependencies:   storage_on_flash

Committer:
talhakkas
Date:
Sat May 19 09:48:32 2018 +0000
Revision:
2:eb09ab8cc121
Parent:
0:3fec541a3186
1

Who changed what in which revision?

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