test

Committer:
Perijah
Date:
Wed Feb 27 17:02:00 2019 +0000
Revision:
0:1a1d87c75d25
public test

Who changed what in which revision?

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