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