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