Renamed the experimental port "freertos-esp32" to "esp-idf" and updated the port
This commit is contained in:
MMS 2021-06-29 12:19:56 -04:00
parent d51d8c511b
commit 184277db91
11 changed files with 113 additions and 60 deletions

View File

@ -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:__

29
ports/esp-idf/README.md Normal file
View File

@ -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

View File

@ -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 <www.gnu.org/licenses/>.
* along with this program. If not, see <www.gnu.org/licenses>.
*
* Contact information:
* <www.state-machine.com/licensing>
@ -47,7 +47,9 @@
#else
#include "qs_dummy.h" /* disable the QS software tracing */
#endif /* Q_SPY */
#include <esp_log.h>
#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 */
}
/*..........................................................................*/

View File

@ -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,

View File

@ -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])

View File

@ -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])

View File

@ -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);

View File

@ -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);
}

View File

@ -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);
}