Josh Davy / Mbed OS MUSIC_K64F
Committer:
joshdavy
Date:
Mon Jul 22 14:45:38 2019 +0000
Revision:
0:d7214673ab2d
a

Who changed what in which revision?

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