finalllll

Dependencies:   WS2812 PixelArray

Committer:
kimhyunjun
Date:
Sat Jun 15 14:50:08 2019 +0000
Revision:
1:83eda163ee02
Parent:
0:d5a426cc7a0a
a

Who changed what in which revision?

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