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