Test nRF52840 Preview DK led&button

Committer:
szqt
Date:
Mon Feb 06 11:03:48 2017 +0000
Revision:
0:54f4263790ee
nRF52840 Preview DK led and button test

Who changed what in which revision?

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