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