Pulse consistency test using timeouts

Committer:
punkisnail
Date:
Fri May 10 05:50:32 2019 +0000
Revision:
1:290c2f078d43
Parent:
0:18409537564c
Commit 1, Pulse test using timeouts

Who changed what in which revision?

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