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