diff --git a/3rd_party b/3rd_party index 78394a4c..aca09a2e 160000 --- a/3rd_party +++ b/3rd_party @@ -1 +1 @@ -Subproject commit 78394a4c0cdfa1538536787d04e4274ab6d2a488 +Subproject commit aca09a2e3571adf97e5ce6cb5b1d645ba2418c1d diff --git a/examples b/examples index e31a06fa..5f1b007e 160000 --- a/examples +++ b/examples @@ -1 +1 @@ -Subproject commit e31a06faedada9c1732d8531f0e8e48aad671c11 +Subproject commit 5f1b007ea70dd8ed5f7a727e7e83402c75f69146 diff --git a/include/qpcpp.hpp b/include/qpcpp.hpp index 1f890041..f0f13969 100644 --- a/include/qpcpp.hpp +++ b/include/qpcpp.hpp @@ -72,14 +72,6 @@ //! @deprecated plain 'char' is no longer forbidden in MISRA/AUTOSAR-C++ using char_t = char; -//! @deprecated module name definition -//! Use Q_THIS_MODULE(name_) ended with a semicolon ';' -#define Q_DEFINE_THIS_MODULE(name_) Q_THIS_MODULE(name_); - -//! @deprecated file name definition -//! Use Q_THIS_FILE() ended with a semicolon ';' -#define Q_DEFINE_THIS_FILE Q_THIS_FILE(); - //! @deprecated assertion failure handler //! Use Q_onError() instead. #define Q_onAssert(module_, id_) Q_onError(module_, id_) diff --git a/include/qsafe.h b/include/qsafe.h index 48725488..43e772ac 100644 --- a/include/qsafe.h +++ b/include/qsafe.h @@ -64,9 +64,9 @@ extern "C" { //$declare${QP-FuSa::enabled} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv -//${QP-FuSa::enabled::Q_THIS_MODULE} ......................................... -#define Q_THIS_MODULE(name_) \ - static char const Q_this_module_[] = name_ +//${QP-FuSa::enabled::Q_DEFINE_THIS_MODULE} .................................. +#define Q_DEFINE_THIS_MODULE(name_) \ + static char const Q_this_module_[] = name_; //${QP-FuSa::enabled::Q_ASSERT_INCRIT} ....................................... #define Q_ASSERT_INCRIT(id_, expr_) \ @@ -97,8 +97,8 @@ extern "C" { #else //$declare${QP-FuSa::disabled} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv -//${QP-FuSa::disabled::Q_THIS_MODULE} ........................................ -#define Q_THIS_MODULE(name_) extern char Q_this_module_ +//${QP-FuSa::disabled::Q_DEFINE_THIS_MODULE} ................................. +#define Q_DEFINE_THIS_MODULE(name_) //${QP-FuSa::disabled::Q_ASSERT_INCRIT} ...................................... #define Q_ASSERT_INCRIT(id_, expr_) ((void)0) @@ -117,8 +117,8 @@ extern "C" { //============================================================================ //$declare1${QP-FuSa} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv -//${QP-FuSa::Q_THIS_FILE} .................................................... -#define Q_THIS_FILE() Q_THIS_MODULE(__FILE__) +//${QP-FuSa::Q_DEFINE_THIS_FILE} ............................................. +#define Q_DEFINE_THIS_FILE Q_DEFINE_THIS_MODULE(__FILE__) //${QP-FuSa::Q_ASSERT} ....................................................... #define Q_ASSERT(expr_) Q_ASSERT_ID(__LINE__, (expr_)) diff --git a/ports/embos/qf_port.cpp b/ports/embos/qf_port.cpp index 71570b9c..0a599ba6 100644 --- a/ports/embos/qf_port.cpp +++ b/ports/embos/qf_port.cpp @@ -56,7 +56,7 @@ //============================================================================ namespace { // anonymous namespace with local definitions -Q_THIS_MODULE("qf_port"); +Q_DEFINE_THIS_MODULE("qf_port") //............................................................................ static void thread_function(void *pVoid); // prototype diff --git a/ports/freertos/qf_port.cpp b/ports/freertos/qf_port.cpp index b5561e23..e6393b04 100644 --- a/ports/freertos/qf_port.cpp +++ b/ports/freertos/qf_port.cpp @@ -49,7 +49,7 @@ namespace { // unnamed local namespace -Q_THIS_MODULE("qf_port"); +Q_DEFINE_THIS_MODULE("qf_port") // Local objects ------------------------------------------------------------- static void task_function(void *pvParameters) { // FreeRTOS task signature diff --git a/ports/lint-plus/qpcpp.lnt b/ports/lint-plus/qpcpp.lnt index 68f61701..b9aa5005 100644 --- a/ports/lint-plus/qpcpp.lnt +++ b/ports/lint-plus/qpcpp.lnt @@ -47,8 +47,7 @@ // AC++M16-3-2 function-like macro -esym(9026, - Q_THIS_MODULE, - Q_THIS_FILE, + Q_DEFINE_THIS_MODULE, Q_ASSERT_STATIC, Q_ASSERT, Q_ASSERT_ID, @@ -78,7 +77,7 @@ // MC++R10-0-6 unparenthesized macro parameter in definition of macro -esym(9022, - Q_THIS_MODULE) + Q_DEFINE_THIS_MODULE) // definition of macro ends in semi-colon -esym(823, diff --git a/ports/pic32/CMakeLists.txt b/ports/pic32/CMakeLists.txt deleted file mode 100644 index 22133c2d..00000000 --- a/ports/pic32/CMakeLists.txt +++ /dev/null @@ -1,15 +0,0 @@ -# ports/pic32 -if(QPCPP_CFG_UNIT_TEST) - target_include_directories(qpcpp PUBLIC qutest/xc32) -else() - if(NOT KERNEL MATCHES "q[vk]") - message(WARNING "Kernel ${KERNEL} is not supported! Falling back to QV kernel") - set(KERNEL qv) - endif() - - set(KERNEL_PORT_CPP ${CMAKE_CURRENT_LIST_DIR}/${KERNEL}/xc32/${KERNEL}_port.cpp) - if(EXISTS ${KERNEL_PORT_CPP}) - target_sources(qpcpp PRIVATE ${KERNEL_PORT_CPP}) - endif() - target_include_directories(qpcpp PUBLIC ${KERNEL}/xc32) -endif() diff --git a/ports/pic32/qk/xc32/qk_port.cpp b/ports/pic32/qk/xc32/qk_port.cpp deleted file mode 100644 index 5c388e54..00000000 --- a/ports/pic32/qk/xc32/qk_port.cpp +++ /dev/null @@ -1,79 +0,0 @@ -//============================================================================ -// QP/C++ Real-Time Embedded Framework (RTEF) -// Copyright (C) 2005 Quantum Leaps, LLC. All rights reserved. -// -// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-QL-commercial -// -// This software is dual-licensed under the terms of the open source GNU -// General Public License version 3 (or any later version), or alternatively, -// under the terms of one of the closed source Quantum Leaps commercial -// licenses. -// -// The terms of the open source GNU General Public License version 3 -// can be found at: -// -// The terms of the closed source Quantum Leaps commercial licenses -// can be found at: -// -// Redistributions in source code must retain this top-level comment block. -// Plagiarizing this software to sidestep the license obligations is illegal. -// -// Contact information: -// -// -//============================================================================ -//! @date Last updated on: 2023-08-31 -//! @version Last updated for: @ref qpcpp_7_3_0 -//! -//! @file -//! @brief QK/C++ port to PIC32, XC32 toolchain - -#define QP_IMPL 1U -#include "qp_port.hpp" - -extern "C" { - -//............................................................................ -void QK_init(void) { - INTCONSET = _INTCON_MVEC_MASK; // configure multi-vectored interrupts - - IPC0bits.CS0IP = 1; // priority 1 for Core Software Interrupt 0, NOTE1 - IPC0bits.CS0IS = 0; // sub-prioirty 0 for Core Software Interrupt 0 - - IFS0CLR = _IFS0_CS0IF_MASK; // clear the Core Software Interrupt 0 flag - IEC0SET = _IEC0_CS0IE_MASK; // enable the Core Software Interrupt 0 -} - -//............................................................................ -__attribute__((vector(_CORE_SOFTWARE_0_VECTOR),interrupt(IPL1AUTO), nomips16)) -void QK_isr_(void) { // see NOTE2 - IFS0CLR = _IFS0_CS0IF_MASK; // clear the Core Software Interrupt 0 flag - - QF_INT_DISABLE(); - _mtc0(_CP0_STATUS, _CP0_STATUS_SELECT, 0U); // drop IPL to 0 - (void)QK_activate_(); // asynchronously activate higher priority AO - _mtc0(_CP0_STATUS, _CP0_STATUS_SELECT, 1U << 10); //restore IPL to 1 - QF_INT_ENABLE(); -} - -} // extern "C" - -//============================================================================ -// NOTE1: -// The Core Software Interrupt 0 at priority 1, sub-priority 0 is reserved for -// QK. All other interrupts must have higher priority, e.g. 2-7. The user may -// _not_ set the shadow register set to priority 1. -// -// NOTE2: -// The QK_isr_() Core Software Interrupt 0 is used to perform the scheduling -// (asynchronous preemption in QK). This ISR is configured to use software -// register stacking (IPL1SOFT), because it can nest on itself. The QK_isr_() -// runs at IPL1, which should be the lowest of all other ISRs. This will -// guarantee that the Core Software Interrupt 0 will not execute until all -// other interrupts have completed, including any nesting. -// -// Any ISR that interacts with QP must trigger Core Software Interrupt 0. -// This triggering is accomplished in the macros QK_ISR_ENTRY()/ -// QK_ISR_EXIT(), which _must_ be placed at the entry and exit of every ISR, -// respectively. -// diff --git a/ports/pic32/qk/xc32/qp_port.hpp b/ports/pic32/qk/xc32/qp_port.hpp deleted file mode 100644 index d156480a..00000000 --- a/ports/pic32/qk/xc32/qp_port.hpp +++ /dev/null @@ -1,120 +0,0 @@ -//============================================================================ -// QP/C++ Real-Time Embedded Framework (RTEF) -// -// Q u a n t u m L e a P s -// ------------------------ -// Modern Embedded Software -// -// Copyright (C) 2005 Quantum Leaps, LLC . -// -// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-QL-commercial -// -// This software is dual-licensed under the terms of the open source GNU -// General Public License version 3 (or any later version), or alternatively, -// under the terms of one of the closed source Quantum Leaps commercial -// licenses. -// -// The terms of the open source GNU General Public License version 3 -// can be found at: -// -// The terms of the closed source Quantum Leaps commercial licenses -// can be found at: -// -// Redistributions in source code must retain this top-level comment block. -// Plagiarizing this software to sidestep the license obligations is illegal. -// -// Contact information: -// -// -//============================================================================ -//! @date Last updated on: 2023-09-07 -//! @version Last updated for: @ref qpcpp_7_3_0 -//! -//! @file -//! @brief QP/C++ port to PIC32, preemptive QK kernel, MPLAB-X XC32 - -#ifndef QP_PORT_HPP_ -#define QP_PORT_HPP_ - -#include // Exact-width types. C++11 Standard -#include // for _clz() - -#ifdef QP_CONFIG -#include "qp_config.hpp" // external QP configuration -#endif - -// no-return function specifier (C++11 Standard) -#define Q_NORETURN [[ noreturn ]] void - -// QF configuration for QK -- data members of the QActive class... - -// QActive event queue type -#define QACTIVE_EQUEUE_TYPE QEQueue -// QACTIVE_OS_OBJ_TYPE not used in this port -// QACTIVE_THREAD_TYPE not used in this port - -// QF interrupt disable/enable, see NOTE1 -#define QF_INT_DISABLE() __builtin_disable_interrupts() -#define QF_INT_ENABLE() __builtin_enable_interrupts() - -// QF critical section entry/exit, see NOTE1 -#define QF_CRIT_STAT -#define QF_CRIT_ENTRY() QF_INT_DISABLE() -#define QF_CRIT_EXIT() QF_INT_ENABLE() - -// fast log-base-2 with CLZ instruction -#define QF_LOG2(n_) (static_cast(32U - _clz(n_))) - -// Check if the code executes in the ISR context -#define QK_ISR_CONTEXT_() (QK_priv_.intNest != 0U) - -// QK interrupt entry and exit -#define QK_ISR_ENTRY() do { \ - QF_INT_DISABLE(); \ - ++QK_priv_.intNest; \ - QF_INT_ENABLE(); \ -} while (false) - -#define QK_ISR_EXIT() do { \ - QF_INT_DISABLE(); \ - --QK_priv_.intNest; \ - if (QK_sched_() != 0U) { \ - IFS0SET = _IFS0_CS0IF_MASK; \ - } \ - QF_INT_ENABLE(); \ -} while (false) - -// include files ------------------------------------------------------------- -#include "qequeue.hpp" // QK kernel uses the native QP event queue -#include "qmpool.hpp" // QK kernel uses the native QP memory pool -#include "qp.hpp" // QP framework -#include "qk.hpp" // QK kernel - -// initialization of the QK kernel -#define QK_INIT() QK_init() -extern "C" void QK_init(void); - -//============================================================================ -// NOTE1: -// The intrinsic functions __builtin_disable_interrupts() and -// __builtin_enable_interrupts() use the DI (disable interrupts) and -// EI (enable interrupts) instruction, unconditional disabling and enabling -// of interrupts. The DI instruction only disables interrupts with priority -// levels 1-6. Priority level 7 interrupts and all trap events still have -// the ability to interrupt the CPU when the DI instruction is active. -// This means that from the perspective of QP framework, the level 7 interrupts -// are treated "kernel unaware" interrupts or non-maskable interrupts. -// Such "kernel unaware" interrupts **cannot** call any QP services. -// In particular, they cannot post events. -// -// CAUTION: This QP port assumes that interrupt nesting is **enabled**, -// which is the default in the PIC32 processors. Interrupt nesting should -// never be disabled by setting the NSTDIS control bit (INTCON1<15>). If you -// don't want interrupts to nest, you can always prioritize them at the same -// level. For example, the default priority level for all interrupts is 4 out -// of reset. If you don't change this level for any interrupt the nesting of -// interrupt will not occur. -// - -#endif // QP_PORT_HPP_ - diff --git a/ports/pic32/qk/xc32/qs_port.hpp b/ports/pic32/qk/xc32/qs_port.hpp deleted file mode 100644 index 4ddb938b..00000000 --- a/ports/pic32/qk/xc32/qs_port.hpp +++ /dev/null @@ -1,57 +0,0 @@ -//============================================================================ -// QP/C++ Real-Time Embedded Framework (RTEF) -// -// Q u a n t u m L e a P s -// ------------------------ -// Modern Embedded Software -// -// Copyright (C) 2005 Quantum Leaps, LLC. All rights reserved. -// -// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-QL-commercial -// -// This software is dual-licensed under the terms of the open source GNU -// General Public License version 3 (or any later version), or alternatively, -// under the terms of one of the closed source Quantum Leaps commercial -// licenses. -// -// The terms of the open source GNU General Public License version 3 -// can be found at: -// -// The terms of the closed source Quantum Leaps commercial licenses -// can be found at: -// -// Redistributions in source code must retain this top-level comment block. -// Plagiarizing this software to sidestep the license obligations is illegal. -// -// Contact information: -// -// -//============================================================================ -//! @date Last updated on: 2024-06-06 -//! @version Last updated for: @ref qpcpp_7_4_0 -//! -//! @file -//! @brief QS/C++ port to a 32-bit CPU, generic C++11 compiler - -#ifndef QS_PORT_HPP_ -#define QS_PORT_HPP_ - -// object pointer size in bytes -#define QS_OBJ_PTR_SIZE 4U - -// function pointer size in bytes -#define QS_FUN_PTR_SIZE 4U - -//============================================================================ -// NOTE: QS might be used with or without other QP components, in which -// case the separate definitions of the macros QF_CRIT_STAT, QF_CRIT_ENTRY(), -// and QF_CRIT_EXIT() are needed. In this port QS is configured to be used -// with the other QP component, by simply including "qp_port.hpp" -// *before* "qs.hpp". -#ifndef QP_PORT_HPP_ -#include "qp_port.hpp" // use QS with QP -#endif - -#include "qs.hpp" // QS platform-independent public interface - -#endif // QS_PORT_HPP_ diff --git a/ports/pic32/qutest/xc32/qp_port.hpp b/ports/pic32/qutest/xc32/qp_port.hpp deleted file mode 100644 index 51539a6c..00000000 --- a/ports/pic32/qutest/xc32/qp_port.hpp +++ /dev/null @@ -1,104 +0,0 @@ -//============================================================================ -// QP/C++ Real-Time Embedded Framework (RTEF) -// -// Q u a n t u m L e a P s -// ------------------------ -// Modern Embedded Software -// -// Copyright (C) 2005 Quantum Leaps, LLC . -// -// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-QL-commercial -// -// This software is dual-licensed under the terms of the open source GNU -// General Public License version 3 (or any later version), or alternatively, -// under the terms of one of the closed source Quantum Leaps commercial -// licenses. -// -// The terms of the open source GNU General Public License version 3 -// can be found at: -// -// The terms of the closed source Quantum Leaps commercial licenses -// can be found at: -// -// Redistributions in source code must retain this top-level comment block. -// Plagiarizing this software to sidestep the license obligations is illegal. -// -// Contact information: -// -// -//============================================================================ -//! @date Last updated on: 2023-09-07 -//! @version Last updated for: @ref qpcpp_7_3_0 -//! -//! @file -//! @brief QP/C++ port for QUTEST Unit Test, PIC32 - -#ifndef QP_PORT_HPP_ -#define QP_PORT_HPP_ - -#include // Exact-width types. C++11 Standard - -#ifdef QP_CONFIG -#include "qp_config.hpp" // external QP configuration -#endif - -// no-return function specifier (C++11 Standard) -#define Q_NORETURN [[ noreturn ]] void - -// QF configuration for QK -- data members of the QActive class... - -// QActive event queue type -#define QACTIVE_EQUEUE_TYPE QEQueue -// QACTIVE_OS_OBJ_TYPE not used in this port -// QACTIVE_THREAD_TYPE not used in this port - -// QF interrupt disable/enable -#define QF_INT_DISABLE() (++QP::QF::intLock_) -#define QF_INT_ENABLE() (--QP::QF::intLock_) - -// QF critical section -#define QF_CRIT_STAT -#define QF_CRIT_ENTRY() QF_INT_DISABLE() -#define QF_CRIT_EXIT() QF_INT_ENABLE() - -// QF_LOG2 not defined -- use the internal LOG2() implementation - -// include files ------------------------------------------------------------- -#include "qequeue.hpp" // QUTest port uses QEQueue event-queue -#include "qmpool.hpp" // QUTest port uses QMPool memory-pool -#include "qp.hpp" // QP framework - -//============================================================================ -// interface used only inside QF implementation, but not in applications - -#ifdef QP_IMPL - - // scheduler locking (not used in QUTest) - #define QF_SCHED_STAT_ - #define QF_SCHED_LOCK_(dummy) (static_cast(0)) - #define QF_SCHED_UNLOCK_() (static_cast(0)) - - // native event queue operations - #define QACTIVE_EQUEUE_WAIT_(me_) \ - Q_ASSERT_INCRIT(302, (me_)->m_eQueue.m_frontEvt != nullptr) -#ifndef Q_UNSAFE - #define QACTIVE_EQUEUE_SIGNAL_(me_) \ - QF::readySet_.insert(static_cast((me_)->m_prio)); \ - QF::readySet_.update_(&QF::readySet_dis) -#else - QF::readySet_.insert(static_cast((me_)->m_prio)) -#endif - - // native QF event pool operations - #define QF_EPOOL_TYPE_ QMPool - #define QF_EPOOL_INIT_(p_, poolSto_, poolSize_, evtSize_) \ - (p_).init((poolSto_), (poolSize_), (evtSize_)) - #define QF_EPOOL_EVENT_SIZE_(p_) ((p_).getBlockSize()) - #define QF_EPOOL_GET_(p_, e_, m_, qsId_) \ - ((e_) = static_cast((p_).get((m_), (qsId_)))) - #define QF_EPOOL_PUT_(p_, e_, qsId_) ((p_).put((e_), (qsId_))) - -#endif // QP_IMPL - -#endif // QP_PORT_HPP_ - diff --git a/ports/pic32/qutest/xc32/qs_port.hpp b/ports/pic32/qutest/xc32/qs_port.hpp deleted file mode 100644 index 4ddb938b..00000000 --- a/ports/pic32/qutest/xc32/qs_port.hpp +++ /dev/null @@ -1,57 +0,0 @@ -//============================================================================ -// QP/C++ Real-Time Embedded Framework (RTEF) -// -// Q u a n t u m L e a P s -// ------------------------ -// Modern Embedded Software -// -// Copyright (C) 2005 Quantum Leaps, LLC. All rights reserved. -// -// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-QL-commercial -// -// This software is dual-licensed under the terms of the open source GNU -// General Public License version 3 (or any later version), or alternatively, -// under the terms of one of the closed source Quantum Leaps commercial -// licenses. -// -// The terms of the open source GNU General Public License version 3 -// can be found at: -// -// The terms of the closed source Quantum Leaps commercial licenses -// can be found at: -// -// Redistributions in source code must retain this top-level comment block. -// Plagiarizing this software to sidestep the license obligations is illegal. -// -// Contact information: -// -// -//============================================================================ -//! @date Last updated on: 2024-06-06 -//! @version Last updated for: @ref qpcpp_7_4_0 -//! -//! @file -//! @brief QS/C++ port to a 32-bit CPU, generic C++11 compiler - -#ifndef QS_PORT_HPP_ -#define QS_PORT_HPP_ - -// object pointer size in bytes -#define QS_OBJ_PTR_SIZE 4U - -// function pointer size in bytes -#define QS_FUN_PTR_SIZE 4U - -//============================================================================ -// NOTE: QS might be used with or without other QP components, in which -// case the separate definitions of the macros QF_CRIT_STAT, QF_CRIT_ENTRY(), -// and QF_CRIT_EXIT() are needed. In this port QS is configured to be used -// with the other QP component, by simply including "qp_port.hpp" -// *before* "qs.hpp". -#ifndef QP_PORT_HPP_ -#include "qp_port.hpp" // use QS with QP -#endif - -#include "qs.hpp" // QS platform-independent public interface - -#endif // QS_PORT_HPP_ diff --git a/ports/pic32/qv/xc32/qp_port.hpp b/ports/pic32/qv/xc32/qp_port.hpp deleted file mode 100644 index d6a9d8f9..00000000 --- a/ports/pic32/qv/xc32/qp_port.hpp +++ /dev/null @@ -1,97 +0,0 @@ -//============================================================================ -// QP/C++ Real-Time Embedded Framework (RTEF) -// -// Q u a n t u m L e a P s -// ------------------------ -// Modern Embedded Software -// -// Copyright (C) 2005 Quantum Leaps, LLC . -// -// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-QL-commercial -// -// This software is dual-licensed under the terms of the open source GNU -// General Public License version 3 (or any later version), or alternatively, -// under the terms of one of the closed source Quantum Leaps commercial -// licenses. -// -// The terms of the open source GNU General Public License version 3 -// can be found at: -// -// The terms of the closed source Quantum Leaps commercial licenses -// can be found at: -// -// Redistributions in source code must retain this top-level comment block. -// Plagiarizing this software to sidestep the license obligations is illegal. -// -// Contact information: -// -// -//============================================================================ -//! @date Last updated on: 2023-09-07 -//! @version Last updated for: @ref qpcpp_7_3_0 -//! -//! @file -//! @brief QP/C++ port to PIC32, cooperative QV kernel, MPLAB-X XC32 - -#ifndef QP_PORT_HPP_ -#define QP_PORT_HPP_ - -#include // Exact-width types. C++11 Standard -#include // for _clz() - -#ifdef QP_CONFIG -#include "qp_config.hpp" // external QP configuration -#endif - -// no-return function specifier (C++11 Standard) -#define Q_NORETURN [[ noreturn ]] void - -// QF configuration for QK -- data members of the QActive class... - -// QActive event queue type -#define QACTIVE_EQUEUE_TYPE QEQueue -// QACTIVE_OS_OBJ_TYPE not used in this port -// QACTIVE_THREAD_TYPE not used in this port - -// QF interrupt disable/enable, see NOTE1 -#define QF_INT_DISABLE() __builtin_disable_interrupts() -#define QF_INT_ENABLE() __builtin_enable_interrupts() - -// QF critical section entry/exit, see NOTE1 -#define QF_CRIT_STAT -#define QF_CRIT_ENTRY() QF_INT_DISABLE() -#define QF_CRIT_EXIT() QF_INT_ENABLE() - -// fast log-base-2 with CLZ instruction -#define QF_LOG2(n_) (static_cast(32U - _clz(n_))) - -// include files ------------------------------------------------------------- -#include "qequeue.hpp" // QV kernel uses the native QP event queue -#include "qmpool.hpp" // QV kernel uses the native QP memory pool -#include "qp.hpp" // QP framework -#include "qv.hpp" // QV kernel - -//============================================================================ -// NOTE1: -// The intrinsic functions __builtin_disable_interrupts() and -// __builtin_enable_interrupts() use the DI (disable interrupts) and -// EI (enable interrupts) instruction, unconditional disabling and enabling -// of interrupts. The DI instruction only disables interrupts with priority -// levels 1-6. Priority level 7 interrupts and all trap events still have -// the ability to interrupt the CPU when the DI instruction is active. -// This means that from the perspective of QP framework, the level 7 interrupts -// are treated "kernel unaware" interrupts or non-maskable interrupts. -// Such "kernel unaware" interrupts **cannot** call any QP services. -// In particular, they cannot post events. -// -// CAUTION: This QP port assumes that interrupt nesting is **enabled**, -// which is the default in the PIC32 processors. Interrupt nesting should -// never be disabled by setting the NSTDIS control bit (INTCON1<15>). If you -// don't want interrupts to nest, you can always prioritize them at the same -// level. For example, the default priority level for all interrupts is 4 out -// of reset. If you don't change this level for any interrupt the nesting of -// interrupt will not occur. -// - -#endif // QP_PORT_HPP_ - diff --git a/ports/pic32/qv/xc32/qs_port.hpp b/ports/pic32/qv/xc32/qs_port.hpp deleted file mode 100644 index 4ddb938b..00000000 --- a/ports/pic32/qv/xc32/qs_port.hpp +++ /dev/null @@ -1,57 +0,0 @@ -//============================================================================ -// QP/C++ Real-Time Embedded Framework (RTEF) -// -// Q u a n t u m L e a P s -// ------------------------ -// Modern Embedded Software -// -// Copyright (C) 2005 Quantum Leaps, LLC. All rights reserved. -// -// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-QL-commercial -// -// This software is dual-licensed under the terms of the open source GNU -// General Public License version 3 (or any later version), or alternatively, -// under the terms of one of the closed source Quantum Leaps commercial -// licenses. -// -// The terms of the open source GNU General Public License version 3 -// can be found at: -// -// The terms of the closed source Quantum Leaps commercial licenses -// can be found at: -// -// Redistributions in source code must retain this top-level comment block. -// Plagiarizing this software to sidestep the license obligations is illegal. -// -// Contact information: -// -// -//============================================================================ -//! @date Last updated on: 2024-06-06 -//! @version Last updated for: @ref qpcpp_7_4_0 -//! -//! @file -//! @brief QS/C++ port to a 32-bit CPU, generic C++11 compiler - -#ifndef QS_PORT_HPP_ -#define QS_PORT_HPP_ - -// object pointer size in bytes -#define QS_OBJ_PTR_SIZE 4U - -// function pointer size in bytes -#define QS_FUN_PTR_SIZE 4U - -//============================================================================ -// NOTE: QS might be used with or without other QP components, in which -// case the separate definitions of the macros QF_CRIT_STAT, QF_CRIT_ENTRY(), -// and QF_CRIT_EXIT() are needed. In this port QS is configured to be used -// with the other QP component, by simply including "qp_port.hpp" -// *before* "qs.hpp". -#ifndef QP_PORT_HPP_ -#include "qp_port.hpp" // use QS with QP -#endif - -#include "qs.hpp" // QS platform-independent public interface - -#endif // QS_PORT_HPP_ diff --git a/ports/posix-qutest/qutest_port.cpp b/ports/posix-qutest/qutest_port.cpp index cbf801c9..3fb7f943 100644 --- a/ports/posix-qutest/qutest_port.cpp +++ b/ports/posix-qutest/qutest_port.cpp @@ -63,7 +63,7 @@ namespace { // unnamed local namespace -Q_THIS_MODULE("qutest_port"); +Q_DEFINE_THIS_MODULE("qutest_port") // local variables ........................................................... static int l_sock = INVALID_SOCKET; diff --git a/ports/posix-qv/qf_port.cpp b/ports/posix-qv/qf_port.cpp index 7c8a88dc..8ba44b12 100644 --- a/ports/posix-qv/qf_port.cpp +++ b/ports/posix-qv/qf_port.cpp @@ -54,7 +54,7 @@ namespace { // unnamed local namespace -Q_THIS_MODULE("qf_port"); +Q_DEFINE_THIS_MODULE("qf_port") // Local objects ============================================================= diff --git a/ports/posix/qf_port.cpp b/ports/posix/qf_port.cpp index 18d248b2..32ac32a0 100644 --- a/ports/posix/qf_port.cpp +++ b/ports/posix/qf_port.cpp @@ -54,7 +54,7 @@ namespace { // unnamed local namespace -Q_THIS_MODULE("qf_port"); +Q_DEFINE_THIS_MODULE("qf_port") // Local objects ============================================================= // initialize the startup mutex with default non-recursive initializer diff --git a/ports/threadx/qf_port.cpp b/ports/threadx/qf_port.cpp index a7628459..0e3af62f 100644 --- a/ports/threadx/qf_port.cpp +++ b/ports/threadx/qf_port.cpp @@ -42,7 +42,7 @@ //============================================================================ namespace { // anonymous namespace with local definitions -Q_THIS_MODULE("qf_port"); +Q_DEFINE_THIS_MODULE("qf_port") static void thread_function(ULONG thread_input); // prototype static void thread_function(ULONG thread_input) { // ThreadX signature diff --git a/ports/uc-os2/qf_port.cpp b/ports/uc-os2/qf_port.cpp index ef8cea32..b5f87bb9 100644 --- a/ports/uc-os2/qf_port.cpp +++ b/ports/uc-os2/qf_port.cpp @@ -42,7 +42,7 @@ //============================================================================ namespace { // anonymous namespace with local definitions -Q_THIS_MODULE("qf_port"); +Q_DEFINE_THIS_MODULE("qf_port") //............................................................................ static void task_function(void *pdata); // prototype diff --git a/ports/win32-qutest/qutest_port.cpp b/ports/win32-qutest/qutest_port.cpp index a287a0f7..34bc5a48 100644 --- a/ports/win32-qutest/qutest_port.cpp +++ b/ports/win32-qutest/qutest_port.cpp @@ -61,7 +61,7 @@ namespace { // unnamed local namespace -Q_THIS_MODULE("qutest_port"); +Q_DEFINE_THIS_MODULE("qutest_port") // local variables ........................................................... static SOCKET l_sock = INVALID_SOCKET; diff --git a/ports/win32-qv/qf_port.cpp b/ports/win32-qv/qf_port.cpp index 86127909..6def5657 100644 --- a/ports/win32-qv/qf_port.cpp +++ b/ports/win32-qv/qf_port.cpp @@ -44,7 +44,7 @@ namespace { // unnamed local namespace -Q_THIS_MODULE("qf_port"); +Q_DEFINE_THIS_MODULE("qf_port") // Local objects ============================================================= static DWORD l_tickMsec = 10U; // clock tick in msec (argument for Sleep()) diff --git a/ports/win32-qv/qs_port.cpp b/ports/win32-qv/qs_port.cpp index 23b03a3a..2241a524 100644 --- a/ports/win32-qv/qs_port.cpp +++ b/ports/win32-qv/qs_port.cpp @@ -63,7 +63,7 @@ namespace { // unnamed local namespace -//Q_THIS_MODULE("qs_port"); +//Q_DEFINE_THIS_MODULE("qs_port") // local variables ........................................................... static SOCKET l_sock = INVALID_SOCKET; diff --git a/ports/win32/qf_port.cpp b/ports/win32/qf_port.cpp index 68e826bb..94a263ab 100644 --- a/ports/win32/qf_port.cpp +++ b/ports/win32/qf_port.cpp @@ -44,7 +44,7 @@ namespace { // unnamed local namespace -Q_THIS_MODULE("qf_port"); +Q_DEFINE_THIS_MODULE("qf_port") // Local objects ============================================================= static CRITICAL_SECTION l_startupCritSect; diff --git a/ports/win32/qs_port.cpp b/ports/win32/qs_port.cpp index 23b03a3a..2241a524 100644 --- a/ports/win32/qs_port.cpp +++ b/ports/win32/qs_port.cpp @@ -63,7 +63,7 @@ namespace { // unnamed local namespace -//Q_THIS_MODULE("qs_port"); +//Q_DEFINE_THIS_MODULE("qs_port") // local variables ........................................................... static SOCKET l_sock = INVALID_SOCKET; diff --git a/qpcpp.md5 b/qpcpp.md5 index 6e76ec51..2e0c798f 100644 --- a/qpcpp.md5 +++ b/qpcpp.md5 @@ -1,52 +1,52 @@ -4469fab0d2e1a5bc0f46c66bb4e14950 *qpcpp.qm +67279dff151fd1c78ec44fcbf7d38a83 *qpcpp.qm 2c7717f261e842ae0449a321d3c50f3e *include/qequeue.hpp fe1ff6084ff592ca8d14a6efffec296c *include/qk.hpp 0cf7c36bbbca2e0ebfe61347e9e572e5 *include/qmpool.hpp c53660e6bdc9a4a449b67238a3cab402 *include/qp.hpp 61c7a3aa8cb265f478915f39b7fae9cc *include/qp_pkg.hpp -f50107f2d9da11f3195a0bfedaccd0bb *include/qpcpp.hpp +5fd2515efbc5c06e02bb1a4200490b58 *include/qpcpp.hpp be2da5d56117fd172f12c8b6589f6402 *include/qs.hpp d59808009be96849963572ffcbf9dceb *include/qs_dummy.hpp db4013ceefb33498f5d38e15d0cb9323 *include/qs_pkg.hpp -5d6a9127fbdf26dd00afb4c8a9afdf48 *include/qsafe.h +f59bf88705afe5b0acc999f8b47a6745 *include/qsafe.h e66cf5dd191fb0e7c1f8660fb477b860 *include/qstamp.hpp d42a19307ba3c0c5b890431767f35b42 *include/qv.hpp c0bc33e3823dde00803a301c4b85637d *include/qxk.hpp ccc88dc7734a312ee0e33c437db7f3eb *src/qf/CMakeLists.txt -5f243aa4c27970e12944259c1d308584 *src/qf/qep_hsm.cpp -bea7060e960e7ca1385f1b095ba3c12c *src/qf/qep_msm.cpp -edd96fa32a3ce8b390ffda5b6d96d392 *src/qf/qf_act.cpp -d7c78a998270cf6428d2e4ed6d91c342 *src/qf/qf_actq.cpp -db79b0167b049c76c3afc28e42408003 *src/qf/qf_defer.cpp -24a2f1ced3ce7d3f188bb1292970f691 *src/qf/qf_dyn.cpp -5551f2839dcd803ea3b724389923b5fc *src/qf/qf_mem.cpp -7c95f61b64311775b6cd1009743e32bd *src/qf/qf_ps.cpp -1f829d5162dc8396f8401092e7179ff9 *src/qf/qf_qact.cpp -ea546e493bd589d27f182c3b40420ca8 *src/qf/qf_qeq.cpp -2decf765c4d4e344481b7f0b4606e1cb *src/qf/qf_qmact.cpp -d1ba885f8b7056bf0562afaa2fd41560 *src/qf/qf_time.cpp +3818b4ab7f65c89aa625026cb2239d64 *src/qf/qep_hsm.cpp +ef8a65f8e71d162b23847fdac5d25a77 *src/qf/qep_msm.cpp +8b5c1ece58069ed5582864fd2dc58167 *src/qf/qf_act.cpp +919a274413898e2e929e44eba29a4712 *src/qf/qf_actq.cpp +39b02b596faa57abfa96b0f7c3f7fb82 *src/qf/qf_defer.cpp +fb9824985c3657f8016f3cf339b1f6e1 *src/qf/qf_dyn.cpp +83d38b1377e52db75950f1a4d4b47e8a *src/qf/qf_mem.cpp +37cfa5b9419f1e00608267ff29fbc1a8 *src/qf/qf_ps.cpp +19cf8976578a43e93bfbb51dbe932b6c *src/qf/qf_qact.cpp +c412dc07bc76eadbfb9d9d54e3206ed7 *src/qf/qf_qeq.cpp +816dc7182f4014539f6f5304782ddb7b *src/qf/qf_qmact.cpp +c551aafbf9ecba93cfdb12f81fbfba61 *src/qf/qf_time.cpp 4dc7ca60248f4c13034e6f2481c7663d *src/qk/CMakeLists.txt -497be0d57fe3b71d757baca0f1620c8a *src/qk/qk.cpp +1a314e2a9fba927f6648772121790c5f *src/qk/qk.cpp 2557d617414f8cbdcbfeaab619d296bb *src/qs/CMakeLists.txt -cd804548ce6a76c9596780b1505d9f4e *src/qs/qs.cpp +bd1870c2a952b47ef613cc67406aca80 *src/qs/qs.cpp a2ca20b2332d025067645839e4b25711 *src/qs/qs_64bit.cpp 8f6551c7786fdbb106c3d1bc7824c060 *src/qs/qs_fp.cpp -09dbf5dd4a68ff7da143654995e1f3f4 *src/qs/qs_rx.cpp +4af89f114491668f7a26af694ff11993 *src/qs/qs_rx.cpp 2655cd10d009075b71a84368fb6bf4d4 *src/qs/qstamp.cpp -b8c6040d23d3d094f7e55f10fc312e2e *src/qs/qutest.cpp +f94d98e4b0ce47d5c2e3b99f3eba0ad1 *src/qs/qutest.cpp cf2fae9b29aab50c5cd69d7d519cb0db *src/qv/CMakeLists.txt -ac79b30b0bcd3632040621247fa7e153 *src/qv/qv.cpp +abfb725ec432f1f56b72e2be4c62e9d3 *src/qv/qv.cpp 3c916b7d6a6ce58963153f51801858df *src/qxk/CMakeLists.txt -806f62e2418992b7792eb3abd2a49dce *src/qxk/qxk.cpp -496fb9e20a9cf77a4ed0b2977862fe73 *src/qxk/qxk_mutex.cpp -1447b659b74b65745424a11e5e1e67b2 *src/qxk/qxk_sema.cpp -ce943a78376c41d0e0626af4649ee5f5 *src/qxk/qxk_xthr.cpp +7fed39c66ef913b79b82116b54af21de *src/qxk/qxk.cpp +309a3f6772f0cadfa8e50b545852b995 *src/qxk/qxk_mutex.cpp +ce5ff1926bd91dd8683e0232d3e1d471 *src/qxk/qxk_sema.cpp +78ec1d0d6aa9efbdc8b3d09e6deea40e *src/qxk/qxk_xthr.cpp bf56a383eb7dafafa408d6219b585b40 *ports/lint-plus/au-autosar.lnt e3e3f3000f9a80a446255ef52f3a6299 *ports/lint-plus/au-autosar19.lnt 2a8fea61bccbe5e8c7536a29f2ec8e98 *ports/lint-plus/au-ds.lnt ede719cdbc201d14586a3f11e77ced26 *ports/lint-plus/au-ql-cpp11.lnt 3935c8cc585d08999ba9fb9055cc3705 *ports/lint-plus/options.lnt -ea62ecc14fa90335f43506c014aff82f *ports/lint-plus/qpcpp.lnt +1b5e00e26e585610472a2a9d93a69a86 *ports/lint-plus/qpcpp.lnt 5f789348dba099c2055f737ba756faac *ports/lint-plus/std.lnt 1f3d9dfbf71077abbdb9f27c96879101 *ports/arm-cm/qk/armclang/qk_port.cpp aba379ac6a39b1f21057bed8156f0516 *ports/arm-cm/qk/armclang/qp_port.hpp @@ -108,34 +108,34 @@ f06c0d53c5c9918f08e99e01e20af046 *ports/pic32/qutest/xc32/qp_port.hpp 41482d0d440eee366e7b4814c6d10235 *ports/pic32/qutest/xc32/qs_port.hpp bbfb2c7c7901538009f523b4837501cd *ports/config/qp_config.hpp 906dd67f13bf4cdfb83afc1c59c57ed2 *ports/embos/CMakeLists.txt -14670bed5a8d748ca4d04c8361aa93c1 *ports/embos/qf_port.cpp +ea7316a161f815978b90d97060e58fcb *ports/embos/qf_port.cpp 0d7461d523df40ff7e33b0be5ae47048 *ports/embos/qp_port.hpp 41482d0d440eee366e7b4814c6d10235 *ports/embos/qs_port.hpp bb18f0378bf49ece5551b7631efc3229 *ports/freertos/CMakeLists.txt -529589266ab58dd0011f86f917b03c7e *ports/freertos/qf_port.cpp +4160d8c1a4d8b68911d114e307e94d0e *ports/freertos/qf_port.cpp 0c444889e3db0ba221db1421d7a48d64 *ports/freertos/qp_port.hpp 41482d0d440eee366e7b4814c6d10235 *ports/freertos/qs_port.hpp 75e3906b6c068c7b59cf0c9a7a3c7454 *ports/threadx/CMakeLists.txt -c1db2db39efd42364a74567e6e999343 *ports/threadx/qf_port.cpp +5f101ee6196059ca3c75e021bfe1cee9 *ports/threadx/qf_port.cpp 50f5bd76fc61e90edb546f2e11fc39e8 *ports/threadx/qp_port.hpp 41482d0d440eee366e7b4814c6d10235 *ports/threadx/qs_port.hpp 23b496a982c574af2a47d01eb79e47f2 *ports/threadx/README.md ae8b2f8b0649c8dfacbf6495fa560ad8 *ports/uc-os2/CMakeLists.txt -5c15896b4c4a48a341bf9151cecb1883 *ports/uc-os2/qf_port.cpp +fb01e64494ac92398662cbbedfdd1cbf *ports/uc-os2/qf_port.cpp f3c0b50eb1d3db891235d862dc398c18 *ports/uc-os2/qp_port.hpp 41482d0d440eee366e7b4814c6d10235 *ports/uc-os2/qs_port.hpp bb83d2a07ba0eb25a09bd64da602e3fa *ports/qep-only/CMakeLists.txt ec8563c61bcb8cb4682b7bc4ffc67d0a *ports/qep-only/qp_port.hpp 7955fc33c291eb6b8ebabaae0d6bd0da *ports/qep-only/safe_std.h a29450c971859f6191f37c937b012eae *ports/posix/CMakeLists.txt -62a68bd7096339a94eb11ad6b1931b93 *ports/posix/qf_port.cpp +48df897b919e1dce4d1bb557c0a86b17 *ports/posix/qf_port.cpp 52e4d5e5d1113a3a0831aac6a44a3d21 *ports/posix/qp_port.hpp ae25ce9cf24260ec8affa08170f9d15a *ports/posix/qs_port.cpp 91e88a47256436209fc651881283230d *ports/posix/qs_port.hpp f45c6f63edac95fd0b5d9cbeaa1f3926 *ports/posix/README.md 7955fc33c291eb6b8ebabaae0d6bd0da *ports/posix/safe_std.h bbfb6bd8a58a8d5591f61b05b460cec5 *ports/posix-qv/CMakeLists.txt -ba03ece88d7cc501a01cd8a448678d9e *ports/posix-qv/qf_port.cpp +0db2a5dbadf8d3163ccd1d65b5783c0f *ports/posix-qv/qf_port.cpp 221db06f9b4381533c738f1ca177f8cf *ports/posix-qv/qp_port.hpp ae25ce9cf24260ec8affa08170f9d15a *ports/posix-qv/qs_port.cpp 91e88a47256436209fc651881283230d *ports/posix-qv/qs_port.hpp @@ -144,22 +144,22 @@ ae25ce9cf24260ec8affa08170f9d15a *ports/posix-qv/qs_port.cpp 2171085568a15c190c72b106ea3c11b6 *ports/posix-qutest/CMakeLists.txt 384bfe4407650c5c3131331cf842897e *ports/posix-qutest/qp_port.hpp 91e88a47256436209fc651881283230d *ports/posix-qutest/qs_port.hpp -2a9df5ca38111d5b773b767eacf23518 *ports/posix-qutest/qutest_port.cpp +5db99668a338817320a34b9a7297bcd8 *ports/posix-qutest/qutest_port.cpp 0ac7e3d28e684d07baacdcd0d3e65c4a *ports/posix-qutest/README.md 7955fc33c291eb6b8ebabaae0d6bd0da *ports/posix-qutest/safe_std.h 84541985a09da4e23055531452d74a02 *ports/win32/CMakeLists.txt -2f016507aedd11da5204a6526f7f353b *ports/win32/qf_port.cpp +10a6569ae463ce7f8a158aec7f3f9b8c *ports/win32/qf_port.cpp fc5a9085222501f994b6d517d6624a52 *ports/win32/qp_port.hpp -05b9621f516dc21a58133872f5b9f37e *ports/win32/qs_port.cpp +f1502789b885b14d05b6e162e0e39d00 *ports/win32/qs_port.cpp 91e88a47256436209fc651881283230d *ports/win32/qs_port.hpp a1c6143aa627599750360c58f4740129 *ports/win32/qwin_gui.c 64172552524a5e6449168adedfd858b0 *ports/win32/qwin_gui.h 84d25d92b6521b22736719d3ed33c289 *ports/win32/README.md 7955fc33c291eb6b8ebabaae0d6bd0da *ports/win32/safe_std.h 1f5c35a874db6752d1ec17f4b8ee4c19 *ports/win32-qv/CMakeLists.txt -ce003f06419053d8578c41f43b38fb2b *ports/win32-qv/qf_port.cpp +77375dc31716e07afe9fa1b4d890d00b *ports/win32-qv/qf_port.cpp 38fbe14322593c37bdfe39c121e058fb *ports/win32-qv/qp_port.hpp -05b9621f516dc21a58133872f5b9f37e *ports/win32-qv/qs_port.cpp +f1502789b885b14d05b6e162e0e39d00 *ports/win32-qv/qs_port.cpp 91e88a47256436209fc651881283230d *ports/win32-qv/qs_port.hpp a1c6143aa627599750360c58f4740129 *ports/win32-qv/qwin_gui.c 64172552524a5e6449168adedfd858b0 *ports/win32-qv/qwin_gui.h @@ -168,14 +168,14 @@ a1c6143aa627599750360c58f4740129 *ports/win32-qv/qwin_gui.c 3d3f6d71f8afe29ec99b50b17fa84b65 *ports/win32-qutest/CMakeLists.txt 384bfe4407650c5c3131331cf842897e *ports/win32-qutest/qp_port.hpp 91e88a47256436209fc651881283230d *ports/win32-qutest/qs_port.hpp -2f5eb982185544f63ea721c5975c61de *ports/win32-qutest/qutest_port.cpp +2a4e8cad19f0f30686ca79154fc5ecf8 *ports/win32-qutest/qutest_port.cpp 7955fc33c291eb6b8ebabaae0d6bd0da *ports/win32-qutest/safe_std.h 1595522f609b1198a88aff4523334557 *zephyr/CMakeLists.txt 34e76b00e1368216110b5d52d4f11a25 *zephyr/Kconfig 2140500a5b230057a2a6ed4b613f6353 *zephyr/module.yml -d25aa244b94668a50719c3efdd97cd1b *zephyr/qf_port.cpp +7aa7d1eca97fe53b0a35c2141f293425 *zephyr/qf_port.cpp 0076e0da63938ff838dd5736b6a309da *zephyr/qp-zephyr.jpg d9954ecb81ec8113083097b342a6d97e *zephyr/qp_port.hpp 0c3ef4ec33d22d9d35913de60f500852 *zephyr/qs_port.hpp -abbecdb88ed7480044f8d6747355acc0 *zephyr/qutest_port.cpp +78f9eb187a30758d7d9b002473d900fc *zephyr/qutest_port.cpp 90e5de20bfd5c83026f0c94085668e6d *zephyr/README.md diff --git a/qpcpp.qm b/qpcpp.qm index ba6d69ac..10ef6af8 100644 --- a/qpcpp.qm +++ b/qpcpp.qm @@ -9415,14 +9415,6 @@ extern char const BUILD_TIME[9]; //! @deprecated plain 'char' is no longer forbidden in MISRA/AUTOSAR-C++ using char_t = char; -//! @deprecated module name definition -//! Use Q_THIS_MODULE(name_) ended with a semicolon ';' -#define Q_DEFINE_THIS_MODULE(name_) Q_THIS_MODULE(name_); - -//! @deprecated file name definition -//! Use Q_THIS_FILE() ended with a semicolon ';' -#define Q_DEFINE_THIS_FILE Q_THIS_FILE(); - //! @deprecated assertion failure handler //! Use Q_onError() instead. #define Q_onAssert(module_, id_) Q_onError(module_, id_) @@ -9629,7 +9621,7 @@ using char_t = char; // unnamed namespace for local definitions with internal linkage namespace { -Q_THIS_MODULE("qep_hsm"); +Q_DEFINE_THIS_MODULE("qep_hsm") // immutable events corresponding to the reserved signals. static QP::QEvt const l_reservedEvt_[4] { @@ -9693,7 +9685,7 @@ $define ${QEP::QHsm} // unnamed namespace for local definitions with internal linkage namespace { -Q_THIS_MODULE("qep_msm"); +Q_DEFINE_THIS_MODULE("qep_msm") // maximum depth of state nesting in a QMsm (including the top level) static constexpr std::int_fast8_t MAX_NEST_DEPTH_ {6}; @@ -9735,7 +9727,7 @@ $define ${QEP::QMsm} // unnamed namespace for local definitions with internal linkage namespace { -//Q_THIS_MODULE("qf_act"); +//Q_DEFINE_THIS_MODULE("qf_act") } // unnamed namespace $define ${QF::QActive::registry_[QF_MAX_ACTIVE + 1U]} @@ -9760,7 +9752,7 @@ $define ${QF::types::QF_LOG2} //============================================================================ // unnamed namespace for local definitions with internal linkage namespace { -Q_THIS_MODULE("qf_actq"); +Q_DEFINE_THIS_MODULE("qf_actq") } // unnamed namespace $define ${QF::QActive::post_} @@ -9786,7 +9778,7 @@ $define ${QF::QTicker} // unnamed namespace for local definitions with internal linkage namespace { -Q_THIS_MODULE("qf_defer"); +Q_DEFINE_THIS_MODULE("qf_defer") } // unnamed namespace $define ${QF::QActive::defer} @@ -9812,7 +9804,7 @@ $define ${QF::QActive::flushDeferred} // unnamed namespace for local definitions with internal linkage namespace { -Q_THIS_MODULE("qf_dyn"); +Q_DEFINE_THIS_MODULE("qf_dyn") } // unnamed namespace $define ${QF::QF-dyn} @@ -9834,7 +9826,7 @@ $define ${QF::QF-dyn} // unnamed namespace for local definitions with internal linkage namespace { -Q_THIS_MODULE("qf_mem"); +Q_DEFINE_THIS_MODULE("qf_mem") } // unnamed namespace $define ${QF::QMPool} @@ -9854,7 +9846,7 @@ $define ${QF::QMPool} // unnamed namespace for local definitions with internal linkage namespace { -Q_THIS_MODULE("qf_qact"); +Q_DEFINE_THIS_MODULE("qf_qact") } // unnamed namespace $define ${QF::QActive::QActive} @@ -9878,7 +9870,7 @@ $define ${QF::QActive::unregister_} // unnamed namespace for local definitions with internal linkage namespace { -//Q_THIS_MODULE("qf_qmact"); +//Q_DEFINE_THIS_MODULE("qf_qmact") } // unnamed namespace $define ${QF::QMActive} @@ -9898,7 +9890,7 @@ $define ${QF::QMActive} // unnamed namespace for local definitions with internal linkage namespace { -Q_THIS_MODULE("qf_qeq"); +Q_DEFINE_THIS_MODULE("qf_qeq") } // unnamed namespace $define ${QF::QEQueue} @@ -9918,7 +9910,7 @@ $define ${QF::QEQueue} // unnamed namespace for local definitions with internal linkage namespace { -Q_THIS_MODULE("qf_ps"); +Q_DEFINE_THIS_MODULE("qf_ps") } // unnamed namespace $define ${QF::QActive::subscrList_} @@ -9950,7 +9942,7 @@ $define ${QF::QActive::unsubscribeAll} // unnamed namespace for local definitions with internal linkage namespace { -Q_THIS_MODULE("qf_time"); +Q_DEFINE_THIS_MODULE("qf_time") } // unnamed namespace $define ${QF::QTimeEvt} @@ -9978,7 +9970,7 @@ $define ${QF::QTimeEvt} // unnamed namespace for local definitions with internal linkage namespace { -Q_THIS_MODULE("qv"); +Q_DEFINE_THIS_MODULE("qv") } // unnamed namespace $define ${QV::QV-base} @@ -10010,7 +10002,7 @@ $define ${QV::QActive} // unnamed namespace for local definitions with internal linkage namespace { -Q_THIS_MODULE("qk"); +Q_DEFINE_THIS_MODULE("qk") } // unnamed namespace $define ${QK::QK-base} @@ -10046,7 +10038,7 @@ $define ${QK::QActive} // unnamed namespace for local definitions with internal linkage namespace { -Q_THIS_MODULE("qxk"); +Q_DEFINE_THIS_MODULE("qxk") } // unnamed namespace $define ${QXK::QXK-base} @@ -10079,7 +10071,7 @@ $define ${QXK::QActive} // unnamed namespace for local definitions with internal linkage namespace { -Q_THIS_MODULE("qxk_mutex"); +Q_DEFINE_THIS_MODULE("qxk_mutex") } // unnamed namespace $define ${QXK::QXMutex} @@ -10104,7 +10096,7 @@ $define ${QXK::QXMutex} // unnamed namespace for local definitions with internal linkage namespace { -Q_THIS_MODULE("qxk_sema"); +Q_DEFINE_THIS_MODULE("qxk_sema") } // unnamed namespace $define ${QXK::QXSemaphore} @@ -10129,7 +10121,7 @@ $define ${QXK::QXSemaphore} // unnamed namespace for local definitions with internal linkage namespace { -Q_THIS_MODULE("qxk_xthr"); +Q_DEFINE_THIS_MODULE("qxk_xthr") } // unnamed namespace $define ${QXK::QXThread} @@ -10147,7 +10139,7 @@ $define ${QXK::QXThread} // unnamed namespace for local definitions with internal linkage namespace { -Q_THIS_MODULE("qs"); +Q_DEFINE_THIS_MODULE("qs") } // unnamed namespace $define ${QS::QS-TX} @@ -11227,7 +11219,7 @@ void f64_fmt_( namespace { // unnamed local namespace -Q_THIS_MODULE("qs_rx"); +Q_DEFINE_THIS_MODULE("qs_rx") enum RxStateEnum : std::uint8_t { ERROR_STATE, @@ -12395,7 +12387,7 @@ Q_NORETURN Q_onError( // unnamed namespace for local definitions with internal linkage namespace { -Q_THIS_MODULE("qutest"); +Q_DEFINE_THIS_MODULE("qutest") } // unnamed namespace namespace QP { diff --git a/src/qf/qep_hsm.cpp b/src/qf/qep_hsm.cpp index 70a9e182..010c0f3b 100644 --- a/src/qf/qep_hsm.cpp +++ b/src/qf/qep_hsm.cpp @@ -56,7 +56,7 @@ // unnamed namespace for local definitions with internal linkage namespace { -Q_THIS_MODULE("qep_hsm"); +Q_DEFINE_THIS_MODULE("qep_hsm") // immutable events corresponding to the reserved signals. static QP::QEvt const l_reservedEvt_[4] { diff --git a/src/qf/qep_msm.cpp b/src/qf/qep_msm.cpp index 2ad9fa7e..a83c8958 100644 --- a/src/qf/qep_msm.cpp +++ b/src/qf/qep_msm.cpp @@ -57,7 +57,7 @@ // unnamed namespace for local definitions with internal linkage namespace { -Q_THIS_MODULE("qep_msm"); +Q_DEFINE_THIS_MODULE("qep_msm") // maximum depth of state nesting in a QMsm (including the top level) static constexpr std::int_fast8_t MAX_NEST_DEPTH_ {6}; diff --git a/src/qf/qf_act.cpp b/src/qf/qf_act.cpp index 53b7bfe5..970ebead 100644 --- a/src/qf/qf_act.cpp +++ b/src/qf/qf_act.cpp @@ -53,7 +53,7 @@ // unnamed namespace for local definitions with internal linkage namespace { -//Q_THIS_MODULE("qf_act"); +//Q_DEFINE_THIS_MODULE("qf_act") } // unnamed namespace //$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv diff --git a/src/qf/qf_actq.cpp b/src/qf/qf_actq.cpp index 2e447b9d..a5234e2d 100644 --- a/src/qf/qf_actq.cpp +++ b/src/qf/qf_actq.cpp @@ -54,7 +54,7 @@ //============================================================================ // unnamed namespace for local definitions with internal linkage namespace { -Q_THIS_MODULE("qf_actq"); +Q_DEFINE_THIS_MODULE("qf_actq") } // unnamed namespace //$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv diff --git a/src/qf/qf_defer.cpp b/src/qf/qf_defer.cpp index 17a3e171..9d97b2c8 100644 --- a/src/qf/qf_defer.cpp +++ b/src/qf/qf_defer.cpp @@ -53,7 +53,7 @@ // unnamed namespace for local definitions with internal linkage namespace { -Q_THIS_MODULE("qf_defer"); +Q_DEFINE_THIS_MODULE("qf_defer") } // unnamed namespace //$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv diff --git a/src/qf/qf_dyn.cpp b/src/qf/qf_dyn.cpp index f6931ac8..18b5db75 100644 --- a/src/qf/qf_dyn.cpp +++ b/src/qf/qf_dyn.cpp @@ -55,7 +55,7 @@ // unnamed namespace for local definitions with internal linkage namespace { -Q_THIS_MODULE("qf_dyn"); +Q_DEFINE_THIS_MODULE("qf_dyn") } // unnamed namespace //$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv diff --git a/src/qf/qf_mem.cpp b/src/qf/qf_mem.cpp index a9701f1a..a5d51079 100644 --- a/src/qf/qf_mem.cpp +++ b/src/qf/qf_mem.cpp @@ -53,7 +53,7 @@ // unnamed namespace for local definitions with internal linkage namespace { -Q_THIS_MODULE("qf_mem"); +Q_DEFINE_THIS_MODULE("qf_mem") } // unnamed namespace //$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv diff --git a/src/qf/qf_ps.cpp b/src/qf/qf_ps.cpp index 16c4e5b6..6b85156c 100644 --- a/src/qf/qf_ps.cpp +++ b/src/qf/qf_ps.cpp @@ -53,7 +53,7 @@ // unnamed namespace for local definitions with internal linkage namespace { -Q_THIS_MODULE("qf_ps"); +Q_DEFINE_THIS_MODULE("qf_ps") } // unnamed namespace //$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv diff --git a/src/qf/qf_qact.cpp b/src/qf/qf_qact.cpp index 92532bf2..b9a103db 100644 --- a/src/qf/qf_qact.cpp +++ b/src/qf/qf_qact.cpp @@ -53,7 +53,7 @@ // unnamed namespace for local definitions with internal linkage namespace { -Q_THIS_MODULE("qf_qact"); +Q_DEFINE_THIS_MODULE("qf_qact") } // unnamed namespace //$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv diff --git a/src/qf/qf_qeq.cpp b/src/qf/qf_qeq.cpp index 6d7b7b51..d1d86775 100644 --- a/src/qf/qf_qeq.cpp +++ b/src/qf/qf_qeq.cpp @@ -53,7 +53,7 @@ // unnamed namespace for local definitions with internal linkage namespace { -Q_THIS_MODULE("qf_qeq"); +Q_DEFINE_THIS_MODULE("qf_qeq") } // unnamed namespace //$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv diff --git a/src/qf/qf_qmact.cpp b/src/qf/qf_qmact.cpp index 7aa62f58..1fb6bde1 100644 --- a/src/qf/qf_qmact.cpp +++ b/src/qf/qf_qmact.cpp @@ -53,7 +53,7 @@ // unnamed namespace for local definitions with internal linkage namespace { -//Q_THIS_MODULE("qf_qmact"); +//Q_DEFINE_THIS_MODULE("qf_qmact") } // unnamed namespace //$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv diff --git a/src/qf/qf_time.cpp b/src/qf/qf_time.cpp index 7f20f511..711f70a5 100644 --- a/src/qf/qf_time.cpp +++ b/src/qf/qf_time.cpp @@ -53,7 +53,7 @@ // unnamed namespace for local definitions with internal linkage namespace { -Q_THIS_MODULE("qf_time"); +Q_DEFINE_THIS_MODULE("qf_time") } // unnamed namespace //$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv diff --git a/src/qk/qk.cpp b/src/qk/qk.cpp index 68d51d82..1dc7e9a7 100644 --- a/src/qk/qk.cpp +++ b/src/qk/qk.cpp @@ -58,7 +58,7 @@ // unnamed namespace for local definitions with internal linkage namespace { -Q_THIS_MODULE("qk"); +Q_DEFINE_THIS_MODULE("qk") } // unnamed namespace //$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv diff --git a/src/qs/qs.cpp b/src/qs/qs.cpp index 1a89e74e..71d131aa 100644 --- a/src/qs/qs.cpp +++ b/src/qs/qs.cpp @@ -48,7 +48,7 @@ // unnamed namespace for local definitions with internal linkage namespace { -Q_THIS_MODULE("qs"); +Q_DEFINE_THIS_MODULE("qs") } // unnamed namespace //$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv diff --git a/src/qs/qs_rx.cpp b/src/qs/qs_rx.cpp index ce2823c3..b01a6c35 100644 --- a/src/qs/qs_rx.cpp +++ b/src/qs/qs_rx.cpp @@ -51,7 +51,7 @@ namespace { // unnamed local namespace -Q_THIS_MODULE("qs_rx"); +Q_DEFINE_THIS_MODULE("qs_rx") enum RxStateEnum : std::uint8_t { ERROR_STATE, diff --git a/src/qs/qutest.cpp b/src/qs/qutest.cpp index 088d9454..fc00fede 100644 --- a/src/qs/qutest.cpp +++ b/src/qs/qutest.cpp @@ -154,7 +154,7 @@ Q_NORETURN Q_onError( // unnamed namespace for local definitions with internal linkage namespace { -Q_THIS_MODULE("qutest"); +Q_DEFINE_THIS_MODULE("qutest") } // unnamed namespace namespace QP { diff --git a/src/qv/qv.cpp b/src/qv/qv.cpp index 06d7dda7..f7a0116c 100644 --- a/src/qv/qv.cpp +++ b/src/qv/qv.cpp @@ -58,7 +58,7 @@ // unnamed namespace for local definitions with internal linkage namespace { -Q_THIS_MODULE("qv"); +Q_DEFINE_THIS_MODULE("qv") } // unnamed namespace //$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv diff --git a/src/qxk/qxk.cpp b/src/qxk/qxk.cpp index c64d98d5..d52d078d 100644 --- a/src/qxk/qxk.cpp +++ b/src/qxk/qxk.cpp @@ -58,7 +58,7 @@ // unnamed namespace for local definitions with internal linkage namespace { -Q_THIS_MODULE("qxk"); +Q_DEFINE_THIS_MODULE("qxk") } // unnamed namespace //$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv diff --git a/src/qxk/qxk_mutex.cpp b/src/qxk/qxk_mutex.cpp index d12a460f..52f23c74 100644 --- a/src/qxk/qxk_mutex.cpp +++ b/src/qxk/qxk_mutex.cpp @@ -58,7 +58,7 @@ // unnamed namespace for local definitions with internal linkage namespace { -Q_THIS_MODULE("qxk_mutex"); +Q_DEFINE_THIS_MODULE("qxk_mutex") } // unnamed namespace //$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv diff --git a/src/qxk/qxk_sema.cpp b/src/qxk/qxk_sema.cpp index 1d1faec7..e9740610 100644 --- a/src/qxk/qxk_sema.cpp +++ b/src/qxk/qxk_sema.cpp @@ -58,7 +58,7 @@ // unnamed namespace for local definitions with internal linkage namespace { -Q_THIS_MODULE("qxk_sema"); +Q_DEFINE_THIS_MODULE("qxk_sema") } // unnamed namespace //$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv diff --git a/src/qxk/qxk_xthr.cpp b/src/qxk/qxk_xthr.cpp index 5e353fae..b37ca886 100644 --- a/src/qxk/qxk_xthr.cpp +++ b/src/qxk/qxk_xthr.cpp @@ -58,7 +58,7 @@ // unnamed namespace for local definitions with internal linkage namespace { -Q_THIS_MODULE("qxk_xthr"); +Q_DEFINE_THIS_MODULE("qxk_xthr") } // unnamed namespace //$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv diff --git a/test/qk/test_sched/bsp_efm32pg1b.cpp b/test/qk/test_sched/bsp_efm32pg1b.cpp index 505254d8..412d6dc7 100644 --- a/test/qk/test_sched/bsp_efm32pg1b.cpp +++ b/test/qk/test_sched/bsp_efm32pg1b.cpp @@ -42,7 +42,7 @@ namespace { -Q_THIS_FILE(); +Q_DEFINE_THIS_FILE // Local-scope objects ------------------------------------------------------- #define LED_PORT gpioPortF diff --git a/test/qk/test_sched/bsp_nucleo-c031c6.cpp b/test/qk/test_sched/bsp_nucleo-c031c6.cpp index b656cc17..97449198 100644 --- a/test/qk/test_sched/bsp_nucleo-c031c6.cpp +++ b/test/qk/test_sched/bsp_nucleo-c031c6.cpp @@ -39,7 +39,7 @@ namespace { -Q_THIS_FILE(); +Q_DEFINE_THIS_FILE // Local-scope objects ----------------------------------------------------- // LED pins available on the board (just one user LED LD4--Green on PA.5) diff --git a/test/qk/test_sched/bsp_nucleo-h743zi.cpp b/test/qk/test_sched/bsp_nucleo-h743zi.cpp index 7114d4b3..cb555ed3 100644 --- a/test/qk/test_sched/bsp_nucleo-h743zi.cpp +++ b/test/qk/test_sched/bsp_nucleo-h743zi.cpp @@ -41,7 +41,7 @@ namespace { -Q_THIS_FILE(); +Q_DEFINE_THIS_FILE #ifdef Q_SPY diff --git a/test/qk/test_sched/bsp_nucleo-l053r8.cpp b/test/qk/test_sched/bsp_nucleo-l053r8.cpp index 40b129b7..bc5c4cb0 100644 --- a/test/qk/test_sched/bsp_nucleo-l053r8.cpp +++ b/test/qk/test_sched/bsp_nucleo-l053r8.cpp @@ -39,7 +39,7 @@ namespace { -Q_THIS_FILE(); +Q_DEFINE_THIS_FILE // Local-scope objects ------------------------------------------------------- // LED pins available on the board (just one user LED LD2--Green on PA.5) diff --git a/test/qk/test_sched/bsp_nucleo-u545re.cpp b/test/qk/test_sched/bsp_nucleo-u545re.cpp new file mode 100644 index 00000000..c6b0f34b --- /dev/null +++ b/test/qk/test_sched/bsp_nucleo-u545re.cpp @@ -0,0 +1,315 @@ +//============================================================================ +// Product: BSP for system-testing of QK kernel, NUCLEO-U545RE-Q board +// Last updated for version 7.4.0 +// Last updated on 2024-06-24 +// +// Q u a n t u m L e a P s +// ------------------------ +// Modern Embedded Software +// +// Copyright (C) 2005 Quantum Leaps, LLC. +// +// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-QL-commercial +// +// This software is dual-licensed under the terms of the open source GNU +// General Public License version 3 (or any later version), or alternatively, +// under the terms of one of the closed source Quantum Leaps commercial +// licenses. +// +// The terms of the open source GNU General Public License version 3 +// can be found at: +// +// The terms of the closed source Quantum Leaps commercial licenses +// can be found at: +// +// Redistributions in source code must retain this top-level comment block. +// Plagiarizing this software to sidestep the license obligations is illegal. +// +// Contact information: +// +// +//============================================================================ +#include "qpcpp.hpp" +#include "bsp.hpp" + +#include "stm32u545xx.h" // CMSIS-compliant header file for the MCU used +// add other drivers if necessary... + +namespace { + +Q_DEFINE_THIS_FILE + +// Local-scope defines ----------------------------------------------------- +// LED pins available on the board (just one user LED LD2--Green on PA.5) +#define LD2_PIN 5U + +// Button pins available on the board (just one user Button B1 on PC.13) +#define B1_PIN 13U + +// macros from STM32Cube LL: +#define SET_BIT(REG, BIT) ((REG) |= (BIT)) +#define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT)) +#define READ_BIT(REG, BIT) ((REG) & (BIT)) +#define CLEAR_REG(REG) ((REG) = (0x0)) +#define WRITE_REG(REG, VAL) ((REG) = (VAL)) +#define READ_REG(REG) ((REG)) +#define MODIFY_REG(REG, CLEARMASK, SETMASK) \ + WRITE_REG((REG), ((READ_REG(REG) & (~(CLEARMASK))) | (SETMASK))) + +#ifdef Q_SPY +// QSpy source IDs +static QP::QSpyId const l_SysTick_Handler = { 100U }; +static QP::QSpyId const l_test_ISR = { 101U }; + +enum AppRecords { // application-specific trace records + CONTEXT_SW = QP::QS_USER1, + TRACE_MSG +}; + +#endif + +} // unnamed namespace + +// ISRs used in this project ================================================= +extern "C" { + +//............................................................................ +void SysTick_Handler(void); // prototype +void SysTick_Handler(void) { + QK_ISR_ENTRY(); // inform QK kernel about entering an ISR + + QP::QTimeEvt::TICK_X(0U, &l_SysTick_Handler); + + QK_ISR_EXIT(); // inform QK kernel about exiting an ISR +} +//............................................................................ +void EXTI0_IRQHandler(void); // prototype +void EXTI0_IRQHandler(void) { // for testing, NOTE03 + QK_ISR_ENTRY(); // inform QXK kernel about entering an ISR + + // for testing... + static QP::QEvt const t1(TEST1_SIG); + QP::QF::PUBLISH(&t1, &l_test_ISR); + + QK_ISR_EXIT(); // inform QK kernel about exiting an ISR +} + +} // extern "C" + +// BSP functions ============================================================= + +static void STM32U545RE_MPU_setup(void) { + MPU->CTRL = 0U; // disable the MPU + + MPU->RNR = 0U; // region 0 (for ROM) + MPU->RBAR = (0x08000000U & MPU_RBAR_BASE_Msk) | (0x3U << MPU_RBAR_AP_Pos); + MPU->RLAR = (0x08080000U & MPU_RLAR_LIMIT_Msk) | MPU_RLAR_EN_Msk; + + MPU->RNR = 7U; // region 7 (for NULL pointer protection) + MPU->RBAR = (0x00000000U & MPU_RBAR_BASE_Msk) | MPU_RBAR_XN_Msk; + MPU->RLAR = (0x00080000U & MPU_RLAR_LIMIT_Msk) | MPU_RLAR_EN_Msk; + __DMB(); + + MPU->CTRL = MPU_CTRL_ENABLE_Msk | MPU_CTRL_PRIVDEFENA_Msk; + + SCB->SHCSR |= SCB_SHCSR_MEMFAULTENA_Msk; + + __DSB(); + __ISB(); +} +//............................................................................ +void BSP::init(void) { + // setup the MPU... + STM32U545RE_MPU_setup(); + + // initialize I-CACHE + MODIFY_REG(ICACHE->CR, ICACHE_CR_WAYSEL, 0U); // 1-way + SET_BIT(ICACHE->CR, ICACHE_CR_EN); // enable + + // flash prefetch buffer enable + SET_BIT(FLASH->ACR, FLASH_ACR_PRFTEN); + + // enable PWR clock interface + SET_BIT(RCC->AHB3ENR, RCC_AHB3ENR_PWREN); + + // NOTE: SystemInit() has been already called from the startup code + // but SystemCoreClock needs to be updated + SystemCoreClockUpdate(); + + // enable GPIOA clock port for the LED LD4 + RCC->AHB2ENR1 |= RCC_AHB2ENR1_GPIOAEN; + + // set all used GPIOA pins as push-pull output, no pull-up, pull-down + MODIFY_REG(GPIOA->OSPEEDR, + GPIO_OSPEEDR_OSPEED0 << (LD2_PIN * GPIO_OSPEEDR_OSPEED1_Pos), + 1U << (LD2_PIN * GPIO_OSPEEDR_OSPEED1_Pos)); // speed==1 + MODIFY_REG(GPIOA->OTYPER, + 1U << LD2_PIN, + 0U << LD2_PIN); // output + MODIFY_REG(GPIOA->PUPDR, + GPIO_PUPDR_PUPD0 << (LD2_PIN * GPIO_PUPDR_PUPD1_Pos), + 0U << (LD2_PIN * GPIO_PUPDR_PUPD1_Pos)); // PUSHPULL + MODIFY_REG(GPIOA->MODER, + GPIO_MODER_MODE0 << (LD2_PIN * GPIO_MODER_MODE1_Pos), + 1U << (LD2_PIN * GPIO_MODER_MODE1_Pos)); // MODE_1 + + // enable GPIOC clock port for the Button B1 + RCC->AHB2ENR1 |= RCC_AHB2ENR1_GPIOCEN; + + // configure Button B1 pin on GPIOC as input, no pull-up, pull-down + MODIFY_REG(GPIOC->PUPDR, + GPIO_PUPDR_PUPD0 << (B1_PIN * GPIO_PUPDR_PUPD1_Pos), + 0U << (B1_PIN * GPIO_PUPDR_PUPD1_Pos)); // NO PULL + MODIFY_REG(GPIOC->MODER, + GPIO_MODER_MODE0 << (B1_PIN * GPIO_MODER_MODE1_Pos), + 0U << (B1_PIN * GPIO_MODER_MODE1_Pos)); // MODE_0 + + // initialize the QS software tracing... + if (!QS_INIT(nullptr)) { // initialize the QS software tracing + Q_ERROR(); + } + + // dictionaries... + QS_OBJ_DICTIONARY(&l_SysTick_Handler); + QS_OBJ_DICTIONARY(&l_test_ISR); + + QS_USR_DICTIONARY(CONTEXT_SW); + QS_USR_DICTIONARY(TRACE_MSG); +} +//............................................................................ +void BSP::terminate(int16_t result) { + Q_UNUSED_PAR(result); +} +//............................................................................ +void BSP::ledOn(void) { + GPIOA->BSRR = (1U << LD2_PIN); // turn LED on +} +//............................................................................ +void BSP::ledOff(void) { + GPIOA->BRR = (1U << LD2_PIN); // turn LED off +} +//............................................................................ +void BSP::trigISR(void) { + NVIC_SetPendingIRQ(EXTI0_IRQn); +} +//............................................................................ +void BSP::trace(QP::QActive const *thr, char const *msg) { + QS_BEGIN_ID(TRACE_MSG, 0U) + QS_OBJ(thr); + QS_STR(msg); + QS_END() +} +//............................................................................ +uint32_t BSP::romRead(int32_t offset, uint32_t fromEnd) { + int32_t const rom_base = (fromEnd == 0U) + ? 0x08000000 + : 0x08080000 - 4; + return *(uint32_t volatile *)(rom_base + offset); +} +//............................................................................ +void BSP::romWrite(int32_t offset, uint32_t fromEnd, uint32_t value) { + int32_t const rom_base = (fromEnd == 0U) + ? 0x08000000 + : 0x08080000 - 4; + *(uint32_t volatile *)(rom_base + offset) = value; +} + +//............................................................................ +uint32_t BSP::ramRead(int32_t offset, uint32_t fromEnd) { + int32_t const ram_base = (fromEnd == 0U) + ? 0x20000000 + : 0x20040000 - 4; + return *(uint32_t volatile *)(ram_base + offset); +} +//............................................................................ +void BSP::ramWrite(int32_t offset, uint32_t fromEnd, uint32_t value) { + int32_t const ram_base = (fromEnd == 0U) + ? 0x20000000 + : 0x20040000 - 4; + *(uint32_t volatile *)(ram_base + offset) = value; +} + +// namespace QP ============================================================== +namespace QP { + +// QF callbacks -------------------------------------------------------------- +void QF::onStartup(void) { + // NOTE: SystemInit() has been already called from the startup code + // but SystemCoreClock needs to be updated + SystemCoreClockUpdate(); + + //NOTE: don't start ticking for these tests + //SysTick_Config(SystemCoreClock / BSP_TICKS_PER_SEC); + + // assign all priority bits for preemption-prio. and none to sub-prio. + // NOTE: this might have been changed by STM32Cube. + NVIC_SetPriorityGrouping(0U); + + // set priorities of ALL ISRs used in the system + NVIC_SetPriority(SysTick_IRQn, QF_AWARE_ISR_CMSIS_PRI + 0U); + NVIC_SetPriority(EXTI0_IRQn, QF_AWARE_ISR_CMSIS_PRI + 1U); + // NOTE: priority of UART IRQ used for QS-RX is set in qutest_port.c + // ... + + // enable IRQs... + NVIC_EnableIRQ(EXTI0_IRQn); +} +//............................................................................ +void QF::onCleanup(void) { +} +//............................................................................ +void QK::onIdle(void) { +#ifdef Q_SPY + QS::rxParse(); // parse all the received bytes + QS::doOutput(); +#elif defined NDEBUG + // Put the CPU and peripherals to the low-power mode. + // you might need to customize the clock management for your application, + // see the datasheet for your particular Cortex-M3 MCU. + // + __WFI(); // Wait-For-Interrupt +#endif +} + +// QS callbacks ============================================================== +//............................................................................ +void QTimeEvt::tick1_( + uint_fast8_t const tickRate, + void const * const sender) +{ + QF_INT_DISABLE(); + // TODO pend the SysTick + *Q_UINT2PTR_CAST(uint32_t, 0xE000ED04U) = (1U << 26U); + QF_INT_ENABLE(); +} + +//---------------------------------------------------------------------------- + +} // namespace QP + +extern "C" { +//............................................................................ +#ifdef QF_ON_CONTEXT_SW +// NOTE: the context-switch callback is called with interrupts DISABLED +void QF_onContextSw(QP::QActive *prev, QP::QActive *next) { + QS_BEGIN_INCRIT(CONTEXT_SW, 0U) // no critical section! + QS_OBJ(prev); + QS_OBJ(next); + QS_END_INCRIT() +} +#endif // QF_ON_CONTEXT_SW + +} // extern "C" + +//============================================================================ +// NOTE0: +// The MPU protection against NULL-pointer dereferencing sets up a no-access +// MPU region #7 around the NULL address (0x0). The size of this region is set +// to 2^(26+1)==0x0800'0000, because that is the address of Flash in STM32. +// +// REMARK: STM32 MCUs automatically relocate the Flash memory and the Vector +// Table in it to address 0x0800'0000 at startup. However, even though the +// region 0..0x0800'0000 is un-mapped after the relocation, the read access +// is still allowed and causes no CPU exception. Therefore setting up the MPU +// to protect that region is necessary. +// diff --git a/test/qk/test_sched/nucleo-u545re.mak b/test/qk/test_sched/nucleo-u545re.mak new file mode 100644 index 00000000..c21d0d6a --- /dev/null +++ b/test/qk/test_sched/nucleo-u545re.mak @@ -0,0 +1,334 @@ +############################################################################## +# Product: Makefile for SYSTEM-Level tests of QP/C++ on NUCLEO-U545RE-Q, GNU-ARM +# Last Updated for Version: 7.4.0 +# Date of the Last Update: 2024-06-23 +# +# Q u a n t u m L e a P s +# ------------------------ +# Modern Embedded Software +# +# Copyright (C) 2005 Quantum Leaps, LLC. +# +# 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 +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Alternatively, this program may be distributed and modified under the +# terms of Quantum Leaps commercial licenses, which expressly supersede +# the GNU General Public License and are specifically designed for +# licensees interested in retaining the proprietary status of their code. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# 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 . +# +# Contact information: +# +# +############################################################################## +# +# examples of invoking this Makefile: +# make -f nucleo-u545re.mak USB=g: # make, upload to USB drive, run the tests +# make -f nucleo-u545re.mak USB=g: TESTS=philo*.py # make and run the selected tests +# make -f nucleo-u545re.mak HOST=localhost:7705 # connect to host:port +# make -f nucleo-u545re.mak norun # only make but not run the tests +# make -f nucleo-u545re.mak clean # cleanup the build +# make -f nucleo-u545re.mak debug # only run tests in DEBUG mode +# +# NOTE: +# To use this Makefile on Windows, you will need the GNU make utility, which +# is included in the QTools collection for Windows, see: +# https://github.com/QuantumLeaps/qtools +# + +# location of the QP/C++ framework (if not provided in an env. variable) +ifeq ($(QPCPP),) +QPCPP := ../../.. +endif + +#----------------------------------------------------------------------------- +# project name, target name, target directory: +# +PROJECT := test_sched +TARGET := nucleo-u545re +TARGET_DIR := $(QPCPP)/3rd_party/nucleo-u545re/qutest + +#----------------------------------------------------------------------------- +# project directories: +# + +# QP port used in this project +QP_PORT_DIR := $(QPCPP)/ports/arm-cm/qk/gnu + +# make sure that QTOOLS env. variable is defined... +ifeq ("$(wildcard $(QTOOLS))","") +$(error QTOOLS not found. Please install QTools and define QTOOLS env. variable) +endif + + +# list of all source directories used by this project +VPATH := . \ + $(QPCPP)/src/qf \ + $(QPCPP)/src/qk \ + $(QPCPP)/src/qs \ + $(QP_PORT_DIR) \ + $(TARGET_DIR) \ + $(QPCPP)/3rd_party/nucleo-u545re \ + $(QPCPP)/3rd_party/nucleo-u545re/gnu + +# list of all include directories needed by this project +INCLUDES = -I. \ + -I$(QPCPP)/include \ + -I$(QP_PORT_DIR) \ + -I$(TARGET_DIR) \ + -I$(QPCPP)/3rd_party/CMSIS/Include \ + -I$(QPCPP)/3rd_party/nucleo-u545re + +#----------------------------------------------------------------------------- +# project files: +# + +# assembler source files +ASM_SRCS := + +# C source files +C_SRCS := \ + system_stm32u5xx.c \ + startup_stm32u545retxq.c + +# C++ source files +CPP_SRCS := \ + test_sched.cpp \ + bsp_nucleo-u545re.cpp + +OUTPUT := $(PROJECT) +LD_SCRIPT := $(TARGET_DIR)/qutest.ld + +QP_SRCS := \ + qep_hsm.cpp \ + qep_msm.cpp \ + qf_act.cpp \ + qf_actq.cpp \ + qf_defer.cpp \ + qf_dyn.cpp \ + qf_mem.cpp \ + qf_ps.cpp \ + qf_qact.cpp \ + qf_qeq.cpp \ + qf_qmact.cpp \ + qf_time.cpp \ + qk.cpp \ + qk_port.cpp \ + qs.cpp \ + qs_64bit.cpp \ + qs_rx.cpp \ + qs_fp.cpp \ + qutest.cpp \ + qutest_cpp.cpp + +QP_ASMS := + +LIB_DIRS := +LIBS := + +# defines +DEFINES := -DSTM32U545xx \ + -DQP_API_VERSION=9999 \ + -DQF_ON_CONTEXT_SW + +# ARM CPU, ARCH, FPU, and Float-ABI types... +# ARM_CPU: [cortex-m0 | cortex-m0plus | cortex-m1 | cortex-m3 | cortex-m4] +# ARM_FPU: [ | vfp] +# FLOAT_ABI: [ | soft | softfp | hard] +# +ARM_CPU := -mcpu=cortex-m33 +ARM_FPU := -mfpu=fpv5-sp-d16 +FLOAT_ABI := -mfloat-abi=hard -mthumb + +#----------------------------------------------------------------------------- +# GNU-ARM toolset (NOTE: You need to adjust to your machine) +# see https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads +# +ifeq ($(GNU_ARM),) +GNU_ARM := $(QTOOLS)/gnu_arm-none-eabi +endif + +# make sure that the GNU-ARM toolset exists... +ifeq ("$(wildcard $(GNU_ARM))","") +$(error GNU_ARM toolset not found. Please adjust the Makefile) +endif + +CC := $(GNU_ARM)/bin/arm-none-eabi-gcc +CPP := $(GNU_ARM)/bin/arm-none-eabi-g++ +AS := $(GNU_ARM)/bin/arm-none-eabi-as +LINK := $(GNU_ARM)/bin/arm-none-eabi-g++ +BIN := $(GNU_ARM)/bin/arm-none-eabi-objcopy + +#----------------------------------------------------------------------------- +# NOTE: The symbol USB must be provided for the NUCLEO board +# has enumerated as USB drive f: +# +ifeq ($(USB),) +$(error USB drive not provided for the NUCLEO board.) +endif + +############################################################################## +# Typically you should not need to change anything below this line + +# basic utilities (included in QTools for Windows), see: +# https://www.state-machine.com/qtools + +MKDIR := mkdir +RM := rm +CP := cp +SLEEP := sleep + +#----------------------------------------------------------------------------- +# QUTest test script utilities (requires QTOOLS): +# +ifeq ("$(wildcard $(QUTEST))","") +QUTEST := python3 $(QTOOLS)/qutest/qutest.py +endif + +#----------------------------------------------------------------------------- +# build options +# + +# combine all the sources... +CPP_SRCS += $(QP_SRCS) +ASM_SRCS += $(QP_ASMS) + +BIN_DIR := build_$(TARGET) + +ASFLAGS = -g $(ARM_CPU) $(ARM_FPU) $(ASM_CPU) $(ASM_FPU) + + +# NOTE: +# Setting -DQ_UTEST=0 means that QUTest should be built WITHOUT +# the QP-stub for testing QP itself +# +CFLAGS = -c -g $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ + -ffunction-sections -fdata-sections \ + -O $(INCLUDES) $(DEFINES) -DQ_SPY -DQ_UTEST=0 + +CPPFLAGS = -c -g $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ + -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions \ + -O $(INCLUDES) $(DEFINES) -DQ_SPY -DQ_UTEST=0 + + +LINKFLAGS = -T$(LD_SCRIPT) $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb \ + -specs=nosys.specs -specs=nano.specs \ + -Wl,-Map,$(BIN_DIR)/$(OUTPUT).map,--cref,--gc-sections $(LIB_DIRS) + +ASM_OBJS := $(patsubst %.s,%.o, $(notdir $(ASM_SRCS))) +C_OBJS := $(patsubst %.c,%.o, $(notdir $(C_SRCS))) +CPP_OBJS := $(patsubst %.cpp,%.o,$(notdir $(CPP_SRCS))) + +TARGET_BIN := $(BIN_DIR)/$(OUTPUT).bin +TARGET_ELF := $(BIN_DIR)/$(OUTPUT).elf +ASM_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(ASM_OBJS)) +C_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(C_OBJS)) +C_DEPS_EXT := $(patsubst %.o, %.d, $(C_OBJS_EXT)) +CPP_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(CPP_OBJS)) +CPP_DEPS_EXT := $(patsubst %.o, %.d, $(CPP_OBJS_EXT)) + +# create $(BIN_DIR) if it does not exist +ifeq ("$(wildcard $(BIN_DIR))","") +$(shell $(MKDIR) $(BIN_DIR)) +endif + +#----------------------------------------------------------------------------- +# rules +# + +.PHONY : run norun debug flash + +ifeq ($(MAKECMDGOALS),norun) +all : $(TARGET_BIN) +norun : all +else +all : $(TARGET_BIN) run +endif + +$(TARGET_BIN) : $(TARGET_ELF) + $(BIN) -O binary $< $@ + $(CP) $@ $(USB) + $(SLEEP) 2 + +$(TARGET_ELF) : $(ASM_OBJS_EXT) $(C_OBJS_EXT) $(CPP_OBJS_EXT) + $(CPP) $(CPPFLAGS) $(QPCPP)/src/qs/qstamp.cpp -o $(BIN_DIR)/qstamp.o + $(LINK) $(LINKFLAGS) -o $@ $^ $(BIN_DIR)/qstamp.o $(LIBS) + +flash : + $(CP) $(TARGET_BIN) $(USB) + +run : $(TARGET_BIN) + $(QUTEST) -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) + +$(BIN_DIR)/%.d : %.c + $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ + +$(BIN_DIR)/%.d : %.cpp + $(CPP) -MM -MT $(@:.d=.o) $(CPPFLAGS) $< > $@ + +$(BIN_DIR)/%.o : %.s + $(AS) $(ASFLAGS) $< -o $@ + +$(BIN_DIR)/%.o : %.c + $(CC) $(CFLAGS) $< -o $@ + +$(BIN_DIR)/%.o : %.cpp + $(CPP) $(CPPFLAGS) $< -o $@ + +# create BIN_DIR and include dependencies only if needed +ifneq ($(MAKECMDGOALS),clean) + ifneq ($(MAKECMDGOALS),show) + ifneq ($(MAKECMDGOALS),debug) +ifeq ("$(wildcard $(BIN_DIR))","") +$(shell $(MKDIR) $(BIN_DIR)) +endif +-include $(C_DEPS_EXT) $(CPP_DEPS_EXT) + endif + endif +endif + +debug : + $(QUTEST) -edebug -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) + +.PHONY : clean show + +clean : + -$(RM) $(BIN_DIR)/*.o \ + $(BIN_DIR)/*.d \ + $(BIN_DIR)/*.bin \ + $(BIN_DIR)/*.elf \ + $(BIN_DIR)/*.map + +show : + @echo PROJECT = $(PROJECT) + @echo MAKECMDGOALS = $(MAKECMDGOALS) + @echo TESTS = $(TESTS) + @echo TARGET_ELF = $(TARGET_ELF) + @echo CONF = $(CONF) + @echo VPATH = $(VPATH) + @echo C_SRCS = $(C_SRCS) + @echo CPP_SRCS = $(CPP_SRCS) + @echo ASM_SRCS = $(ASM_SRCS) + @echo C_DEPS_EXT = $(C_DEPS_EXT) + @echo C_OBJS_EXT = $(C_OBJS_EXT) + @echo CPP_DEPS_EXT = $(CPP_DEPS_EXT) + @echo CPP_OBJS_EXT = $(CPP_OBJS_EXT) + @echo ASM_OBJS_EXT = $(ASM_OBJS_EXT) + @echo LIB_DIRS = $(LIB_DIRS) + @echo LIBS = $(LIBS) + @echo DEFINES = $(DEFINES) + @echo QTOOLS = $(QTOOLS) + @echo HOST = $(HOST) + @echo QUTEST = $(QUTEST) + @echo TESTS = $(TESTS) + diff --git a/test/qk/test_sched/test_sched.cpp b/test/qk/test_sched/test_sched.cpp index 302d59e9..c6b23ea9 100644 --- a/test/qk/test_sched/test_sched.cpp +++ b/test/qk/test_sched/test_sched.cpp @@ -34,9 +34,10 @@ #include "qpcpp.hpp" #include "bsp.hpp" -Q_THIS_FILE(); - namespace { + +Q_DEFINE_THIS_FILE + //============================================================================ // AO ObjB enum { NUM_B = 3 }; diff --git a/test/qk/test_sched/test_sched.py b/test/qk/test_sched/test_sched.py index a58a9642..4e1fc52d 100644 --- a/test/qk/test_sched/test_sched.py +++ b/test/qk/test_sched/test_sched.py @@ -2,7 +2,7 @@ # see https://www.state-machine.com/qtools/qutest.html/qutest.html note(''' -This test group verifies the preemption scenarios +This test group verifies the preemption tests in the QK preemptive kernel ''') @@ -17,7 +17,7 @@ def on_reset(): def Q_PRIO(prio, pthre): return prio | (pthre << 8) -scenario("ao->ao->ao (NO PTS)") +test("ao->ao->ao (NO PTS)") # given... current_obj(OBJ_AP, "pspecB") poke(0, 2, pack("ao->ao (PTS1)") +test("ao->ao->ao (PTS1)") # given... current_obj(OBJ_AP, "pspecB") poke(0, 2, pack("ao->ao (PTS2)") +test("ao->ao->ao (PTS2)") # given... current_obj(OBJ_AP, "pspecB") poke(0, 2, pack("