STmicro HAL driver DMA.

Committer:
aruaru
Date:
Mon Apr 08 13:53:14 2019 +0000
Revision:
0:96568f3ac645
Child:
2:9d67e2b0d96b
dam in out works.

Who changed what in which revision?

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