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