t6est

Dependencies:   Pulse

Committer:
kazuryu
Date:
Sat Oct 05 01:41:37 2019 +0000
Revision:
4:9ba47e5db1e2
Parent:
0:3dc012104243
B

Who changed what in which revision?

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