LED effects demo for LPC1768 using version 5 RTOS Details at https://os.mbed.com/users/4180_1/notebook/led-lighting-effects-for-modelers/ - NOTE: Requires firmware update for proper wait times

Committer:
4180_1
Date:
Fri Sep 06 12:42:09 2019 +0000
Revision:
0:4087d19c8e7b
ver 1.0

Who changed what in which revision?

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