VL53L1X-MAX

Committer:
peng103617
Date:
Tue Oct 22 05:47:05 2019 +0000
Revision:
0:385e286b830a
MAX

Who changed what in which revision?

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