mbed-os Hello World!

Committer:
tuthai
Date:
Wed Aug 02 10:04:40 2017 +0000
Revision:
1:6daec419c2cc
Parent:
0:0e8f7d5af1f2
Downgrade to mbed-os 5.4.7; See https://developer.mbed.org/platforms/Renesas-GR-PEACH/#important-notice

Who changed what in which revision?

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