this works for reading in data from pi via usb

Committer:
mbed_official
Date:
Tue Jan 08 12:45:03 2019 +0000
Revision:
88:bea4f2daa48c
Parent:
85:b4c5dbbf74e3
Child:
89:448e37ce650a
Merge pull request #155 from deepikabhavnani/print_fix

Set the baudrate to default and reduce prints in blinky
.
Commit copied from https://github.com/ARMmbed/mbed-os-example-blinky

Who changed what in which revision?

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