javier vicente / Mbed OS mbedblink
Committer:
javiervicente
Date:
Mon Sep 30 20:56:08 2019 +0000
Revision:
0:666c8a7f11fe
vfc

Who changed what in which revision?

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