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