Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
README.md@0:b3aa5d5fe8df, 2017-07-12 (annotated)
- Committer:
- sarahmarshy
- Date:
- Wed Jul 12 17:42:01 2017 +0000
- Revision:
- 0:b3aa5d5fe8df
First commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sarahmarshy | 0:b3aa5d5fe8df | 1 | # Getting started with Blinky on mbed OS |
sarahmarshy | 0:b3aa5d5fe8df | 2 | |
sarahmarshy | 0:b3aa5d5fe8df | 3 | This guide reviews the steps required to get Blinky working on an mbed OS platform. |
sarahmarshy | 0:b3aa5d5fe8df | 4 | |
sarahmarshy | 0:b3aa5d5fe8df | 5 | Please install [mbed CLI](https://github.com/ARMmbed/mbed-cli#installing-mbed-cli). |
sarahmarshy | 0:b3aa5d5fe8df | 6 | |
sarahmarshy | 0:b3aa5d5fe8df | 7 | ## Import the example application |
sarahmarshy | 0:b3aa5d5fe8df | 8 | |
sarahmarshy | 0:b3aa5d5fe8df | 9 | From the command-line, import the example: |
sarahmarshy | 0:b3aa5d5fe8df | 10 | |
sarahmarshy | 0:b3aa5d5fe8df | 11 | ``` |
sarahmarshy | 0:b3aa5d5fe8df | 12 | mbed import mbed-os-example-blinky |
sarahmarshy | 0:b3aa5d5fe8df | 13 | cd mbed-os-example-blinky |
sarahmarshy | 0:b3aa5d5fe8df | 14 | ``` |
sarahmarshy | 0:b3aa5d5fe8df | 15 | |
sarahmarshy | 0:b3aa5d5fe8df | 16 | ### Now compile |
sarahmarshy | 0:b3aa5d5fe8df | 17 | |
sarahmarshy | 0:b3aa5d5fe8df | 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: |
sarahmarshy | 0:b3aa5d5fe8df | 19 | |
sarahmarshy | 0:b3aa5d5fe8df | 20 | ``` |
sarahmarshy | 0:b3aa5d5fe8df | 21 | mbed compile -m K64F -t ARM |
sarahmarshy | 0:b3aa5d5fe8df | 22 | ``` |
sarahmarshy | 0:b3aa5d5fe8df | 23 | |
sarahmarshy | 0:b3aa5d5fe8df | 24 | Your PC may take a few minutes to compile your code. At the end, you see the following result: |
sarahmarshy | 0:b3aa5d5fe8df | 25 | |
sarahmarshy | 0:b3aa5d5fe8df | 26 | ``` |
sarahmarshy | 0:b3aa5d5fe8df | 27 | [snip] |
sarahmarshy | 0:b3aa5d5fe8df | 28 | +----------------------------+-------+-------+------+ |
sarahmarshy | 0:b3aa5d5fe8df | 29 | | Module | .text | .data | .bss | |
sarahmarshy | 0:b3aa5d5fe8df | 30 | +----------------------------+-------+-------+------+ |
sarahmarshy | 0:b3aa5d5fe8df | 31 | | Misc | 13939 | 24 | 1372 | |
sarahmarshy | 0:b3aa5d5fe8df | 32 | | core/hal | 16993 | 96 | 296 | |
sarahmarshy | 0:b3aa5d5fe8df | 33 | | core/rtos | 7384 | 92 | 4204 | |
sarahmarshy | 0:b3aa5d5fe8df | 34 | | features/FEATURE_IPV4 | 80 | 0 | 176 | |
sarahmarshy | 0:b3aa5d5fe8df | 35 | | frameworks/greentea-client | 1830 | 60 | 44 | |
sarahmarshy | 0:b3aa5d5fe8df | 36 | | frameworks/utest | 2392 | 512 | 292 | |
sarahmarshy | 0:b3aa5d5fe8df | 37 | | Subtotals | 42618 | 784 | 6384 | |
sarahmarshy | 0:b3aa5d5fe8df | 38 | +----------------------------+-------+-------+------+ |
sarahmarshy | 0:b3aa5d5fe8df | 39 | Allocated Heap: unknown |
sarahmarshy | 0:b3aa5d5fe8df | 40 | Allocated Stack: unknown |
sarahmarshy | 0:b3aa5d5fe8df | 41 | Total Static RAM memory (data + bss): 7168 bytes |
sarahmarshy | 0:b3aa5d5fe8df | 42 | Total RAM memory (data + bss + heap + stack): 7168 bytes |
sarahmarshy | 0:b3aa5d5fe8df | 43 | Total Flash memory (text + data + misc): 43402 bytes |
sarahmarshy | 0:b3aa5d5fe8df | 44 | Image: .\.build\K64F\ARM\mbed-os-example-blinky.bin |
sarahmarshy | 0:b3aa5d5fe8df | 45 | ``` |
sarahmarshy | 0:b3aa5d5fe8df | 46 | |
sarahmarshy | 0:b3aa5d5fe8df | 47 | ### Program your board |
sarahmarshy | 0:b3aa5d5fe8df | 48 | |
sarahmarshy | 0:b3aa5d5fe8df | 49 | 1. Connect your mbed device to the computer over USB. |
sarahmarshy | 0:b3aa5d5fe8df | 50 | 1. Copy the binary file to the mbed device. |
sarahmarshy | 0:b3aa5d5fe8df | 51 | 1. Press the reset button to start the program. |
sarahmarshy | 0:b3aa5d5fe8df | 52 | |
sarahmarshy | 0:b3aa5d5fe8df | 53 | The LED on your platform turns on and off. |
sarahmarshy | 0:b3aa5d5fe8df | 54 | |
sarahmarshy | 0:b3aa5d5fe8df | 55 | ## Export the project to Keil MDK, and debug your application |
sarahmarshy | 0:b3aa5d5fe8df | 56 | |
sarahmarshy | 0:b3aa5d5fe8df | 57 | From the command-line, run the following command: |
sarahmarshy | 0:b3aa5d5fe8df | 58 | |
sarahmarshy | 0:b3aa5d5fe8df | 59 | ``` |
sarahmarshy | 0:b3aa5d5fe8df | 60 | mbed export -m K64F -i uvision |
sarahmarshy | 0:b3aa5d5fe8df | 61 | ``` |
sarahmarshy | 0:b3aa5d5fe8df | 62 | |
sarahmarshy | 0:b3aa5d5fe8df | 63 | To debug the application: |
sarahmarshy | 0:b3aa5d5fe8df | 64 | |
sarahmarshy | 0:b3aa5d5fe8df | 65 | 1. Start uVision. |
sarahmarshy | 0:b3aa5d5fe8df | 66 | 1. Import the uVision project generated earlier. |
sarahmarshy | 0:b3aa5d5fe8df | 67 | 1. Compile your application, and generate an `.axf` file. |
sarahmarshy | 0:b3aa5d5fe8df | 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). |
sarahmarshy | 0:b3aa5d5fe8df | 69 | 1. Set breakpoints, and start a debug session. |
sarahmarshy | 0:b3aa5d5fe8df | 70 | |
sarahmarshy | 0:b3aa5d5fe8df | 71 |  |
sarahmarshy | 0:b3aa5d5fe8df | 72 | |
sarahmarshy | 0:b3aa5d5fe8df | 73 | ## Troubleshooting |
sarahmarshy | 0:b3aa5d5fe8df | 74 | |
sarahmarshy | 0:b3aa5d5fe8df | 75 | 1. Make sure `mbed-cli` is working correctly and its version is `>1.0.0` |
sarahmarshy | 0:b3aa5d5fe8df | 76 | |
sarahmarshy | 0:b3aa5d5fe8df | 77 | ``` |
sarahmarshy | 0:b3aa5d5fe8df | 78 | mbed --version |
sarahmarshy | 0:b3aa5d5fe8df | 79 | ``` |
sarahmarshy | 0:b3aa5d5fe8df | 80 | |
sarahmarshy | 0:b3aa5d5fe8df | 81 | If not, you can update it: |
sarahmarshy | 0:b3aa5d5fe8df | 82 | |
sarahmarshy | 0:b3aa5d5fe8df | 83 | ``` |
sarahmarshy | 0:b3aa5d5fe8df | 84 | pip install mbed-cli --upgrade |
sarahmarshy | 0:b3aa5d5fe8df | 85 | ``` |
sarahmarshy | 0:b3aa5d5fe8df | 86 | |
sarahmarshy | 0:b3aa5d5fe8df | 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. |