SKT Cat.M1(BG96) ThingPlug Example

Committer:
jehoon
Date:
Wed Mar 27 07:28:00 2019 +0000
Revision:
4:d6f14b70d8aa
Parent:
0:5cd6077e0a8e
SKT Cat.M1 BG96 ThingPlug Example

Who changed what in which revision?

UserRevisionLine numberNew contents of line
hkjung 0:5cd6077e0a8e 1 # Getting started example for Mbed OS
hkjung 0:5cd6077e0a8e 2
hkjung 0:5cd6077e0a8e 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).)
hkjung 0:5cd6077e0a8e 4
hkjung 0:5cd6077e0a8e 5 Please install [Mbed CLI](https://github.com/ARMmbed/mbed-cli#installing-mbed-cli).
hkjung 0:5cd6077e0a8e 6
hkjung 0:5cd6077e0a8e 7 ## Import the example application
hkjung 0:5cd6077e0a8e 8
hkjung 0:5cd6077e0a8e 9 From the command-line, import the example:
hkjung 0:5cd6077e0a8e 10
hkjung 0:5cd6077e0a8e 11 ```
hkjung 0:5cd6077e0a8e 12 mbed import mbed-os-example-blinky
hkjung 0:5cd6077e0a8e 13 cd mbed-os-example-blinky
hkjung 0:5cd6077e0a8e 14 ```
hkjung 0:5cd6077e0a8e 15
hkjung 0:5cd6077e0a8e 16 ### Now compile
hkjung 0:5cd6077e0a8e 17
hkjung 0:5cd6077e0a8e 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:
hkjung 0:5cd6077e0a8e 19
hkjung 0:5cd6077e0a8e 20 ```
hkjung 0:5cd6077e0a8e 21 mbed compile -m K64F -t ARM
hkjung 0:5cd6077e0a8e 22 ```
hkjung 0:5cd6077e0a8e 23
hkjung 0:5cd6077e0a8e 24 Your PC may take a few minutes to compile your code. At the end, you see the following result:
hkjung 0:5cd6077e0a8e 25
hkjung 0:5cd6077e0a8e 26 ```
hkjung 0:5cd6077e0a8e 27 [snip]
hkjung 0:5cd6077e0a8e 28 +----------------------------+-------+-------+------+
hkjung 0:5cd6077e0a8e 29 | Module | .text | .data | .bss |
hkjung 0:5cd6077e0a8e 30 |--------------------|-----------|----------|----------|
hkjung 0:5cd6077e0a8e 31 | [fill] | 98(+0) | 0(+0) | 2211(+0) |
hkjung 0:5cd6077e0a8e 32 | [lib]/c.a | 27835(+0) | 2472(+0) | 89(+0) |
hkjung 0:5cd6077e0a8e 33 | [lib]/gcc.a | 3168(+0) | 0(+0) | 0(+0) |
hkjung 0:5cd6077e0a8e 34 | [lib]/misc | 248(+0) | 8(+0) | 28(+0) |
hkjung 0:5cd6077e0a8e 35 | [lib]/nosys.a | 32(+0) | 0(+0) | 0(+0) |
hkjung 0:5cd6077e0a8e 36 | main.o | 924(+0) | 0(+0) | 12(+0) |
hkjung 0:5cd6077e0a8e 37 | mbed-os/components | 134(+0) | 0(+0) | 0(+0) |
hkjung 0:5cd6077e0a8e 38 | mbed-os/drivers | 56(+0) | 0(+0) | 0(+0) |
hkjung 0:5cd6077e0a8e 39 | mbed-os/features | 42(+0) | 0(+0) | 184(+0) |
hkjung 0:5cd6077e0a8e 40 | mbed-os/hal | 2087(+0) | 8(+0) | 152(+0) |
hkjung 0:5cd6077e0a8e 41 | mbed-os/platform | 3633(+0) | 260(+0) | 209(+0) |
hkjung 0:5cd6077e0a8e 42 | mbed-os/rtos | 9370(+0) | 168(+0) | 6053(+0) |
hkjung 0:5cd6077e0a8e 43 | mbed-os/targets | 9536(+0) | 12(+0) | 382(+0) |
hkjung 0:5cd6077e0a8e 44 | Subtotals | 57163(+0) | 2928(+0) | 9320(+0) |
hkjung 0:5cd6077e0a8e 45 Total Static RAM memory (data + bss): 12248(+0) bytes
hkjung 0:5cd6077e0a8e 46 Total Flash memory (text + data): 60091(+0) bytes
hkjung 0:5cd6077e0a8e 47
hkjung 0:5cd6077e0a8e 48 Image: ./BUILD/K64F/GCC_ARM/mbed-os-example-blinky.bin
hkjung 0:5cd6077e0a8e 49 ```
hkjung 0:5cd6077e0a8e 50
hkjung 0:5cd6077e0a8e 51 ### Program your board
hkjung 0:5cd6077e0a8e 52
hkjung 0:5cd6077e0a8e 53 1. Connect your Mbed device to the computer over USB.
hkjung 0:5cd6077e0a8e 54 1. Copy the binary file to the Mbed device.
hkjung 0:5cd6077e0a8e 55 1. Press the reset button to start the program.
hkjung 0:5cd6077e0a8e 56
hkjung 0:5cd6077e0a8e 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:
hkjung 0:5cd6077e0a8e 58
hkjung 0:5cd6077e0a8e 59 * System Information:
hkjung 0:5cd6077e0a8e 60 * Mbed OS Version: Will currently default to 999999
hkjung 0:5cd6077e0a8e 61 * Compiler ID
hkjung 0:5cd6077e0a8e 62 * ARM = 1
hkjung 0:5cd6077e0a8e 63 * GCC_ARM = 2
hkjung 0:5cd6077e0a8e 64 * IAR = 3
hkjung 0:5cd6077e0a8e 65 * [CPUID Register Information](#cpuid-register-information)
hkjung 0:5cd6077e0a8e 66 * [Compiler Version](#compiler-version)
hkjung 0:5cd6077e0a8e 67 * CPU Statistics
hkjung 0:5cd6077e0a8e 68 * Percentage of runtime that the device has spent awake versus in sleep
hkjung 0:5cd6077e0a8e 69 * Heap Statistics
hkjung 0:5cd6077e0a8e 70 * Current heap size
hkjung 0:5cd6077e0a8e 71 * Max heap size which refers to the largest the heap has grown to
hkjung 0:5cd6077e0a8e 72 * Thread Statistics
hkjung 0:5cd6077e0a8e 73 * Provides information on all running threads in the OS including
hkjung 0:5cd6077e0a8e 74 * Thread ID
hkjung 0:5cd6077e0a8e 75 * Thread Name
hkjung 0:5cd6077e0a8e 76 * Thread State
hkjung 0:5cd6077e0a8e 77 * Thread Priority
hkjung 0:5cd6077e0a8e 78 * Thread Stack Size
hkjung 0:5cd6077e0a8e 79 * Thread Stack Space
hkjung 0:5cd6077e0a8e 80
hkjung 0:5cd6077e0a8e 81 #### Compiler Version
hkjung 0:5cd6077e0a8e 82
hkjung 0:5cd6077e0a8e 83 | Compiler | Version Layout |
hkjung 0:5cd6077e0a8e 84 | -------- | -------------- |
hkjung 0:5cd6077e0a8e 85 | ARM | PVVbbbb (P = Major; VV = Minor; bbbb = build number) |
hkjung 0:5cd6077e0a8e 86 | GCC | VVRRPP (VV = Version; RR = Revision; PP = Patch) |
hkjung 0:5cd6077e0a8e 87 | IAR | VRRRPPP (V = Version; RRR = Revision; PPP = Patch) |
hkjung 0:5cd6077e0a8e 88
hkjung 0:5cd6077e0a8e 89 #### CPUID Register Information
hkjung 0:5cd6077e0a8e 90
hkjung 0:5cd6077e0a8e 91 | Bit Field | Field Description | Values |
hkjung 0:5cd6077e0a8e 92 | --------- | ----------------- | ------ |
hkjung 0:5cd6077e0a8e 93 |[31:24] | Implementer | 0x41 = ARM |
hkjung 0:5cd6077e0a8e 94 |[23:20] | Variant | Major revision 0x0 = Revision 0 |
hkjung 0:5cd6077e0a8e 95 |[19:16] | Architecture | 0xC = Baseline Architecture |
hkjung 0:5cd6077e0a8e 96 | | | 0xF = Constant (Mainline Architecture) |
hkjung 0:5cd6077e0a8e 97 |[15:4] | Part Number | 0xC20 = Cortex-M0 |
hkjung 0:5cd6077e0a8e 98 | | | 0xC60 = Cortex-M0+ |
hkjung 0:5cd6077e0a8e 99 | | | 0xC23 = Cortex-M3 |
hkjung 0:5cd6077e0a8e 100 | | | 0xC24 = Cortex-M4 |
hkjung 0:5cd6077e0a8e 101 | | | 0xC27 = Cortex-M7 |
hkjung 0:5cd6077e0a8e 102 | | | 0xD20 = Cortex-M23 |
hkjung 0:5cd6077e0a8e 103 | | | 0xD21 = Cortex-M33 |
hkjung 0:5cd6077e0a8e 104 |[3:0] | Revision | Minor revision: 0x1 = Patch 1 |
hkjung 0:5cd6077e0a8e 105
hkjung 0:5cd6077e0a8e 106
hkjung 0:5cd6077e0a8e 107
hkjung 0:5cd6077e0a8e 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).
hkjung 0:5cd6077e0a8e 109
hkjung 0:5cd6077e0a8e 110
hkjung 0:5cd6077e0a8e 111 ### Output
hkjung 0:5cd6077e0a8e 112
hkjung 0:5cd6077e0a8e 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.
hkjung 0:5cd6077e0a8e 114
hkjung 0:5cd6077e0a8e 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).
hkjung 0:5cd6077e0a8e 116
hkjung 0:5cd6077e0a8e 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):
hkjung 0:5cd6077e0a8e 118
hkjung 0:5cd6077e0a8e 119 ```
hkjung 0:5cd6077e0a8e 120 =============================== SYSTEM INFO ================================
hkjung 0:5cd6077e0a8e 121 Mbed OS Version: 999999
hkjung 0:5cd6077e0a8e 122 CPU ID: 0x410fc241
hkjung 0:5cd6077e0a8e 123 Compiler ID: 2
hkjung 0:5cd6077e0a8e 124 Compiler Version: 60300
hkjung 0:5cd6077e0a8e 125 RAM0: Start 0x20000000 Size: 0x30000
hkjung 0:5cd6077e0a8e 126 RAM1: Start 0x1fff0000 Size: 0x10000
hkjung 0:5cd6077e0a8e 127 ROM0: Start 0x0 Size: 0x100000
hkjung 0:5cd6077e0a8e 128 ================= CPU STATS =================
hkjung 0:5cd6077e0a8e 129 Idle: 98% Usage: 2%
hkjung 0:5cd6077e0a8e 130 ================ HEAP STATS =================
hkjung 0:5cd6077e0a8e 131 Current heap: 1096
hkjung 0:5cd6077e0a8e 132 Max heap size: 1096
hkjung 0:5cd6077e0a8e 133 ================ THREAD STATS ===============
hkjung 0:5cd6077e0a8e 134 ID: 0x20001eac
hkjung 0:5cd6077e0a8e 135 Name: main_thread
hkjung 0:5cd6077e0a8e 136 State: 2
hkjung 0:5cd6077e0a8e 137 Priority: 24
hkjung 0:5cd6077e0a8e 138 Stack Size: 4096
hkjung 0:5cd6077e0a8e 139 Stack Space: 3296
hkjung 0:5cd6077e0a8e 140
hkjung 0:5cd6077e0a8e 141 ID: 0x20000f5c
hkjung 0:5cd6077e0a8e 142 Name: idle_thread
hkjung 0:5cd6077e0a8e 143 State: 1
hkjung 0:5cd6077e0a8e 144 Priority: 1
hkjung 0:5cd6077e0a8e 145 Stack Size: 512
hkjung 0:5cd6077e0a8e 146 Stack Space: 352
hkjung 0:5cd6077e0a8e 147
hkjung 0:5cd6077e0a8e 148 ID: 0x20000f18
hkjung 0:5cd6077e0a8e 149 Name: timer_thread
hkjung 0:5cd6077e0a8e 150 State: 3
hkjung 0:5cd6077e0a8e 151 Priority: 40
hkjung 0:5cd6077e0a8e 152 Stack Size: 768
hkjung 0:5cd6077e0a8e 153 Stack Space: 664
hkjung 0:5cd6077e0a8e 154
hkjung 0:5cd6077e0a8e 155 ```
hkjung 0:5cd6077e0a8e 156
hkjung 0:5cd6077e0a8e 157 ## Troubleshooting
hkjung 0:5cd6077e0a8e 158
hkjung 0:5cd6077e0a8e 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.
hkjung 0:5cd6077e0a8e 160
hkjung 0:5cd6077e0a8e 161 ## Related Links
hkjung 0:5cd6077e0a8e 162
hkjung 0:5cd6077e0a8e 163 * [Mbed OS Stats API](https://os.mbed.com/docs/latest/apis/mbed-statistics.html)
hkjung 0:5cd6077e0a8e 164 * [Mbed OS Configuration](https://os.mbed.com/docs/latest/reference/configuration.html)
hkjung 0:5cd6077e0a8e 165 * [Mbed OS Serial Communication](https://os.mbed.com/docs/latest/tutorials/serial-communication.html)
hkjung 0:5cd6077e0a8e 166
hkjung 0:5cd6077e0a8e 167 ### License and contributions
hkjung 0:5cd6077e0a8e 168
hkjung 0:5cd6077e0a8e 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.
hkjung 0:5cd6077e0a8e 170
hkjung 0:5cd6077e0a8e 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.