yuki makura / Mbed 2 deprecated 2018_wamv_sw_panel

Dependencies:   mbed mbed-rtos EthernetInterface

Committer:
yukisega
Date:
Mon Dec 10 20:26:49 2018 +0000
Branch:
add_TCP_Socket
Revision:
3:791851ed2989
Parent:
0:e894a0665114
fix start thread

Who changed what in which revision?

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