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