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