MBC002 - DigitalIn * This example use the DigitalIn function

Dependents:   steering_wheel_controls_TO_KEENWOOD_RADIO_INFRARED_INTERFACE NUCLEO_TRANSMITS_8_INFRARED_COMMANDS

Committer:
leandropg
Date:
Sun May 20 11:33:50 2018 +0000
Revision:
0:4265ec26da85
MBC002 - DigitalIn * This example use the DigitalIn function

Who changed what in which revision?

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