mbed OS-5 I2C Slave using Nucleo-F401RE board.

Committer:
jingxizhang
Date:
Mon Aug 22 01:30:24 2016 +0000
Revision:
0:96840f1cc413
Initial commit;

Who changed what in which revision?

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