BG96 Cat.M1 GPS sample for WIZnet IoT Shield

Committer:
hkjung
Date:
Wed Mar 20 05:33:37 2019 +0000
Revision:
0:98226e0983af
Initial Release

Who changed what in which revision?

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