hbjhjb

Dependencies:   mbed X-NUCLEO-IHM05A1

Committer:
gidiana
Date:
Thu Dec 06 16:33:09 2018 +0000
Revision:
12:a34ecb37c03f
update mbed-os;

Who changed what in which revision?

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