erweitert um RGB LED

Committer:
corsa1600
Date:
Tue Apr 02 18:07:35 2019 +0000
Revision:
1:dc7c5869f9e1
Parent:
0:f0345f20337e
LED_Blink

Who changed what in which revision?

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