Skip to content

Commit 6515610

Browse files
committed
7.1.0
1 parent 1c63248 commit 6515610

File tree

184 files changed

+1965
-2028
lines changed

Some content is hidden

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

184 files changed

+1965
-2028
lines changed

doxygen/history.dox

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,29 @@
11
/*! @page history Revision History
22

3-
@section qpc_7_1_0 Version 7.1.0, 2022-08-30 (planned)
3+
@section qpc_7_1_0 Version 7.1.0, 2022-08-30
44
This QP/C release introduces [<b>preemption-threshold scheduling</b> (PTS)](https://www.state-machine.com/doc/Ghattas07.pdf) for the preemptive QK and QXK kernels. Specifically, it is now possible to limit preemption of a given QActive/QXThread by giving it both the QF-priority and preemption-threshold.
55

66
The following diagram shows the relationship between the "QF-priority" and "preemption-threshold" (see also ::QPrioSpec):
77

88
![QF-priority and preemption-threshold relations](qp-prio.png)
99

10+
__Source__
11+
- modified the QP/C code for preemption-threshold
12+
- improved QS tracing of Scheduler activities in QK and QXK
13+
- improved implementation of QXSemaphore and QXMutex in QXK
14+
15+
__Ports__
16+
- Modified QK and QXK ports to ARM Cortex-M for preemption-threshold and for handling the context-switch callback
17+
- Updated Zephyr port and examples for Zephyr 3.1.99
18+
19+
__Examples__
20+
- Added Q_PRIO() macro for setting QF-priority and preemption-threshold to various examples (in calls to QACTIVE_START())
21+
- increased size of the main stack in most examples from 1024 to 2048 bytes. This is to prevent stack overflow that was observed with the lower limit.
22+
23+
__Testing__
24+
- modified QUTest to also allow testing of the QP framework itself.
25+
26+
1027
@note
1128
For backwards-compatibility, ::QPrioSpec data type might contain only the "QF-priority" component (and the "preemption-threshold" component left at zero). In that case, the "preemption-threshold" will be assumed to be the same as the "QF-priority". This corresponds exactly to the previous semantics of AO priority.
1229

doxygen/metrics.dox

Lines changed: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@
88
3 1 15 1 3 QEQueue_getNFree@306-308@..\include\qequeue.h
99
3 1 15 1 3 QEQueue_getNMin@323-325@..\include\qequeue.h
1010
3 1 21 1 3 QEQueue_isEmpty@342-344@..\include\qequeue.h
11-
5 2 33 1 8 QPSet_setEmpty@190-197@..\include\qf.h
12-
4 3 44 1 7 QPSet_isEmpty@200-206@..\include\qf.h
13-
4 3 44 1 7 QPSet_notEmpty@209-215@..\include\qf.h
14-
8 3 95 2 11 QPSet_hasElement@218-228@..\include\qf.h
15-
11 3 105 2 14 QPSet_insert@231-244@..\include\qf.h
16-
12 3 117 2 15 QPSet_remove@247-261@..\include\qf.h
17-
6 3 56 1 9 QPSet_findMax@264-272@..\include\qf.h
18-
3 1 27 1 3 QActive_getPrio@788-790@..\include\qf.h
19-
6 1 20 2 6 QF_psInit@1412-1417@..\include\qf.h
20-
14 3 67 1 14 QS_rxPut@806-819@..\include\qs.h
11+
5 2 33 1 8 QPSet_setEmpty@240-247@..\include\qf.h
12+
4 3 44 1 7 QPSet_isEmpty@250-256@..\include\qf.h
13+
4 3 44 1 7 QPSet_notEmpty@259-265@..\include\qf.h
14+
8 3 95 2 11 QPSet_hasElement@268-278@..\include\qf.h
15+
11 3 105 2 14 QPSet_insert@281-294@..\include\qf.h
16+
12 3 117 2 15 QPSet_remove@297-311@..\include\qf.h
17+
6 3 56 1 9 QPSet_findMax@314-322@..\include\qf.h
18+
3 1 27 1 3 QActive_getPrio@777-779@..\include\qf.h
19+
6 1 20 2 6 QF_psInit@1401-1406@..\include\qf.h
20+
14 3 67 1 14 QS_rxPut@825-838@..\include\qs.h
2121
5 1 20 1 20 Q_DEFINE_THIS_MODULE@54-73@..\src\qf\qep_hsm.c
2222
18 3 99 2 24 QHsm_isIn@128-151@..\src\qf\qep_hsm.c
2323
3 1 19 1 3 QHsm_state@154-156@..\src\qf\qep_hsm.c
@@ -83,49 +83,49 @@
8383
7 1 30 1 8 QTimeEvt_currCtr@289-296@..\src\qf\qf_time.c
8484
69 7 380 2 110 QTimeEvt_tick_@299-408@..\src\qf\qf_time.c
8585
14 3 75 1 16 QTimeEvt_noActive@411-426@..\src\qf\qf_time.c
86-
64 15 376 1 109 QK_activate_@77-185@..\src\qk\qk.c
87-
15 3 78 1 19 QK_sched_@188-206@..\src\qk\qk.c
88-
21 2 113 1 31 QK_schedLock@209-239@..\src\qk\qk.c
89-
21 4 118 1 33 QK_schedUnlock@242-274@..\src\qk\qk.c
90-
13 2 101 1 21 QF_init@279-299@..\src\qk\qk.c
91-
3 1 10 1 4 QF_stop@302-305@..\src\qk\qk.c
92-
15 4 61 1 25 QF_run@308-332@..\src\qk\qk.c
93-
24 3 151 7 33 QActive_start_@339-371@..\src\qk\qk.c
86+
21 2 112 1 31 QK_schedLock@74-104@..\src\qk\qk.c
87+
21 4 118 1 33 QK_schedUnlock@107-139@..\src\qk\qk.c
88+
12 2 87 1 18 QF_init@144-161@..\src\qk\qk.c
89+
3 1 10 1 4 QF_stop@164-167@..\src\qk\qk.c
90+
15 4 61 1 25 QF_run@170-194@..\src\qk\qk.c
91+
23 3 151 7 32 QActive_start_@201-232@..\src\qk\qk.c
92+
15 3 79 1 19 QK_sched_@237-255@..\src\qk\qk.c
93+
63 15 374 1 108 QK_activate_@258-365@..\src\qk\qk.c
9494
9 2 64 1 13 QF_init@73-85@..\src\qv\qv.c
9595
3 1 10 1 4 QF_stop@88-91@..\src\qv\qv.c
9696
39 9 197 1 76 QF_run@94-169@..\src\qv\qv.c
97-
17 3 115 7 23 QActive_start_@176-198@..\src\qv\qv.c
98-
79 16 506 1 137 QXK_activate_@77-213@..\src\qxk\qxk.c
99-
49 7 280 1 67 QXK_sched_@216-282@..\src\qxk\qxk.c
100-
23 3 132 1 34 QXK_schedLock@285-318@..\src\qxk\qxk.c
101-
20 4 118 1 33 QXK_schedUnlock@321-353@..\src\qxk\qxk.c
102-
12 2 72 1 18 QXK_current@356-373@..\src\qxk\qxk.c
103-
13 2 101 1 21 QF_init@378-398@..\src\qxk\qxk.c
104-
3 1 10 1 4 QF_stop@401-404@..\src\qxk\qxk.c
105-
15 4 61 1 25 QF_run@407-431@..\src\qxk\qxk.c
106-
25 4 162 7 34 QActive_start_@438-471@..\src\qxk\qxk.c
107-
13 2 104 1 23 QXK_threadExit_@477-499@..\src\qxk\qxk.c
108-
10 2 78 2 12 QXMutex_init@74-85@..\src\qxk\qxk_mutex.c
109-
68 10 605 2 120 QXMutex_lock@88-207@..\src\qxk\qxk_mutex.c
110-
46 8 382 1 80 QXMutex_tryLock@210-289@..\src\qxk\qxk_mutex.c
111-
68 12 578 1 125 QXMutex_unlock@292-416@..\src\qxk\qxk_mutex.c
97+
17 1 119 7 24 QActive_start_@176-199@..\src\qv\qv.c
98+
23 3 131 1 34 QXK_schedLock@71-104@..\src\qxk\qxk.c
99+
20 4 118 1 33 QXK_schedUnlock@107-139@..\src\qxk\qxk.c
100+
14 2 116 1 22 QF_init@144-165@..\src\qxk\qxk.c
101+
3 1 10 1 4 QF_stop@168-171@..\src\qxk\qxk.c
102+
15 4 61 1 25 QF_run@174-198@..\src\qxk\qxk.c
103+
25 4 162 7 35 QActive_start_@205-239@..\src\qxk\qxk.c
104+
79 16 497 1 135 QXK_activate_@247-381@..\src\qxk\qxk.c
105+
57 9 318 1 76 QXK_sched_@384-459@..\src\qxk\qxk.c
106+
12 2 72 1 18 QXK_current@462-479@..\src\qxk\qxk.c
107+
13 2 104 1 23 QXK_threadExit_@485-507@..\src\qxk\qxk.c
108+
10 2 74 2 12 QXMutex_init@74-85@..\src\qxk\qxk_mutex.c
109+
81 11 724 2 138 QXMutex_lock@88-225@..\src\qxk\qxk_mutex.c
110+
59 9 502 1 97 QXMutex_tryLock@228-324@..\src\qxk\qxk_mutex.c
111+
78 12 670 1 135 QXMutex_unlock@327-461@..\src\qxk\qxk_mutex.c
112112
9 1 51 3 11 QXSemaphore_init@73-83@..\src\qxk\qxk_sema.c
113-
45 7 319 2 71 QXSemaphore_wait@86-156@..\src\qxk\qxk_sema.c
114-
15 2 61 1 20 QXSemaphore_tryWait@159-178@..\src\qxk\qxk_sema.c
115-
29 6 193 1 47 QXSemaphore_signal@181-227@..\src\qxk\qxk_sema.c
113+
57 7 389 2 85 QXSemaphore_wait@86-170@..\src\qxk\qxk_sema.c
114+
28 3 139 1 39 QXSemaphore_tryWait@173-211@..\src\qxk\qxk_sema.c
115+
42 7 275 1 66 QXSemaphore_signal@214-279@..\src\qxk\qxk_sema.c
116116
21 2 113 3 26 QXThread_ctor@74-99@..\src\qxk\qxk_xthr.c
117117
21 4 195 1 38 QXThread_delay@102-139@..\src\qxk\qxk_xthr.c
118118
14 2 68 1 16 QXThread_delayCancel@142-157@..\src\qxk\qxk_xthr.c
119119
58 7 493 1 85 QXThread_queueGet@160-244@..\src\qxk\qxk_xthr.c
120120
10 1 39 3 11 QXThread_init_@247-257@..\src\qxk\qxk_xthr.c
121121
10 1 39 3 11 QXThread_dispatch_@260-270@..\src\qxk\qxk_xthr.c
122-
28 5 204 7 47 QXThread_start_@273-319@..\src\qxk\qxk_xthr.c
123-
100 13 527 4 134 QXThread_post_@322-455@..\src\qxk\qxk_xthr.c
124-
8 1 30 2 9 QXThread_postLIFO_@458-466@..\src\qxk\qxk_xthr.c
125-
5 1 49 1 7 QXThread_block_@469-475@..\src\qxk\qxk_xthr.c
126-
8 3 56 1 8 QXThread_unblock_@478-485@..\src\qxk\qxk_xthr.c
127-
20 3 157 3 39 QXThread_teArm_@488-526@..\src\qxk\qxk_xthr.c
128-
11 2 46 1 13 QXThread_teDisarm_@529-541@..\src\qxk\qxk_xthr.c
122+
30 6 214 7 49 QXThread_start_@273-321@..\src\qxk\qxk_xthr.c
123+
100 13 527 4 134 QXThread_post_@324-457@..\src\qxk\qxk_xthr.c
124+
8 1 30 2 9 QXThread_postLIFO_@460-468@..\src\qxk\qxk_xthr.c
125+
5 1 49 1 7 QXThread_block_@471-477@..\src\qxk\qxk_xthr.c
126+
8 3 56 1 8 QXThread_unblock_@480-487@..\src\qxk\qxk_xthr.c
127+
20 3 157 3 39 QXThread_teArm_@490-528@..\src\qxk\qxk_xthr.c
128+
11 2 46 1 13 QXThread_teDisarm_@531-543@..\src\qxk\qxk_xthr.c
129129
33 file analyzed.
130130
==============================================================
131131
NLOC Avg.NLOC AvgCCN Avg.token function_cnt file
@@ -135,10 +135,10 @@ NLOC Avg.NLOC AvgCCN Avg.token function_cnt file
135135
33 3.0 1.0 17.0 3 ..\include\qequeue.h
136136
225 6.6 2.4 60.1 9 ..\include\qf.h
137137
9 0.0 0.0 0.0 0 ..\include\qf_pkg.h
138-
20 0.0 0.0 0.0 0 ..\include\qk.h
138+
19 0.0 0.0 0.0 0 ..\include\qk.h
139139
25 0.0 0.0 0.0 0 ..\include\qmpool.h
140140
8 0.0 0.0 0.0 0 ..\include\qpc.h
141-
344 14.0 3.0 67.0 1 ..\include\qs.h
141+
356 14.0 3.0 67.0 1 ..\include\qs.h
142142
3 0.0 0.0 0.0 0 ..\include\qstamp.c
143143
2 0.0 0.0 0.0 0 ..\include\qstamp.h
144144
0 0.0 0.0 0.0 0 ..\include\qs_dummy.h
@@ -157,18 +157,18 @@ NLOC Avg.NLOC AvgCCN Avg.token function_cnt file
157157
152 36.2 4.8 201.0 4 ..\src\qf\qf_qeq.c
158158
18 16.0 2.0 79.0 1 ..\src\qf\qf_qmact.c
159159
218 26.2 4.1 156.0 8 ..\src\qf\qf_time.c
160-
185 22.0 4.2 126.0 8 ..\src\qk\qk.c
161-
75 17.0 3.8 96.5 4 ..\src\qv\qv.c
162-
261 25.2 4.5 154.6 10 ..\src\qxk\qxk.c
163-
199 48.0 8.0 410.8 4 ..\src\qxk\qxk_mutex.c
164-
105 24.5 4.0 156.0 4 ..\src\qxk\qxk_sema.c
165-
322 24.2 3.5 155.1 13 ..\src\qxk\qxk_xthr.c
160+
181 21.6 4.2 124.0 8 ..\src\qk\qk.c
161+
75 17.0 3.2 97.5 4 ..\src\qv\qv.c
162+
269 26.1 4.7 158.9 10 ..\src\qxk\qxk.c
163+
235 57.0 8.5 492.5 4 ..\src\qxk\qxk_mutex.c
164+
143 34.0 4.5 213.5 4 ..\src\qxk\qxk_sema.c
165+
324 24.3 3.5 155.8 13 ..\src\qxk\qxk_xthr.c
166166

167167
=============================================================================================================
168168
No thresholds exceeded (cyclomatic_complexity > 20 or length > 500 or nloc > 1000000 or parameter_count > 10)
169169
==========================================================================================
170170
Total nloc Avg.NLOC AvgCCN Avg.token Fun Cnt Warning cnt Fun Rt nloc Rt
171171
------------------------------------------------------------------------------------------
172-
3907 24.2 4.0 148.4 121 0 0.00 0.00
172+
3998 24.9 4.1 153.4 121 0 0.00 0.00
173173
@endcode
174174
*/

