Mangue Baja team's code to rear ECU

Committer:
einsteingustavo
Date:
Wed Jul 24 20:04:55 2019 +0000
Revision:
0:80950b84a6c4
Mangue Baja team's code to rear ECU

Who changed what in which revision?

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