ECEM119 assignment 2 problem 4

Committer:
natasha41575
Date:
Fri Apr 19 20:03:25 2019 +0000
Revision:
1:eee108fd0b4b
Parent:
0:44f80f935e35
uploading to private repo

Who changed what in which revision?

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