doxygen/snippets/qf_main.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,21 @@ int main(void) {
2020

2121
static QEvt const *l_philoQueueSto[N_PHILO][N_PHILO];
2222
for (uint8_t n = 0U; n < N_PHILO; ++n) {
23-
QACTIVE_START(AO_Philo[n], (uint8_t)(n + 1),
24-
l_philoQueueSto[n], Q_DIM(l_philoQueueSto[n]),
25-
(void *)0, 0U, (QEvt *)0);
23+
QACTIVE_START(AO_Philo[n],
24+
Q_PRIO(n + 1U, 1U), /* QF-priority/preemption-thre. */
25+
l_philoQueueSto[n], Q_DIM(l_philoQueueSto[n]),
26+
(void *)0, 0U,
27+
(void *)0);
2628
}
2729

2830
Table_ctor(); /* instantiate the Table active object */
2931

3032
static QEvt const *l_tableQueueSto[N_PHILO];
31-
QACTIVE_START(AO_Table, (uint8_t)(N_PHILO + 1),
32-
l_tableQueueSto, Q_DIM(l_tableQueueSto),
33-
(void *)0, 0U, (QEvt *)0);
33+
QACTIVE_START(AO_Table,
34+
Q_PRIO(N_PHILO + 1U, 2U), /* QF-priority/preemption-thre. */
35+
l_tableQueueSto, Q_DIM(l_tableQueueSto),
36+
(void *)0, 0U,
37+
(void *)0);
3438

3539
return QF_run(); /* run the QF application, QF_run() does not return */
3640
}

