A RTOS,Thread test.

Dependencies:   DS1820

Committer:
mingjunxu
Date:
Wed Dec 06 12:35:56 2017 +0000
Revision:
0:15a8ce505cc7
RTOS Thread test

Who changed what in which revision?

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