the lastest code by Castle. 27 Nov

Dependencies:   mpu9250_i2c biquadFilter PCA peakdetection Eigen

Committer:
castlefei
Date:
Wed Nov 27 19:55:17 2019 +0000
Revision:
7:48551ff94ea5
Parent:
0:44701eab0261
the lastest vsion 27.Nov by Castle

Who changed what in which revision?

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