Testar Mbed OS

Committer:
henr22
Date:
Thu Sep 08 13:41:11 2016 +0000
Revision:
0:019059418f45
Teste Mbed OS

Who changed what in which revision?

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