Skip to content

Commit 4ecb703

Browse files
committed
7.4.0
added cmsis-packs examples
1 parent dc54aac commit 4ecb703

File tree

136 files changed

+44469
-184
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

136 files changed

+44469
-184
lines changed

arm-cm/dpp_nucleo-u545re/README.md

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
> **NOTE**
2+
This file is best viewed in a **markdown viewer**, such as the one built into GitHub. Markdown viewers are also available as plug-ins to popular Internet browsers.
3+
4+
# DPP on NUCLEO-C031C6
5+
This example demonstrates the [Dining Philosophers Problem (DPP) application](https://www.state-machine.com/qpc/tut_dpp.html) on the STM32 NUCLEO-C031C6 board (ARM Cortex-M0+).
6+
7+
<p align="center">
8+
<img src="./stm32-nucleo-c031c6.jpg"/><br>
9+
<b>STM32 NUCLEO-C031C6</b>
10+
</p>
11+
12+
> **NOTE**
13+
This example can be used as a starting point for any other ARM Cortex-M MCU, including those based on different Cortex-M cores (M0/M0+/M3/M4/M7/M23/M33/M55/M85...) The most simplifying factor is that the QP-ports to Cortex-M don't need to change at all (the correct port is selected automatically based on the standard preprocessor macros provided by the compiler).
14+
15+
<p align="center">
16+
<img src="../qp_arm-cm.jpg"/>
17+
</p>
18+
19+
## Features Demonstrated
20+
- multiple cooperating active objects
21+
- immutable (const) events
22+
- mutable (dynamic) events
23+
- time events
24+
- direct event posting
25+
- publish-subscribe event delivery
26+
- cooperative QV kernel
27+
+ with ARM-KEIL toolchain
28+
+ with GNU-ARM toolchain
29+
+ with IAR-ARM toolchain
30+
- preemptive run-to-completion QK kernel
31+
+ with ARM-KEIL toolchain
32+
+ with GNU-ARM toolchain
33+
+ with IAR-ARM toolchain
34+
- preemptive dual-mode QXK kernel
35+
+ with ARM-KEIL toolchain
36+
+ with GNU-ARM toolchain
37+
+ with IAR-ARM toolchain
38+
39+
## Build Configurations
40+
- Debug
41+
- Release
42+
- Spy - software tracing with the built-in virtual COM port
43+
44+
# Code Organization
45+
```
46+
examples\arm-cm\dpp_nucleo-c031c6
47+
|
48+
+---qk // preemptive QK kernel
49+
| +---gnu // GNU-ARM toolchain
50+
| | \---targetConfigs
51+
| | Makefile // Makefile for GNU-ARM
52+
| +---armclang // ARM/KEIL toolchain with Compiler 6 (ARM/CLANG)
53+
| | dpp-qk.uvprojx // uVision project
54+
| \---iar // IAR EWARM
55+
| dpp-qk.eww // IAR EW-ARM workspace
56+
|
57+
\---qv // cooperative QK kernel
58+
| +---gnu // GNU-ARM toolchain
59+
| | \---targetConfigs
60+
| | Makefile // Makefile for GNU-ARM
61+
| +---armclang // ARM/KEIL toolchain with Compiler 6 (ARM/CLANG)
62+
| | dpp-qv.uvprojx // uVision project
63+
| \---iar // IAR EWARM
64+
| dpp-qv.eww // IAR EW-ARM workspace
65+
|
66+
+---qxk // preemptive, dual-mode QXK kernel
67+
| +---gnu // GNU-ARM toolchain
68+
| | \---targetConfigs
69+
| | Makefile // Makefile for GNU-ARM
70+
| +---armclang // ARM/KEIL toolchain with Compiler 6 (ARM/CLANG)
71+
| | dpp-qxk.uvprojx // uVision project
72+
| \---iar // IAR EWARM
73+
| dpp-qxk.eww // IAR EW-ARM workspace
74+
|
75+
```
76+
77+
# Building the example
78+
79+
### GNU/ARM
80+
- open terminal window
81+
- change to the desired directory (either `examples\arm-cm\dpp_nucleo-c031c6\qk\gnu`, `examples\arm-cm\dpp_nucleo-c031c6\qv\gnu`, or `examples\arm-cm\dpp_nucleo-c031c6\qxk\gnu`)
82+
- to build the default Debug configuration, type:
83+
84+
```
85+
make
86+
```
87+
88+
> **NOTE**
89+
The `make` utility for Windows is provided in the QTools collection for Windows.
90+
91+
- to build the Release configuration, type:
92+
93+
```
94+
make CONF=rel
95+
```
96+
97+
- to build the Spy configuration, type:
98+
99+
```
100+
make CONF=spy
101+
```
102+
103+
104+
### ARM/KEIL MDK
105+
- Open the provided KEIL uVision project (either `dpp-qk.uvprojx`, `dpp-qv.uvprojx`, or `dpp-qxk.uvprojx`)
106+
in Keil uVision IDE. Build/Debug/Download to the board from the IDE.
107+
- Change the build configuration in the "Project Target" drop-down menu.
108+
109+
110+
### IAR EWARM
111+
- Open the provided IAR EWARM workspace (either `dpp-qk.eww`, `dpp-qv.eww`, or `dpp-qxk.eww`)
112+
in IAR EWARM IDE. Build/Debug/Download to the board from the IDE.
113+
- Change the build configuration in the "Project Configuration" drop-down menu.
114+
115+
116+
# Uploading the Binary to the Board
117+
The STM32 NUCLEO boards enumerate as a USB drive when connected to the host computer. The boards then can be programmed by **copying** the binary to that USB drive. This can be useful for the command-line GNU/ARM build. For example, to program the binary produced for the Debug configuration, you can type:
118+
119+
```
120+
copy dbg\dpp-qk.bin E:
121+
```
122+
NOTE: The above command assumes that the NUCLEO board enumerated as drive E:. Of course you need to adjust the command for your specific drive letter.
123+
124+
Alternatively, if you use IDEs, such as KEIL-MDK or IAR EWARM, you can program the board from the IDE (e.g., by starting a debug session).
125+
126+
127+
# Tracing with QP/Spy
128+
When the board is flashed with the Spy build configuration, it produces the QP/Spy software tracing output to the built-in virtual COM port of the TivaC LauchPad board. The trace is binary rather than ASCII, and therefore requires a special host-based application called QSPY.
129+
130+
> **NOTE** QSPY host application is available in the QTools collection.
131+
132+
To launch the QSPY host application:
133+
- open terminal window
134+
- type:
135+
136+
```
137+
qspy -c COM5
138+
```
139+
140+
where "COM5" is an example virtual COM port enumerated by the board. You need to check the specific COM port number on your host computer using the Device Manager application, Ports (COM and LPT) section.
141+
142+
143+
The following screen shot shows a typical output from QSPY:
144+
145+
<p align="center">
146+
<img src="./qspy-output.png"/><br>
147+
<b>Typical QSPY output produced by the Spy build configuration</b>
148+
</p>
149+
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
About this Example
2+
==================
3+
This example demonstrates how to use the uVision IDE together with
4+
the MDK-ARM toolchain.
5+
6+
***
7+
NOTE: This example requires installing the following Software Pack
8+
in the Keil uVision: Keil::STM32C0xx_DFP.
9+
***
10+
11+
uVision Project File
12+
====================
13+
The MDK-ARM uVision project file provided with this example uses
14+
relative paths to the QP/C framework location (includes, port, and
15+
libraries. These relative paths must be modified when the project
16+
is moved to different relative location.
17+
18+
19+
Adjusting Stack and Heap Sizes
20+
==============================
21+
The stack and heap sizes are determined in this project by the
22+
command-line options for the ARM assembler (see the Asm tab in
23+
the "Options for Target" dialog box in uVision). Specifically,
24+
you should define symbols: Stack_Size=xxx Heap_Size=yyy, where
25+
xxx represents a numerical value of stack size and yyy the
26+
numerical value of the heap size.
27+
28+
29+
Selecting QK Exception
30+
======================
31+
The QK kernel needs a dedicated exception to return to the thread
32+
context after preemption. The default is to use the NMI exception
33+
for that purpose. However, in case NMI is needed for some other
34+
purpose, the QK port allows you to select a any, otherwise unused
35+
IRQ for that purpose. To choose a given IRQ, you need to define
36+
the macros QK_USE_IRQ_NUM and QK_USE_IRQ_HANDLER. These macros can
37+
be provided on the command-line to the compiler.
38+
39+
For example, (see the vector table), you can define the QK IRQ
40+
as follows:
41+
42+
QK_USE_IRQ_HANDLER=Reserved31_IRQHandler
43+
QK_USE_IRQ_NUM=31
44+
45+
46+
Startup Code
47+
============
48+
The startup code for the STM32C0xx MCU used in this project is
49+
located in the "3rd_party" folder in the following location:
50+
51+
3rd_party\nucleo-c031c6\arm\startup_stm32c031xx.s
52+
53+
The file startup_stm32c031xx.s provides a template of the recommended
54+
startup for QP applications and should be easily customizable for other
55+
ARM Cortex-M microcontrollers.
56+
57+
The startup file typically does not need to be modified or adapted for
58+
applications. It calls the assert_failed() function, which must be
59+
defined in the application to customize it for the application-specific
60+
error-handling policy.
61+
62+
63+
Adjusting the CPU Clock Speed
64+
=============================
65+
The current setting is to run at 12MHz from the MSI (internal oscillator),
66+
but the CPU clock speed can be modified.
67+
68+
***
69+
NOTE:
70+
The NUCLEO boards have a wide range of possible clock selections, depending
71+
on the solder bridge configuration. Please see Chapter 5.7 "OSC clock" in
72+
the STM32 NUCLEO Boards User Manual (ST document UM1724) for more information.
73+
***
74+
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
; *************************************************************
2+
; *** Scatter-Loading Description File generated by uVision ***
3+
;
4+
; Adapted by Quantum Leaps:
5+
; added STACK as the first section in RW_STACK
6+
; *************************************************************
7+
8+
LR_IROM1 0x08000000 0x00080000 { ; load region size_region
9+
ER_IROM1 0x08000000 0x00080000 { ; load address = execution address
10+
*.o (RESET, +First)
11+
*(InRoot$$Sections)
12+
.ANY (+RO)
13+
.ANY (+XO)
14+
}
15+
RW_IRAM1 0x20000000 0x00040000 { ; RW data
16+
.ANY (+RW +ZI)
17+
}
18+
19+
RW_STACK 0x28000000 { ; STACK area
20+
* (STACK, +First)
21+
}
22+
RW_IRAM2 +0 (0x00004000 - 2048) {
23+
.ANY (+RW +ZI)
24+
}
25+
}
26+

0 commit comments

Comments
 (0)