prima prova bracctio

Dependencies:   Eigen MX64_senzaCorrente

Committer:
anfontanelli
Date:
Mon Nov 18 17:50:32 2019 +0000
Revision:
0:82a5f03b7eb4
arm created

Who changed what in which revision?

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