A digital input monitoring implementation with busy wait.

Committer:
sarahmarshy
Date:
Mon Sep 26 16:22:10 2016 +0000
Revision:
0:c27624b8b1e0
Initial commit. Busy wait button.

Who changed what in which revision?

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