dd

Dependencies:   Final HCSR04 TB6612FNG

Committer:
mbed_official
Date:
Fri Nov 30 23:45:02 2018 +0000
Revision:
83:7b0fac4e7fd2
Parent:
82:abf1b1785bd7
Child:
84:9b22d3bf66f7
Merge pull request #147 from kegilbert/revert-romram-report

Revert RAM/ROM reporting segment, went in after 5.10.4
.
Commit copied from https://github.com/ARMmbed/mbed-os-example-blinky

Who changed what in which revision?

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