mbed-os-example-blinky
Mini how-to "mbed-os-example-blinky"
You can compile the project using mbed compiler online or locally on your PC.
MBED Compiler on-line
The following steps will show you how to compile the project via browser:
1. Go to the Sensor Node page.
2. Click on the + Add to your Mbed Compiler button.
3. From the mbed-os-example-blinky page click on the Import into the Compiler button.
4. From the following form import the project:
5. Once imported check if you selected the right platform, on the right of the screen you should have this:
If there is another platform please click on it and select the Avnet Silica ST Sensor
6. Now you are able to compile the project just clicking on compile button:
7. After the compilation you will download automatically the firmware
8. Copy the binary file mbed-os-example-blinky.bin into the mass-storage TilePlus of the SensorNode board.
MBED Cli
The following steps will show you how to compile the project on your PC:
1. Clone this repository with the command:
$ mbed import https://os.mbed.com/teams/Avnet-Silica/code/mbed-os-example-blinky/
Information
The cloning process requires few minutes.
2. Enter in the directory and compile the project:
$ cd mbed-os-example-blinky
$ mbed compile -m SILICA_SENSOR_NODE -t GCC_ARM
3. Once compiled copy the binary file mbed-os-example-blinky.bin into the mass-storage TilePlus of the SensorNode board.
Information
You will find the mbed-os-example-blinky.bin file at:
"mbed-os-example-blinky\BUILD\SILICA_SENSOR_NODE\GCC_ARM" directory.
Warning
Please close with jumpers the following pins marked as yellow in order to power supply the board via micro-usb cable.
In the red rectangles, with this configuration is not important if you have connected the battery and if the switch is closed or open.
README.md@1:b3616b667812, 2017-11-09 (annotated)
- Committer:
- rspelta
- Date:
- Thu Nov 09 12:57:26 2017 +0100
- Revision:
- 1:b3616b667812
- Parent:
- 0:2272bce2eee5
Update mbed-os
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
rspelta | 0:2272bce2eee5 | 1 | # Getting started with Blinky on mbed OS |
rspelta | 0:2272bce2eee5 | 2 | |
rspelta | 0:2272bce2eee5 | 3 | This guide reviews the steps required to get Blinky working on an mbed OS platform. |
rspelta | 0:2272bce2eee5 | 4 | |
rspelta | 0:2272bce2eee5 | 5 | Please install [mbed CLI](https://github.com/ARMmbed/mbed-cli#installing-mbed-cli). |
rspelta | 0:2272bce2eee5 | 6 | |
rspelta | 0:2272bce2eee5 | 7 | ## Import the example application |
rspelta | 0:2272bce2eee5 | 8 | |
rspelta | 0:2272bce2eee5 | 9 | From the command-line, import the example: |
rspelta | 0:2272bce2eee5 | 10 | |
rspelta | 0:2272bce2eee5 | 11 | ``` |
rspelta | 0:2272bce2eee5 | 12 | mbed import mbed-os-example-blinky |
rspelta | 0:2272bce2eee5 | 13 | cd mbed-os-example-blinky |
rspelta | 0:2272bce2eee5 | 14 | ``` |
rspelta | 0:2272bce2eee5 | 15 | |
rspelta | 0:2272bce2eee5 | 16 | ### Now compile |
rspelta | 0:2272bce2eee5 | 17 | |
rspelta | 0:2272bce2eee5 | 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: |
rspelta | 0:2272bce2eee5 | 19 | |
rspelta | 0:2272bce2eee5 | 20 | ``` |
rspelta | 0:2272bce2eee5 | 21 | mbed compile -m K64F -t ARM |
rspelta | 0:2272bce2eee5 | 22 | ``` |
rspelta | 0:2272bce2eee5 | 23 | |
rspelta | 0:2272bce2eee5 | 24 | Your PC may take a few minutes to compile your code. At the end, you see the following result: |
rspelta | 0:2272bce2eee5 | 25 | |
rspelta | 0:2272bce2eee5 | 26 | ``` |
rspelta | 0:2272bce2eee5 | 27 | [snip] |
rspelta | 0:2272bce2eee5 | 28 | +----------------------------+-------+-------+------+ |
rspelta | 0:2272bce2eee5 | 29 | | Module | .text | .data | .bss | |
rspelta | 0:2272bce2eee5 | 30 | +----------------------------+-------+-------+------+ |
rspelta | 0:2272bce2eee5 | 31 | | Misc | 13939 | 24 | 1372 | |
rspelta | 0:2272bce2eee5 | 32 | | core/hal | 16993 | 96 | 296 | |
rspelta | 0:2272bce2eee5 | 33 | | core/rtos | 7384 | 92 | 4204 | |
rspelta | 0:2272bce2eee5 | 34 | | features/FEATURE_IPV4 | 80 | 0 | 176 | |
rspelta | 0:2272bce2eee5 | 35 | | frameworks/greentea-client | 1830 | 60 | 44 | |
rspelta | 0:2272bce2eee5 | 36 | | frameworks/utest | 2392 | 512 | 292 | |
rspelta | 0:2272bce2eee5 | 37 | | Subtotals | 42618 | 784 | 6384 | |
rspelta | 0:2272bce2eee5 | 38 | +----------------------------+-------+-------+------+ |
rspelta | 0:2272bce2eee5 | 39 | Allocated Heap: unknown |
rspelta | 0:2272bce2eee5 | 40 | Allocated Stack: unknown |
rspelta | 0:2272bce2eee5 | 41 | Total Static RAM memory (data + bss): 7168 bytes |
rspelta | 0:2272bce2eee5 | 42 | Total RAM memory (data + bss + heap + stack): 7168 bytes |
rspelta | 0:2272bce2eee5 | 43 | Total Flash memory (text + data + misc): 43402 bytes |
rspelta | 0:2272bce2eee5 | 44 | Image: .\.build\K64F\ARM\mbed-os-example-blinky.bin |
rspelta | 0:2272bce2eee5 | 45 | ``` |
rspelta | 0:2272bce2eee5 | 46 | |
rspelta | 0:2272bce2eee5 | 47 | ### Program your board |
rspelta | 0:2272bce2eee5 | 48 | |
rspelta | 0:2272bce2eee5 | 49 | 1. Connect your mbed device to the computer over USB. |
rspelta | 0:2272bce2eee5 | 50 | 1. Copy the binary file to the mbed device. |
rspelta | 0:2272bce2eee5 | 51 | 1. Press the reset button to start the program. |
rspelta | 0:2272bce2eee5 | 52 | |
rspelta | 0:2272bce2eee5 | 53 | The LED on your platform turns on and off. |
rspelta | 0:2272bce2eee5 | 54 | |
rspelta | 0:2272bce2eee5 | 55 | ## Export the project to Keil MDK, and debug your application |
rspelta | 0:2272bce2eee5 | 56 | |
rspelta | 0:2272bce2eee5 | 57 | From the command-line, run the following command: |
rspelta | 0:2272bce2eee5 | 58 | |
rspelta | 0:2272bce2eee5 | 59 | ``` |
rspelta | 0:2272bce2eee5 | 60 | mbed export -m K64F -i uvision |
rspelta | 0:2272bce2eee5 | 61 | ``` |
rspelta | 0:2272bce2eee5 | 62 | |
rspelta | 0:2272bce2eee5 | 63 | To debug the application: |
rspelta | 0:2272bce2eee5 | 64 | |
rspelta | 0:2272bce2eee5 | 65 | 1. Start uVision. |
rspelta | 0:2272bce2eee5 | 66 | 1. Import the uVision project generated earlier. |
rspelta | 0:2272bce2eee5 | 67 | 1. Compile your application, and generate an `.axf` file. |
rspelta | 0:2272bce2eee5 | 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). |
rspelta | 0:2272bce2eee5 | 69 | 1. Set breakpoints, and start a debug session. |
rspelta | 0:2272bce2eee5 | 70 | |
rspelta | 0:2272bce2eee5 | 71 | ![Image of uVision](img/uvision.png) |
rspelta | 0:2272bce2eee5 | 72 | |
rspelta | 0:2272bce2eee5 | 73 | ## Troubleshooting |
rspelta | 0:2272bce2eee5 | 74 | |
rspelta | 0:2272bce2eee5 | 75 | 1. Make sure `mbed-cli` is working correctly and its version is `>1.0.0` |
rspelta | 0:2272bce2eee5 | 76 | |
rspelta | 0:2272bce2eee5 | 77 | ``` |
rspelta | 0:2272bce2eee5 | 78 | mbed --version |
rspelta | 0:2272bce2eee5 | 79 | ``` |
rspelta | 0:2272bce2eee5 | 80 | |
rspelta | 0:2272bce2eee5 | 81 | If not, you can update it: |
rspelta | 0:2272bce2eee5 | 82 | |
rspelta | 0:2272bce2eee5 | 83 | ``` |
rspelta | 0:2272bce2eee5 | 84 | pip install mbed-cli --upgrade |
rspelta | 0:2272bce2eee5 | 85 | ``` |
rspelta | 0:2272bce2eee5 | 86 | |
rspelta | 0:2272bce2eee5 | 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. |