A test for vescs

Committer:
DunkelAmber
Date:
Sat Jun 15 09:31:22 2019 +0000
Revision:
2:12431dd6475f
Parent:
0:0da0fd430e20
feat: itocan supports template

Who changed what in which revision?

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