diff --git a/doxygen/history.dox b/doxygen/history.dox
index d9823142..db450363 100644
--- a/doxygen/history.dox
+++ b/doxygen/history.dox
@@ -37,7 +37,7 @@ __Modified QP/C ports:__
- `qpc/ports/ucos2/` - implemented [feature#185](https://sourceforge.net/p/qpc/feature-requests/185/)
- `qpc/ports/win32/` - added QSpy64 (64-bit) build configuration to the Visual Studio project
- `qpc/ports/win32-qv/` - added QSpy64 (64-bit) build configuration to the Visual Studio project
-- `qpc/ports/win32-quit/` - added "port" used for "QP Unit Internal Testing" (QUIT)
+- `qpc/ports/win32-quit/` - added "port" used for "QP Unit Internal Testing" (QUIT)
__Updated examples:__
diff --git a/ports/esp-idf/README.md b/ports/esp-idf/README.md
new file mode 100644
index 00000000..f9ef6bdd
--- /dev/null
+++ b/ports/esp-idf/README.md
@@ -0,0 +1,29 @@
+This directory contains the "experimental" port to the [Espressif ESP-IDF][1]
+IoT Framework, which is loosely based on the [FreeRTOS kernel][2].
+
+
+---------------------------------------------------------------------------
+# About QP/C Port to ESP-IDF
+"Experimental" means that the port has not been thouroughly tested at
+Quantum Leaps and no working examples are provided.
+
+
+---------------------------------------------------------------------------
+# About Espressif ESP-IDF
+
+The [Espressif ESP-IDF][1] is based on a
+[significantly changed version of the FreeRTOS kernel][3]
+developed by Espressif to support the ESP32 multi-core CPUs (see [ESP-IDF][1]).
+
+The Espressif version of FreeRTOS is __NOT__ compatible with the baseline [FreeRTOS][2]
+and it needs to be treated as a separate RTOS kernel. According to the comments
+in the Espressif source code, FreeRTOS-ESP-IDF is based on FreeRTOS V8.2.0, but
+apparently FreeRTOS-ESP32 has been updated with the newer features introduced to
+the original FreeRTOS in the later versions. For example, FreeRTOS-ESP-IDF supports
+the "static allocation", first introduced in baseline FreeRTOS V9.x. This QP port
+to FreeRTOS-ESP-IDF takes advantage of the "static allocation".
+
+
+[1]: https://www.espressif.com/en/products/sdks/esp-idf
+[2]: https://freertos.org
+[3]: https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/freertos.html
diff --git a/ports/freertos-esp32/qep_port.h b/ports/esp-idf/qep_port.h
similarity index 100%
rename from ports/freertos-esp32/qep_port.h
rename to ports/esp-idf/qep_port.h
diff --git a/ports/freertos-esp32/qf_port.c b/ports/esp-idf/qf_port.c
similarity index 96%
rename from ports/freertos-esp32/qf_port.c
rename to ports/esp-idf/qf_port.c
index eebe407c..b8d6b8e7 100644
--- a/ports/freertos-esp32/qf_port.c
+++ b/ports/esp-idf/qf_port.c
@@ -1,17 +1,17 @@
/**
* @file
-* @brief QF/C port to FreeRTOS-ESP32 adaptation
+* @brief "Experimental" QF/C port to Espressif ESP-IDF (version 4.x)
* @ingroup ports
* @cond
******************************************************************************
-* Last updated for version 6.9.1
-* Last updated on 2020-11-28
+* Last updated for version 6.9.4
+* Last updated on 2021-06-29
*
* Q u a n t u m L e a P s
* ------------------------
* Modern Embedded Software
*
-* Copyright (C) 2005-2020 Quantum Leaps, LLC. All rights reserved.
+* Copyright (C) 2005-2021 Quantum Leaps, LLC. All rights reserved.
*
* This program is open source software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License as published
@@ -29,7 +29,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
-* along with this program. If not, see .
+* along with this program. If not, see .
*
* Contact information:
*
@@ -47,7 +47,9 @@
#else
#include "qs_dummy.h" /* disable the QS software tracing */
#endif /* Q_SPY */
-#include
+
+#include "esp_log.h"
+#include "esp_freertos_hooks.h"
Q_DEFINE_THIS_MODULE("qf_port")
//static const char *TAG = "qf_port";
@@ -60,6 +62,14 @@ Q_DEFINE_THIS_MODULE("qf_port")
#error "FreeRTOS configMAX_PRIORITIES must not be less than QF_MAX_ACTIVE"
#endif
+#if defined( CONFIG_QPC_PINNED_TO_CORE_0 )
+ #define QPC_CPU_NUM PRO_CPU_NUM
+#elif defined( CONFIG_QPC_PINNED_TO_CORE_1 )
+ #define QPC_CPU_NUM APP_CPU_NUM
+#else
+ /* Defaults to APP_CPU */
+ #define QPC_CPU_NUM APP_CPU_NUM
+#endif
/* Global objects ----------------------------------------------------------*/
PRIVILEGED_DATA portMUX_TYPE QF_esp32mux = portMUX_INITIALIZER_UNLOCKED;
@@ -70,15 +80,14 @@ int_t qf_run_active = 0;
/*==========================================================================*/
void QF_init(void) {
- /* empty for FreeRTOS */
- /*portMUX_TYPE QF_esp32mux = portMUX_INITIALIZER_UNLOCKED;*/
+ esp_register_freertos_tick_hook_for_cpu(freertos_tick_hook, QPC_CPU_NUM);
}
/*..........................................................................*/
int_t QF_run(void) {
- //QF_onStartup(); /* the startup callback (configure/enable interrupts) */
+ QF_onStartup();
//vTaskStartScheduler(); /* start the FreeRTOS scheduler */
//Q_ERROR_ID(110); /* the FreeRTOS scheduler should never return */
- qf_run_active = 100;
+ qf_run_active = 100;
return 0; /* dummy return to make the compiler happy */
}
/*..........................................................................*/
@@ -121,7 +130,7 @@ void QActive_start_(QActive * const me, uint_fast8_t prio,
(UBaseType_t)(prio + tskIDLE_PRIORITY), /* FreeRTOS priority */
(StackType_t *)stkSto, /* stack storage */
&me->thread, /* task buffer */
- 1); /* CPU number */
+ QPC_CPU_NUM); /* CPU number */
Q_ENSURE_ID(210, thr != (TaskHandle_t)0); /* must be created */
}
/*..........................................................................*/
diff --git a/ports/freertos-esp32/qf_port.h b/ports/esp-idf/qf_port.h
similarity index 87%
rename from ports/freertos-esp32/qf_port.h
rename to ports/esp-idf/qf_port.h
index f163b4ea..64f9451b 100644
--- a/ports/freertos-esp32/qf_port.h
+++ b/ports/esp-idf/qf_port.h
@@ -1,17 +1,17 @@
/**
* @file
-* @brief QF/C port to FreeRTOS-ESP32 (Espressif ESP32-IDF 4.x) adaptation
+* @brief "Experimental" QF/C port to Espressif ESP-IDF (version 4.x)
* @ingroup ports
* @cond
******************************************************************************
-* Last updated for version 6.9.1
-* Last updated on 2020-11-28
+* Last updated for version 6.9.4
+* Last updated on 2021-06-29
*
* Q u a n t u m L e a P s
* ------------------------
* Modern Embedded Software
*
-* Copyright (C) 2005-2020 Quantum Leaps, LLC. All rights reserved.
+* Copyright (C) 2005-2021 Quantum Leaps, LLC. All rights reserved.
*
* This program is open source software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License as published
@@ -52,8 +52,8 @@
#define QF_CRIT_ENTRY(dummy) portENTER_CRITICAL(&QF_esp32mux)
#define QF_CRIT_EXIT(dummy) portEXIT_CRITICAL(&QF_esp32mux)
-#include "FreeRTOS.h" /* FreeRTOS master include file, see NOTE4 */
-#include "task.h" /* FreeRTOS task management */
+#include "freertos/FreeRTOS.h" /* FreeRTOS master include file, see NOTE4 */
+#include "freertos/task.h" /* FreeRTOS task management */
#include "qep_port.h" /* QEP port */
#include "qequeue.h" /* this QP port uses the native QF event queue */
@@ -222,15 +222,27 @@ enum FreeRTOS_TaskAttrs {
/*****************************************************************************
* NOTE0:
-* FreeRTOS-ESP32 is a significantly changed version of the FreeRTOS kernel
-* developed by Espressif to support the ESP32 multi-core CPUs (see ESP32 IDF).
-* FreeRTOS-ESP32 is NOT compatible with the baseine FreeRTOS and it needs to
-* be treated as a separate RTOS kernel. According to the comments in the source
-* code, FreeRTOS-ESP32 is based on FreeRTOS V8.2.0, but apparently FreeRTOS-ESP32
-* has been updated with the newer features introduced to the original FreeRTOS
-* in the later versions. For example, FreeRTOS-ESP32 supports the "static
-* allocation", first introduced in baseline FreeRTOS V9.x. This prot to
-* QP-FreeRTOS-ESP32 takes advantage of the "static allocation".
+* This is the "experimental" port to the [Espressif ESP-IDF][1]
+* IoT Framework, which is loosely based on the [FreeRTOS kernel][2].
+*
+* "Experimental" means that the port has not been thouroughly tested at
+* Quantum Leaps and no working examples are provided.
+*
+* The [Espressif ESP-IDF][1] is based on a significantly changed version
+* of the FreeRTOS kernel developed by Espressif to support the ESP32 multi-core
+* CPUs (see [ESP-IDF][1]).
+*
+* The Espressif version of FreeRTOS is __NOT__ compatible with the baseline
+* FreeRTOS and it needs to be treated as a separate RTOS kernel.
+* According to the comments in the Espressif source code, FreeRTOS-ESP-IDF
+* is based on FreeRTOS V8.2.0, but apparently FreeRTOS-ESP-IDF has been
+* updated with the newer features introduced to the original FreeRTOS in the
+* later versions. For example, FreeRTOS-ESP32 supports the "static allocation",
+* first introduced in baseline FreeRTOS V9.x. This QP port to FreeRTOS-ESP-IDF
+* takes advantage of the "static allocation".
+*
+* [1]: https://www.espressif.com/en/products/sdks/esp-idf
+* [2]: https://freertos.org
*
* NOTE1:
* The maximum number of active objects QF_MAX_ACTIVE can be increased to 64,
diff --git a/ports/freertos-esp32/qs_port.h b/ports/esp-idf/qs_port.h
similarity index 100%
rename from ports/freertos-esp32/qs_port.h
rename to ports/esp-idf/qs_port.h
diff --git a/ports/lint-plus/au-misra3-amd1.lnt b/ports/lint-plus/au-misra3-amd1.lnt
index f9b8801c..a703363d 100644
--- a/ports/lint-plus/au-misra3-amd1.lnt
+++ b/ports/lint-plus/au-misra3-amd1.lnt
@@ -166,13 +166,13 @@
/**** Rule 21.15 (Req) ************/
- +e857 /* incompatible pointer arguments to memcpy/memmove/memcmp */
+ +e857 /* incompatible pointer arguments to memcpy/memmove/memcmp */
+elib(857)
-append(857,[MISRA 2012 Rule 21.15, required])
/**** Rule 21.16 (Req) ************/
- +e9098 /* pointer argument to memcmp does not point to a pointer type
+ +e9098 /* pointer argument to memcmp does not point to a pointer type
or an essentially signed, unsigned, boolean, or enum type */
+elib(9098)
-append(9098,[MISRA 2012 Rule 21.16, required])
diff --git a/ports/lint-plus/au-misra3.lnt b/ports/lint-plus/au-misra3.lnt
index 735be3fb..f7e546f4 100644
--- a/ports/lint-plus/au-misra3.lnt
+++ b/ports/lint-plus/au-misra3.lnt
@@ -44,7 +44,7 @@
/**** Dir 2.1 (Req) ************/
- -std(c99) /* strict ISO C99 */
+ -std(c99) /* strict ISO C99 */
/* Note: if you code to the C90 standard instead, you may
want to comment out the above option and uncomment the
following option. You will also want to do likewise for
@@ -87,7 +87,7 @@
/**** Dir 4.5 (Adv) ************/
+fta /* enable typographical ambiguity checking */
- +e9046 /* typographical ambiguity */
+ +e9046 /* typographical ambiguity */
+elib(9046)
-append(9046,[MISRA 2012 Directive 4.5, advisory])
@@ -149,7 +149,7 @@
/* While MISRA has declared this rule to be "undecidable", Gimpel
* Software provides the following options to assist:
*/
- -std(c99) /* strict ISO C99 */
+ -std(c99) /* strict ISO C99 */
/* Note: if you code to the C90 standard instead, you may
want to comment out the above option and uncomment the
following option. You will also want to do likewise for
@@ -161,7 +161,7 @@
/* While MISRA has declared this rule to be "undecidable", Gimpel
* Software provides the following options to assist:
*/
- -std(c99) /* strict ISO C99 */
+ -std(c99) /* strict ISO C99 */
/* Note: if you code to the C90 standard instead, you may
want to comment out the above option and uncomment the
following option. You will also want to do likewise for
@@ -491,16 +491,16 @@
/**** Rule 2.3 (Adv) ************/
- +e751 /* local typedef not referenced */
+ +e751 /* local typedef not referenced */
+elib(751)
-append(751,[MISRA 2012 Rule 2.3, advisory])
- +e756 /* global not referenced */
+ +e756 /* global not referenced */
+elib(756)
-append(756,[MISRA 2012 Rule 2.3, advisory])
/**** Rule 2.4 (Adv) ************/
- +e753 /* local tag not referenced */
+ +e753 /* local tag not referenced */
+elib(753)
-append(753,[MISRA 2012 Rule 2.4, advisory])
+e9058
@@ -509,22 +509,22 @@
/**** Rule 2.5 (Adv) ************/
- +e750 /* local macro not referenced */
+ +e750 /* local macro not referenced */
+elib(750)
-append(750,[MISRA 2012 Rule 2.5, advisory])
- +e755 /* global macro not referenced */
+ +e755 /* global macro not referenced */
+elib(755)
-append(755,[MISRA 2012 Rule 2.5, advisory])
/**** Rule 2.6 (Adv) ************/
- +e563 /* label not referenced */
+ +e563 /* label not referenced */
+elib(563)
-append(563,[MISRA 2012 Rule 2.6, advisory])
/**** Rule 2.7 (Adv) ************/
- +e715 /* not referenced */
+ +e715 /* not referenced */
+elib(715)
-append(715,[MISRA 2012 Rule 2.7, advisory])
@@ -546,7 +546,7 @@
/**** Rule 3.2 (Req) ************/
- +e427 /* C++ comment ends in \\ */
+ +e427 /* C++ comment ends in \\ */
+elib(427)
-append(427,[MISRA 2012 Rule 3.2, required])
@@ -814,7 +814,7 @@
/**** Rule 8.10 (Req) ************/
- +e695 /* inline function without storage-class specifier */
+ +e695 /* inline function without storage-class specifier */
+elib(695)
-append(695,[MISRA 2012 Rule 8.10, required])
+estring(9056,extern) /* inline function defined with extern */
@@ -828,7 +828,7 @@
/**** Rule 8.12 (Req) ************/
- +e488 /* duplicate enumerator values */
+ +e488 /* duplicate enumerator values */
+elib(488)
-append(488,[MISRA 2012 Rule 8.12, required])
@@ -837,13 +837,13 @@
/* While MISRA has declared this rule to be "undecidable", Gimpel
* Software provides the following options to assist:
*/
- +e818 /* pointer could be declared pointing to const */
+ +e818 /* pointer could be declared pointing to const */
+elib(818)
-append(818,[MISRA 2012 Rule 8.13, advisory])
- +e844 /* pointer could be declared pointing to const */
+ +e844 /* pointer could be declared pointing to const */
+elib(844)
-append(844,[MISRA 2012 Rule 8.13, advisory])
- +e954 /* pointer could be declared pointing to const */
+ +e954 /* pointer could be declared pointing to const */
+elib(954)
-append(954,[MISRA 2012 Rule 8.13, advisory])
@@ -899,7 +899,7 @@
/**** Rule 10.1 (Req) ************/
- +e48 /* bad type */
+ +e48 /* bad type */
+elib(48)
-append(48,[MISRA 2012 Rule 10.1, required])
+e9027 /* unpermitted operand */
@@ -1067,7 +1067,7 @@
/* While MISRA has declared this rule to be "undecidable", Gimpel
* Software provides the following options to assist:
*/
- +e564 /* variable depends on order of evaluation */
+ +e564 /* variable depends on order of evaluation */
+elib(564)
-append(564,[MISRA 2012 Rule 13.2, required])
@@ -1123,13 +1123,13 @@
/* While MISRA has declared this rule to be "undecidable", Gimpel
* Software provides the following options to assist:
*/
- +e685 /* relational always evaluates to true/false */
+ +e685 /* relational always evaluates to true/false */
+elib(685)
-append(685,[MISRA 2012 Rule 14.3, required])
- +e774 /* boolean always evaluates to true/false */
+ +e774 /* boolean always evaluates to true/false */
+elib(774)
-append(774,[MISRA 2012 Rule 14.3, required])
- +e650 /* constant out of range for operator */
+ +e650 /* constant out of range for operator */
+elib(650)
-append(650,[MISRA 2012 Rule 14.3, required])
@@ -1296,7 +1296,7 @@
/**** Rule 17.3 (Mand) ************/
- +e718 /* symbol undeclared, assumed to return int */
+ +e718 /* symbol undeclared, assumed to return int */
+elib(718)
-append(718,[MISRA 2012 Rule 17.3, mandatory])
diff --git a/ports/posix-qutest/qutest_port.c b/ports/posix-qutest/qutest_port.c
index f105a7d4..ace45902 100644
--- a/ports/posix-qutest/qutest_port.c
+++ b/ports/posix-qutest/qutest_port.c
@@ -4,8 +4,8 @@
* @ingroup ports
* @cond
******************************************************************************
-* Last updated for version 6.9.2
-* Last updated on 2021-01-14
+* Last updated for version 6.9.4
+* Last updated on 2021-06-17
*
* Q u a n t u m L e a P s
* ------------------------
@@ -177,6 +177,7 @@ uint8_t QS_onStartup(void const *arg) {
QS_onFlush();
/* install the SIGINT (Ctrl-C) signal handler */
+ memset(&sig_act, 0, sizeof(sig_act));
sig_act.sa_handler = &sigIntHandler;
sigaction(SIGINT, &sig_act, NULL);
diff --git a/ports/posix-qv/qf_port.c b/ports/posix-qv/qf_port.c
index 7ff13dc4..30f49ddd 100644
--- a/ports/posix-qv/qf_port.c
+++ b/ports/posix-qv/qf_port.c
@@ -4,14 +4,14 @@
* @ingroup ports
* @cond
******************************************************************************
-* Last updated for version 6.9.1
-* Last updated on 2020-10-03
+* Last updated for version 6.9.4
+* Last updated on 2021-06-17
*
* Q u a n t u m L e a P s
* ------------------------
* Modern Embedded Software
*
-* Copyright (C) 2005-2020 Quantum Leaps, LLC. All rights reserved.
+* Copyright (C) 2005-2021 Quantum Leaps, LLC. All rights reserved.
*
* This program is open source software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License as published
@@ -98,6 +98,7 @@ void QF_init(void) {
l_tickPrio = sched_get_priority_min(SCHED_FIFO); /* default tick prio */
/* install the SIGINT (Ctrl-C) signal handler */
+ memset(&sig_act, 0, sizeof(sig_act));
sig_act.sa_handler = &sigIntHandler;
sigaction(SIGINT, &sig_act, NULL);
}
diff --git a/ports/posix/qf_port.c b/ports/posix/qf_port.c
index 7d7884fc..c26764c1 100644
--- a/ports/posix/qf_port.c
+++ b/ports/posix/qf_port.c
@@ -4,14 +4,14 @@
* @ingroup ports
* @cond
******************************************************************************
-* Last updated for version 6.9.1
-* Last updated on 2020-10-03
+* Last updated for version 6.9.4
+* Last updated on 2021-06-17
*
* Q u a n t u m L e a P s
* ------------------------
* Modern Embedded Software
*
-* Copyright (C) 2005-2020 Quantum Leaps, LLC. All rights reserved.
+* Copyright (C) 2005-2021 Quantum Leaps, LLC. All rights reserved.
*
* This program is open source software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License as published
@@ -101,6 +101,7 @@ void QF_init(void) {
l_tickPrio = sched_get_priority_min(SCHED_FIFO); /* default tick prio */
/* install the SIGINT (Ctrl-C) signal handler */
+ memset(&sig_act, 0, sizeof(sig_act));
sig_act.sa_handler = &sigIntHandler;
sigaction(SIGINT, &sig_act, NULL);
}