doxygen/snippets/qxk_start.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,24 @@ int main() {
1515

1616
/* start the active objects (basic threads)... */
1717
Table_ctor(); /* instantiate the Table AO */
18-
QACTIVE_START(AO_Table, /* AO to start */
19-
N_PHILO + 2U, /* QP priority of the AO */
20-
tableQueueSto, /* event queue storage */
21-
Q_DIM(tableQueueSto), /* queue length [events] */
22-
tableStackSto, /* stack storage */
23-
sizeof(tableStackSto), /* stack size [bytes] */
24-
(void *)0); /* initialization param */
18+
QACTIVE_START(AO_Table, /* AO to start */
19+
Q_PRIO(n + 1U, 1U), /* QF-priority/preemption-thre. */
20+
tableQueueSto, /* event queue storage */
21+
Q_DIM(tableQueueSto), /* queue length [events] */
22+
tableStackSto, /* stack storage */
23+
sizeof(tableStackSto), /* stack size [bytes] */
24+
(void *)0); /* initialization param */
2525
. . .
2626

2727
/* start the extended-threads... */
2828
Test_ctor(); /* instantiate the Test extended thread */
29-
QXTHREAD_START(XT_Test, /* Thread to start */
30-
10U, /* QP priority of the thread */
31-
testQueueSto, /* message queue storage */
32-
Q_DIM(testQueueSto), /* message length [events] */
33-
testStackSto, /* stack storage */
34-
sizeof(testStackSto), /* stack size [bytes] */
35-
(void *)0); /* initialization param */
29+
QXTHREAD_START(XT_Test, /* Thread to start */
30+
Q_PRIO(10U, 2U), /* QF-priority/preemption-thre. */
31+
testQueueSto, /* message queue storage */
32+
Q_DIM(testQueueSto), /* message length [events] */
33+
testStackSto, /* stack storage */
34+
sizeof(testStackSto), /* stack size [bytes] */
35+
(void *)0); /* initialization param */
3636

3737
return QF_run(); /* run the QF application */
3838
}

