my

Dependencies:   QEI BNO055 ros_lib_kinetic

Committer:
fllay
Date:
Thu Aug 01 17:10:38 2019 +0000
Revision:
0:ae2e2cabc497
fa

Who changed what in which revision?

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