Breakout mbed

Dependencies:   TermControl

Committer:
gleydsonn
Date:
Sat Dec 10 13:51:24 2016 +0000
Revision:
0:aa30225d7ed5
Inicial Commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
gleydsonn 0:aa30225d7ed5 1 # Getting started with Blinky on mbed OS
gleydsonn 0:aa30225d7ed5 2
gleydsonn 0:aa30225d7ed5 3 This is a very simple guide, reviewing the steps required to get Blinky working on an mbed OS platform.
gleydsonn 0:aa30225d7ed5 4
gleydsonn 0:aa30225d7ed5 5 Please install [mbed CLI](https://github.com/ARMmbed/mbed-cli#installing-mbed-cli).
gleydsonn 0:aa30225d7ed5 6
gleydsonn 0:aa30225d7ed5 7 ## Get the example application!
gleydsonn 0:aa30225d7ed5 8
gleydsonn 0:aa30225d7ed5 9 From the command line, import the example:
gleydsonn 0:aa30225d7ed5 10
gleydsonn 0:aa30225d7ed5 11 ```
gleydsonn 0:aa30225d7ed5 12 mbed import mbed-os-example-blinky
gleydsonn 0:aa30225d7ed5 13 cd mbed-os-example-blinky
gleydsonn 0:aa30225d7ed5 14 ```
gleydsonn 0:aa30225d7ed5 15
gleydsonn 0:aa30225d7ed5 16 ### Now compile
gleydsonn 0:aa30225d7ed5 17
gleydsonn 0:aa30225d7ed5 18 Invoke `mbed compile` specifying the name of your platform and your favorite toolchain (`GCC_ARM`, `ARM`, `IAR`). For example, for the ARM Compiler 5:
gleydsonn 0:aa30225d7ed5 19
gleydsonn 0:aa30225d7ed5 20 ```
gleydsonn 0:aa30225d7ed5 21 mbed compile -m K64F -t ARM
gleydsonn 0:aa30225d7ed5 22 ```
gleydsonn 0:aa30225d7ed5 23
gleydsonn 0:aa30225d7ed5 24 Your PC may take a few minutes to compile your code. At the end you should get the following result:
gleydsonn 0:aa30225d7ed5 25
gleydsonn 0:aa30225d7ed5 26 ```
gleydsonn 0:aa30225d7ed5 27 [snip]
gleydsonn 0:aa30225d7ed5 28 +----------------------------+-------+-------+------+
gleydsonn 0:aa30225d7ed5 29 | Module | .text | .data | .bss |
gleydsonn 0:aa30225d7ed5 30 +----------------------------+-------+-------+------+
gleydsonn 0:aa30225d7ed5 31 | Misc | 13939 | 24 | 1372 |
gleydsonn 0:aa30225d7ed5 32 | core/hal | 16993 | 96 | 296 |
gleydsonn 0:aa30225d7ed5 33 | core/rtos | 7384 | 92 | 4204 |
gleydsonn 0:aa30225d7ed5 34 | features/FEATURE_IPV4 | 80 | 0 | 176 |
gleydsonn 0:aa30225d7ed5 35 | frameworks/greentea-client | 1830 | 60 | 44 |
gleydsonn 0:aa30225d7ed5 36 | frameworks/utest | 2392 | 512 | 292 |
gleydsonn 0:aa30225d7ed5 37 | Subtotals | 42618 | 784 | 6384 |
gleydsonn 0:aa30225d7ed5 38 +----------------------------+-------+-------+------+
gleydsonn 0:aa30225d7ed5 39 Allocated Heap: unknown
gleydsonn 0:aa30225d7ed5 40 Allocated Stack: unknown
gleydsonn 0:aa30225d7ed5 41 Total Static RAM memory (data + bss): 7168 bytes
gleydsonn 0:aa30225d7ed5 42 Total RAM memory (data + bss + heap + stack): 7168 bytes
gleydsonn 0:aa30225d7ed5 43 Total Flash memory (text + data + misc): 43402 bytes
gleydsonn 0:aa30225d7ed5 44 Image: .\.build\K64F\ARM\mbed-os-example-blinky.bin
gleydsonn 0:aa30225d7ed5 45 ```
gleydsonn 0:aa30225d7ed5 46
gleydsonn 0:aa30225d7ed5 47 ### Program your board
gleydsonn 0:aa30225d7ed5 48
gleydsonn 0:aa30225d7ed5 49 1. Connect your mbed device to the computer over USB.
gleydsonn 0:aa30225d7ed5 50 1. Copy the binary file to the mbed device .
gleydsonn 0:aa30225d7ed5 51 1. Press the reset button to start the program.
gleydsonn 0:aa30225d7ed5 52
gleydsonn 0:aa30225d7ed5 53 You should see the LED of your platform turning on and off.
gleydsonn 0:aa30225d7ed5 54
gleydsonn 0:aa30225d7ed5 55 Congratulations if you managed to complete this test!
gleydsonn 0:aa30225d7ed5 56
gleydsonn 0:aa30225d7ed5 57 ## Export the project to Keil MDK and debug your application
gleydsonn 0:aa30225d7ed5 58
gleydsonn 0:aa30225d7ed5 59 From the command line, run the following command:
gleydsonn 0:aa30225d7ed5 60
gleydsonn 0:aa30225d7ed5 61 ```
gleydsonn 0:aa30225d7ed5 62 mbed export -m K64F -i uvision
gleydsonn 0:aa30225d7ed5 63 ```
gleydsonn 0:aa30225d7ed5 64
gleydsonn 0:aa30225d7ed5 65 To debug the application:
gleydsonn 0:aa30225d7ed5 66
gleydsonn 0:aa30225d7ed5 67 1. Start uVision.
gleydsonn 0:aa30225d7ed5 68 1. Import the uVision project generated earlier.
gleydsonn 0:aa30225d7ed5 69 1. Compile your application and generate an `.axf` file.
gleydsonn 0:aa30225d7ed5 70 1. Make sure uVision is configured to debug over CMSIS-DAP (From the Project menu > Options for Target '...' > Debug tab > Use CMSIS-DAP Debugger).
gleydsonn 0:aa30225d7ed5 71 1. Set breakpoints and start a debug session.
gleydsonn 0:aa30225d7ed5 72
gleydsonn 0:aa30225d7ed5 73 ![Image of uVision](img/uvision.png)
gleydsonn 0:aa30225d7ed5 74
gleydsonn 0:aa30225d7ed5 75 ## Troubleshooting
gleydsonn 0:aa30225d7ed5 76
gleydsonn 0:aa30225d7ed5 77 1. Make sure `mbed-cli` is working correctly and its version is greater than `0.8.9`
gleydsonn 0:aa30225d7ed5 78
gleydsonn 0:aa30225d7ed5 79 ```
gleydsonn 0:aa30225d7ed5 80 mbed --version
gleydsonn 0:aa30225d7ed5 81 ```
gleydsonn 0:aa30225d7ed5 82
gleydsonn 0:aa30225d7ed5 83 If not, you can update it easily:
gleydsonn 0:aa30225d7ed5 84
gleydsonn 0:aa30225d7ed5 85 ```
gleydsonn 0:aa30225d7ed5 86 pip install mbed-cli --upgrade
gleydsonn 0:aa30225d7ed5 87 ```
gleydsonn 0:aa30225d7ed5 88
gleydsonn 0:aa30225d7ed5 89 2. If using Keil MDK, make sure you have a license installed. [MDK-Lite](http://www.keil.com/arm/mdk.asp) has a 32KB restriction on code size.