initial simple example that prints to terminal

Dependencies:   MPL3115A2

Committer:
maclobdell
Date:
Sat Aug 13 16:02:39 2016 +0000
Revision:
0:97dd02e37c94
initial simple example that prints to terminal

Who changed what in which revision?

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