20171117_新規作成

Committer:
udagawa
Date:
Fri Nov 17 05:00:05 2017 +0000
Revision:
0:41304d545e93
????

Who changed what in which revision?

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