examples/arm-cm/blinky_efm32-slstk3401a/main.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*****************************************************************************
22
* Product: "Blinky" example
3-
* Last updated for version 6.4.0
4-
* Last updated on 2019-02-08
3+
* Last updated for version 7.1.0
4+
* Last updated on 2022-08-16
55
*
66
* Q u a n t u m L e a P s
77
* ------------------------
@@ -39,8 +39,6 @@ Q_DEFINE_THIS_FILE
3939

4040
/*..........................................................................*/
4141
int main() {
42-
static QEvt const *l_blinkyQSto[10]; /* Event queue storage for Blinky */
43-
4442
QF_init(); /* initialize the framework and the underlying RT kernel */
4543
BSP_init(); /* initialize the Board Support Package */
4644

@@ -49,10 +47,11 @@ int main() {
4947

5048
/* instantiate and start the active objects... */
5149
Blinky_ctor();
50+
static QEvt const *l_blinkyQSto[10]; /* Event queue storage for Blinky */
5251
QACTIVE_START(AO_Blinky, /* AO pointer to start */
53-
1U, /* unique QP priority of the AO */
52+
Q_PRIO(2U, 1U), /* QF-priority/preemption-threshold */
5453
l_blinkyQSto, /* storage for the AO's queue */
55-
Q_DIM(l_blinkyQSto), /* lenght of the queue [entries] */
54+
Q_DIM(l_blinkyQSto), /* length of the queue [entries] */
5655
(void *)0, /* stack storage (not used in QK) */
5756
0U, /* stack size [bytes] (not used in QK) */
5857
(QEvt *)0); /* initial event (or 0) */

examples/arm-cm/blinky_efm32-slstk3401a/qk/armclang/blinky-qk.uvprojx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@
355355
<ClangAsOpt>4</ClangAsOpt>
356356
<VariousControls>
357357
<MiscControls></MiscControls>
358-
<Define>Stack_Size=1024 Heap_Size=16</Define>
358+
<Define>Stack_Size=2048 Heap_Size=16</Define>
359359
<Undefine></Undefine>
360360
<IncludePath></IncludePath>
361361
</VariousControls>
@@ -980,7 +980,7 @@
980980
<ClangAsOpt>4</ClangAsOpt>
981981
<VariousControls>
982982
<MiscControls></MiscControls>
983-
<Define>Stack_Size=1024 Heap_Size=16</Define>
983+
<Define>Stack_Size=2048 Heap_Size=16</Define>
984984
<Undefine></Undefine>
985985
<IncludePath></IncludePath>
986986
</VariousControls>
@@ -1605,7 +1605,7 @@
16051605
<ClangAsOpt>4</ClangAsOpt>
16061606
<VariousControls>
16071607
<MiscControls></MiscControls>
1608-
<Define>Stack_Size=1024 Heap_Size=16</Define>
1608+
<Define>Stack_Size=2048 Heap_Size=16</Define>
16091609
<Undefine></Undefine>
16101610
<IncludePath></IncludePath>
16111611
</VariousControls>

examples/arm-cm/blinky_efm32-slstk3401a/qk/gnu/blinky-qk.ld

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ MEMORY { /* memory map of Pearl Gecko EFM32PG1B200F256GM48 */
4141
}
4242

4343
/* The size of the stack used by the application. NOTE: you need to adjust */
44-
STACK_SIZE = 1024;
44+
STACK_SIZE = 2048;
4545

4646
/* The size of the heap used by the application. NOTE: you need to adjust */
4747
HEAP_SIZE = 0;

examples/arm-cm/blinky_efm32-slstk3401a/qk/iar/blinky-qk.icf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ define symbol __ICFEDIT_region_ROM_end__ = 0x0003FFFF;
99
define symbol __ICFEDIT_region_RAM_start__ = 0x20000000;
1010
define symbol __ICFEDIT_region_RAM_end__ = 0x20007FFF;
1111
/*-Sizes-*/
12-
define symbol __ICFEDIT_size_cstack__ = 1024;
12+
define symbol __ICFEDIT_size_cstack__ = 2048;
1313
define symbol __ICFEDIT_size_heap__ = 0;
1414
/**** End of ICF editor section. ###ICF###*/
1515

@@ -25,5 +25,5 @@ do not initialize { section .noinit };
2525

2626
place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
2727
place in ROM_region { readonly };
28-
place at start of RAM_region {block CSTACK };
29-
place in RAM_region { readwrite, block HEAP };
28+
place at start of RAM_region {block CSTACK };
29+
place in RAM_region { readwrite, block HEAP };

0 commit comments

Comments
 (0)