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