Blinking LED example for LPC55S69

Committer:
maclobdell
Date:
Mon Mar 25 22:28:40 2019 -0500
Revision:
0:03c15e688f62
blinky app that uses mbed os 5.12 release candidate

Who changed what in which revision?

UserRevisionLine numberNew contents of line
maclobdell 0:03c15e688f62 1 # Getting started example for Mbed OS
maclobdell 0:03c15e688f62 2
maclobdell 0:03c15e688f62 3 This guide reviews the steps required to get Blinky with the addition of dynamic OS statistics working on an Mbed OS platform. (Note: To see a rendered example you can import into the Arm Online Compiler, please see our [quick start](https://os.mbed.com/docs/mbed-os/latest/quick-start/online-with-the-online-compiler.html#importing-the-code).)
maclobdell 0:03c15e688f62 4
maclobdell 0:03c15e688f62 5 Please install [Mbed CLI](https://github.com/ARMmbed/mbed-cli#installing-mbed-cli).
maclobdell 0:03c15e688f62 6
maclobdell 0:03c15e688f62 7 ## Import the example application
maclobdell 0:03c15e688f62 8
maclobdell 0:03c15e688f62 9 From the command-line, import the example:
maclobdell 0:03c15e688f62 10
maclobdell 0:03c15e688f62 11 ```
maclobdell 0:03c15e688f62 12 mbed import mbed-os-example-blinky
maclobdell 0:03c15e688f62 13 cd mbed-os-example-blinky
maclobdell 0:03c15e688f62 14 ```
maclobdell 0:03c15e688f62 15
maclobdell 0:03c15e688f62 16 ### Now compile
maclobdell 0:03c15e688f62 17
maclobdell 0:03c15e688f62 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:
maclobdell 0:03c15e688f62 19
maclobdell 0:03c15e688f62 20 ```
maclobdell 0:03c15e688f62 21 mbed compile -m K64F -t ARM
maclobdell 0:03c15e688f62 22 ```
maclobdell 0:03c15e688f62 23
maclobdell 0:03c15e688f62 24 Your PC may take a few minutes to compile your code. At the end, you see the following result:
maclobdell 0:03c15e688f62 25
maclobdell 0:03c15e688f62 26 ```
maclobdell 0:03c15e688f62 27 [snip]
maclobdell 0:03c15e688f62 28 +----------------------------+-------+-------+------+
maclobdell 0:03c15e688f62 29 | Module | .text | .data | .bss |
maclobdell 0:03c15e688f62 30 |--------------------|-----------|----------|----------|
maclobdell 0:03c15e688f62 31 | [fill] | 98(+0) | 0(+0) | 2211(+0) |
maclobdell 0:03c15e688f62 32 | [lib]/c.a | 27835(+0) | 2472(+0) | 89(+0) |
maclobdell 0:03c15e688f62 33 | [lib]/gcc.a | 3168(+0) | 0(+0) | 0(+0) |
maclobdell 0:03c15e688f62 34 | [lib]/misc | 248(+0) | 8(+0) | 28(+0) |
maclobdell 0:03c15e688f62 35 | [lib]/nosys.a | 32(+0) | 0(+0) | 0(+0) |
maclobdell 0:03c15e688f62 36 | main.o | 924(+0) | 0(+0) | 12(+0) |
maclobdell 0:03c15e688f62 37 | mbed-os/components | 134(+0) | 0(+0) | 0(+0) |
maclobdell 0:03c15e688f62 38 | mbed-os/drivers | 56(+0) | 0(+0) | 0(+0) |
maclobdell 0:03c15e688f62 39 | mbed-os/features | 42(+0) | 0(+0) | 184(+0) |
maclobdell 0:03c15e688f62 40 | mbed-os/hal | 2087(+0) | 8(+0) | 152(+0) |
maclobdell 0:03c15e688f62 41 | mbed-os/platform | 3633(+0) | 260(+0) | 209(+0) |
maclobdell 0:03c15e688f62 42 | mbed-os/rtos | 9370(+0) | 168(+0) | 6053(+0) |
maclobdell 0:03c15e688f62 43 | mbed-os/targets | 9536(+0) | 12(+0) | 382(+0) |
maclobdell 0:03c15e688f62 44 | Subtotals | 57163(+0) | 2928(+0) | 9320(+0) |
maclobdell 0:03c15e688f62 45 Total Static RAM memory (data + bss): 12248(+0) bytes
maclobdell 0:03c15e688f62 46 Total Flash memory (text + data): 60091(+0) bytes
maclobdell 0:03c15e688f62 47
maclobdell 0:03c15e688f62 48 Image: ./BUILD/K64F/GCC_ARM/mbed-os-example-blinky.bin
maclobdell 0:03c15e688f62 49 ```
maclobdell 0:03c15e688f62 50
maclobdell 0:03c15e688f62 51 ### Program your board
maclobdell 0:03c15e688f62 52
maclobdell 0:03c15e688f62 53 1. Connect your Mbed device to the computer over USB.
maclobdell 0:03c15e688f62 54 1. Copy the binary file to the Mbed device.
maclobdell 0:03c15e688f62 55 1. Press the reset button to start the program.
maclobdell 0:03c15e688f62 56
maclobdell 0:03c15e688f62 57 The LED on your platform turns on and off. The main thread will additionally take a snapshot of the device's runtime statistics and display it over serial to your PC. The snapshot includes:
maclobdell 0:03c15e688f62 58
maclobdell 0:03c15e688f62 59 * System Information:
maclobdell 0:03c15e688f62 60 * Mbed OS Version: Will currently default to 999999
maclobdell 0:03c15e688f62 61 * Compiler ID
maclobdell 0:03c15e688f62 62 * ARM = 1
maclobdell 0:03c15e688f62 63 * GCC_ARM = 2
maclobdell 0:03c15e688f62 64 * IAR = 3
maclobdell 0:03c15e688f62 65 * [CPUID Register Information](#cpuid-register-information)
maclobdell 0:03c15e688f62 66 * [Compiler Version](#compiler-version)
maclobdell 0:03c15e688f62 67 * CPU Statistics
maclobdell 0:03c15e688f62 68 * Percentage of runtime that the device has spent awake versus in sleep
maclobdell 0:03c15e688f62 69 * Heap Statistics
maclobdell 0:03c15e688f62 70 * Current heap size
maclobdell 0:03c15e688f62 71 * Max heap size which refers to the largest the heap has grown to
maclobdell 0:03c15e688f62 72 * Thread Statistics
maclobdell 0:03c15e688f62 73 * Provides information on all running threads in the OS including
maclobdell 0:03c15e688f62 74 * Thread ID
maclobdell 0:03c15e688f62 75 * Thread Name
maclobdell 0:03c15e688f62 76 * Thread State
maclobdell 0:03c15e688f62 77 * Thread Priority
maclobdell 0:03c15e688f62 78 * Thread Stack Size
maclobdell 0:03c15e688f62 79 * Thread Stack Space
maclobdell 0:03c15e688f62 80
maclobdell 0:03c15e688f62 81 #### Compiler Version
maclobdell 0:03c15e688f62 82
maclobdell 0:03c15e688f62 83 | Compiler | Version Layout |
maclobdell 0:03c15e688f62 84 | -------- | -------------- |
maclobdell 0:03c15e688f62 85 | ARM | PVVbbbb (P = Major; VV = Minor; bbbb = build number) |
maclobdell 0:03c15e688f62 86 | GCC | VVRRPP (VV = Version; RR = Revision; PP = Patch) |
maclobdell 0:03c15e688f62 87 | IAR | VRRRPPP (V = Version; RRR = Revision; PPP = Patch) |
maclobdell 0:03c15e688f62 88
maclobdell 0:03c15e688f62 89 #### CPUID Register Information
maclobdell 0:03c15e688f62 90
maclobdell 0:03c15e688f62 91 | Bit Field | Field Description | Values |
maclobdell 0:03c15e688f62 92 | --------- | ----------------- | ------ |
maclobdell 0:03c15e688f62 93 |[31:24] | Implementer | 0x41 = ARM |
maclobdell 0:03c15e688f62 94 |[23:20] | Variant | Major revision 0x0 = Revision 0 |
maclobdell 0:03c15e688f62 95 |[19:16] | Architecture | 0xC = Baseline Architecture |
maclobdell 0:03c15e688f62 96 | | | 0xF = Constant (Mainline Architecture) |
maclobdell 0:03c15e688f62 97 |[15:4] | Part Number | 0xC20 = Cortex-M0 |
maclobdell 0:03c15e688f62 98 | | | 0xC60 = Cortex-M0+ |
maclobdell 0:03c15e688f62 99 | | | 0xC23 = Cortex-M3 |
maclobdell 0:03c15e688f62 100 | | | 0xC24 = Cortex-M4 |
maclobdell 0:03c15e688f62 101 | | | 0xC27 = Cortex-M7 |
maclobdell 0:03c15e688f62 102 | | | 0xD20 = Cortex-M23 |
maclobdell 0:03c15e688f62 103 | | | 0xD21 = Cortex-M33 |
maclobdell 0:03c15e688f62 104 |[3:0] | Revision | Minor revision: 0x1 = Patch 1 |
maclobdell 0:03c15e688f62 105
maclobdell 0:03c15e688f62 106
maclobdell 0:03c15e688f62 107
maclobdell 0:03c15e688f62 108 You can view individual examples and additional API information of the statistics collection tools at the bottom of the page in the [related links section](#related-links).
maclobdell 0:03c15e688f62 109
maclobdell 0:03c15e688f62 110
maclobdell 0:03c15e688f62 111 ### Output
maclobdell 0:03c15e688f62 112
maclobdell 0:03c15e688f62 113 To view the serial output you can use any terminal client of your choosing such as [PuTTY](http://www.putty.org/) or [CoolTerm](http://freeware.the-meiers.org/). Unless otherwise specified, printf defaults to a baud rate of 9600 on Mbed OS.
maclobdell 0:03c15e688f62 114
maclobdell 0:03c15e688f62 115 You can find more information on the Mbed OS configuration tools and serial communication in Mbed OS in the related [related links section](#related-links).
maclobdell 0:03c15e688f62 116
maclobdell 0:03c15e688f62 117 The output should contain the following block transmitted at the blinking LED frequency (actual values may vary depending on your target, build profile, and toolchain):
maclobdell 0:03c15e688f62 118
maclobdell 0:03c15e688f62 119 ```
maclobdell 0:03c15e688f62 120 =============================== SYSTEM INFO ================================
maclobdell 0:03c15e688f62 121 Mbed OS Version: 999999
maclobdell 0:03c15e688f62 122 CPU ID: 0x410fc241
maclobdell 0:03c15e688f62 123 Compiler ID: 2
maclobdell 0:03c15e688f62 124 Compiler Version: 60300
maclobdell 0:03c15e688f62 125 RAM0: Start 0x20000000 Size: 0x30000
maclobdell 0:03c15e688f62 126 RAM1: Start 0x1fff0000 Size: 0x10000
maclobdell 0:03c15e688f62 127 ROM0: Start 0x0 Size: 0x100000
maclobdell 0:03c15e688f62 128 ================= CPU STATS =================
maclobdell 0:03c15e688f62 129 Idle: 98% Usage: 2%
maclobdell 0:03c15e688f62 130 ================ HEAP STATS =================
maclobdell 0:03c15e688f62 131 Current heap: 1096
maclobdell 0:03c15e688f62 132 Max heap size: 1096
maclobdell 0:03c15e688f62 133 ================ THREAD STATS ===============
maclobdell 0:03c15e688f62 134 ID: 0x20001eac
maclobdell 0:03c15e688f62 135 Name: main_thread
maclobdell 0:03c15e688f62 136 State: 2
maclobdell 0:03c15e688f62 137 Priority: 24
maclobdell 0:03c15e688f62 138 Stack Size: 4096
maclobdell 0:03c15e688f62 139 Stack Space: 3296
maclobdell 0:03c15e688f62 140
maclobdell 0:03c15e688f62 141 ID: 0x20000f5c
maclobdell 0:03c15e688f62 142 Name: idle_thread
maclobdell 0:03c15e688f62 143 State: 1
maclobdell 0:03c15e688f62 144 Priority: 1
maclobdell 0:03c15e688f62 145 Stack Size: 512
maclobdell 0:03c15e688f62 146 Stack Space: 352
maclobdell 0:03c15e688f62 147
maclobdell 0:03c15e688f62 148 ID: 0x20000f18
maclobdell 0:03c15e688f62 149 Name: timer_thread
maclobdell 0:03c15e688f62 150 State: 3
maclobdell 0:03c15e688f62 151 Priority: 40
maclobdell 0:03c15e688f62 152 Stack Size: 768
maclobdell 0:03c15e688f62 153 Stack Space: 664
maclobdell 0:03c15e688f62 154
maclobdell 0:03c15e688f62 155 ```
maclobdell 0:03c15e688f62 156
maclobdell 0:03c15e688f62 157 ## Troubleshooting
maclobdell 0:03c15e688f62 158
maclobdell 0:03c15e688f62 159 If you have problems, you can review the [documentation](https://os.mbed.com/docs/latest/tutorials/debugging.html) for suggestions on what could be wrong and how to fix it.
maclobdell 0:03c15e688f62 160
maclobdell 0:03c15e688f62 161 ## Related Links
maclobdell 0:03c15e688f62 162
maclobdell 0:03c15e688f62 163 * [Mbed OS Stats API](https://os.mbed.com/docs/latest/apis/mbed-statistics.html)
maclobdell 0:03c15e688f62 164 * [Mbed OS Configuration](https://os.mbed.com/docs/latest/reference/configuration.html)
maclobdell 0:03c15e688f62 165 * [Mbed OS Serial Communication](https://os.mbed.com/docs/latest/tutorials/serial-communication.html)
maclobdell 0:03c15e688f62 166
maclobdell 0:03c15e688f62 167 ### License and contributions
maclobdell 0:03c15e688f62 168
maclobdell 0:03c15e688f62 169 The software is provided under Apache-2.0 license. Contributions to this project are accepted under the same license. Please see contributing.md for more info.
maclobdell 0:03c15e688f62 170
maclobdell 0:03c15e688f62 171 This project contains code from other projects. The original license text is included in those source files. They must comply with our license guide.