test

Committer:
kstokely
Date:
Mon Mar 25 19:37:05 2019 +0000
Revision:
0:50a0fdd7f221
test os program

Who changed what in which revision?

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