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