SPI Test (Master)

Committer:
ryood
Date:
Fri May 19 01:26:13 2017 +0000
Revision:
1:b34b41d8a360
Parent:
0:0c8fb6842c2a
work well

Who changed what in which revision?

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