Mangue Baja team's code to frontal ECU

Committer:
einsteingustavo
Date:
Wed Jul 24 20:03:52 2019 +0000
Revision:
0:12fb9cbcabcc
Mangue Baja team's code to frontal ECU

Who changed what in which revision?

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