NUCLEO I2C SLAVE

Committer:
capriele
Date:
Wed Mar 01 08:07:32 2017 +0000
Revision:
0:9c09b3288b2a
NUCLEO I2C SLAVE

Who changed what in which revision?

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