Adding ICM-20948

Dependencies:   IMU HighGAccel

Committer:
alouisrogers
Date:
Fri Feb 01 00:27:29 2019 +0000
Revision:
0:e56a9ab74495
IMU

Who changed what in which revision?

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