asdf

Dependencies:   Adafruit_BNO055

Committer:
abraha2d
Date:
Thu Mar 14 17:54:00 2019 +0000
Revision:
0:8103e7288014
asdf

Who changed what in which revision?

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