2532

Dependencies:   QEI WS2812 PixelArray DFPlayerMini MODSERIAL PCA9685_ pca9685

Committer:
dimavb
Date:
Wed Jun 26 18:06:30 2019 +0000
Revision:
6:4b007c7f0b7a
Parent:
0:474fb16588bf
activation trigger

Who changed what in which revision?

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