diff --git a/examples/arm-cm/dpp_efm32-slstk3401a/.dpp b/examples/arm-cm/dpp_efm32-slstk3401a/.dpp deleted file mode 100644 index f62f8f69e..000000000 --- a/examples/arm-cm/dpp_efm32-slstk3401a/.dpp +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - 1 - 0 - 3 - 0 - - - - 2032128 - 0 - - - - - 0 - - - - - 0 - - - 0 - - - - - 0 - - - 0 - - - - - 0 - - - 0 - - - - - 0 - - - 0 - - - - - 0 - - - diff --git a/examples/posix-win32/reminder2/Makefile b/examples/posix-win32/reminder2/Makefile index 63657e03e..f3affe910 100644 --- a/examples/posix-win32/reminder2/Makefile +++ b/examples/posix-win32/reminder2/Makefile @@ -1,7 +1,7 @@ ############################################################################## # Product: Makefile for QP/C++ for Windows and POSIX *HOSTS* -# Last updated for version 7.2.0 -# Last updated on 2022-11-13 +# Last updated for version 7.3.1 +# Last updated on 2023-09-25 # # Q u a n t u m L e a P s # ------------------------ @@ -83,7 +83,8 @@ LIBS := # defines... # QP_API_VERSION controls the QP API compatibility; 9999 means the latest API -DEFINES := -DQP_API_VERSION=9999 +DEFINES := -DQP_API_VERSION=9999 \ + $(DEF) ifeq (,$(CONF)) CONF := dbg diff --git a/examples/posix-win32/reminder2/bsp.cpp b/examples/posix-win32/reminder2/bsp.cpp index de476537b..fbbb152d0 100644 --- a/examples/posix-win32/reminder2/bsp.cpp +++ b/examples/posix-win32/reminder2/bsp.cpp @@ -57,7 +57,7 @@ void QF::onCleanup(void) { void QP::QF::onClockTick(void) { QTimeEvt::TICK_X(0U, &l_clock_tick); // perform the QF clock tick processing int key = QF::consoleGetKey(); - if (key != 0) { /* any key pressed? */ + if (key != 0U) { /* any key pressed? */ BSP_onKeyboardInput((uint8_t)key); } } diff --git a/examples/posix-win32/reminder2/reminder2.cpp b/examples/posix-win32/reminder2/reminder2.cpp index a192c22da..077c29dcd 100644 --- a/examples/posix-win32/reminder2/reminder2.cpp +++ b/examples/posix-win32/reminder2/reminder2.cpp @@ -51,10 +51,19 @@ enum ReminderSignals { class ReminderEvt : public QP::QEvt { public: std::uint32_t iter; + +public: + +#ifdef QEVT_DYN_CTOR + explicit ReminderEvt(std::uint32_t i) noexcept + : QEvt(QP::QEvt::DYNAMIC), + iter(i) + {} +#endif // def QEVT_DYN_CTOR }; // class ReminderEvt //$enddecl${Events::ReminderEvt} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -// Active object class -----------------------------------------------------.. +// Active object class ------------------------------------------------------- //$declare${Components::Cruncher} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv //${Components::Cruncher} .................................................... @@ -90,7 +99,7 @@ class Cruncher : public QP::QActive { //${Components::Cruncher::SM} ................................................ Q_STATE_DEF(Cruncher, initial) { //${Components::Cruncher::SM::initial} - (void)e; // unused parameter + Q_UNUSED_PAR(e); QS_FUN_DICTIONARY(&Cruncher::processing); QS_FUN_DICTIONARY(&Cruncher::final); @@ -104,8 +113,13 @@ Q_STATE_DEF(Cruncher, processing) { switch (e->sig) { //${Components::Cruncher::SM::processing} case Q_ENTRY_SIG: { + #ifdef QEVT_DYN_CTOR + ReminderEvt *reminder = Q_NEW(ReminderEvt, CRUNCH_SIG, 0U); + #else ReminderEvt *reminder = Q_NEW(ReminderEvt, CRUNCH_SIG); - reminder->iter = 0; + reminder->iter = 0U; + #endif + POST(reminder, this); m_sum = 0.0; status_ = Q_RET_HANDLED; @@ -113,22 +127,27 @@ Q_STATE_DEF(Cruncher, processing) { } //${Components::Cruncher::SM::processing::CRUNCH} case CRUNCH_SIG: { - uint32_t i = Q_EVT_CAST(ReminderEvt)->iter; - uint32_t n = i; + std::uint32_t i = Q_EVT_CAST(ReminderEvt)->iter; + std::uint32_t n = i; i += 100U; for (; n < i; ++n) { if ((n & 1) == 0) { - m_sum += 1.0/(2*n + 1); + m_sum += 1.0/(2U*n + 1U); } else { - m_sum -= 1.0/(2*n + 1); + m_sum -= 1.0/(2U*n + 1U); } } //${Components::Cruncher::SM::processing::CRUNCH::[i<0x07000000U]} if (i < 0x07000000U) { + #ifdef QEVT_DYN_CTOR + ReminderEvt *reminder = Q_NEW(ReminderEvt, CRUNCH_SIG, i); + #else ReminderEvt *reminder = Q_NEW(ReminderEvt, CRUNCH_SIG); reminder->iter = i; - POST(reminder, me); + #endif + + POST(reminder, this); status_ = Q_RET_HANDLED; } //${Components::Cruncher::SM::processing::CRUNCH::[else]} @@ -189,7 +208,7 @@ int main(int argc, char *argv[]) { PRINTF_S("Reminder state pattern\nQP version: %s\n" "Press 'e' to echo the current value...\n" "Press ESC to quit...\n", - QP::versionStr); + QP_VERSION_STR); BSP_init(argc, argv); // initialize the BSP QF::init(); // initialize the framework and the underlying RT kernel @@ -210,14 +229,24 @@ int main(int argc, char *argv[]) { void BSP_onKeyboardInput(uint8_t key) { switch (key) { case 'e': { - static QEvt const echoEvt(ECHO_SIG); - l_cruncher.POST(&echoEvt, nullptr); + // NOTE: + // The following Q_NEW_X() allocation might potentially fail + // but this is acceptable becasue the "ECHO" event is not + // considered critical. This code illustrates the Q_NEW_X() + // API and its use. + #ifdef QEVT_DYN_CTOR + QEvt const *echoEvt = Q_NEW_X(QEvt, 2U, ECHO_SIG, QEvt::DYNAMIC); + #else + QEvt const *echoEvt = Q_NEW_X(QEvt, 2U, ECHO_SIG); + #endif + if (echoEvt != nullptr) { // event allocated successfully? + l_cruncher.POST(echoEvt, nullptr); + } break; } case '\033': { // ESC pressed? // NOTE: this constant event is statically pre-allocated. // It can be posted/published as any other event. - // static QEvt const terminateEvt(TERMINATE_SIG); l_cruncher.POST(&terminateEvt, nullptr); break; diff --git a/examples/posix-win32/reminder2/reminder2.qm b/examples/posix-win32/reminder2/reminder2.qm index 2e32a97b0..12b06ab3d 100644 --- a/examples/posix-win32/reminder2/reminder2.qm +++ b/examples/posix-win32/reminder2/reminder2.qm @@ -11,6 +11,14 @@ the next iteration to perform + + + noexcept + + + : QEvt(QP::QEvt::DYNAMIC), + iter(i) + @@ -32,28 +40,33 @@ - (void)e; // unused parameter + Q_UNUSED_PAR(e); - ReminderEvt *reminder = Q_NEW(ReminderEvt, CRUNCH_SIG); -reminder->iter = 0; + #ifdef QEVT_DYN_CTOR +ReminderEvt *reminder = Q_NEW(ReminderEvt, CRUNCH_SIG, 0U); +#else +ReminderEvt *reminder = Q_NEW(ReminderEvt, CRUNCH_SIG); +reminder->iter = 0U; +#endif + POST(reminder, this); m_sum = 0.0; - uint32_t i = Q_EVT_CAST(ReminderEvt)->iter; -uint32_t n = i; + std::uint32_t i = Q_EVT_CAST(ReminderEvt)->iter; +std::uint32_t n = i; i += 100U; for (; n < i; ++n) { if ((n & 1) == 0) { - m_sum += 1.0/(2*n + 1); + m_sum += 1.0/(2U*n + 1U); } else { - m_sum -= 1.0/(2*n + 1); + m_sum -= 1.0/(2U*n + 1U); } } @@ -67,9 +80,14 @@ for (; n < i; ++n) { i < 0x07000000U - ReminderEvt *reminder = Q_NEW(ReminderEvt, CRUNCH_SIG); + #ifdef QEVT_DYN_CTOR +ReminderEvt *reminder = Q_NEW(ReminderEvt, CRUNCH_SIG, i); +#else +ReminderEvt *reminder = Q_NEW(ReminderEvt, CRUNCH_SIG); reminder->iter = i; -POST(reminder, me); +#endif + +POST(reminder, this); @@ -130,7 +148,7 @@ enum ReminderSignals { //............................................................................ $declare${Events::ReminderEvt} -// Active object class -----------------------------------------------------.. +// Active object class ------------------------------------------------------- $declare${Components::Cruncher} $define${Components::Cruncher} @@ -147,7 +165,7 @@ int main(int argc, char *argv[]) { PRINTF_S("Reminder state pattern\nQP version: %s\n" "Press 'e' to echo the current value...\n" "Press ESC to quit...\n", - QP::versionStr); + QP_VERSION_STR); BSP_init(argc, argv); // initialize the BSP QF::init(); // initialize the framework and the underlying RT kernel @@ -168,14 +186,24 @@ int main(int argc, char *argv[]) { void BSP_onKeyboardInput(uint8_t key) { switch (key) { case 'e': { - static QEvt const echoEvt(ECHO_SIG); - l_cruncher.POST(&echoEvt, nullptr); + // NOTE: + // The following Q_NEW_X() allocation might potentially fail + // but this is acceptable becasue the "ECHO" event is not + // considered critical. This code illustrates the Q_NEW_X() + // API and its use. + #ifdef QEVT_DYN_CTOR + QEvt const *echoEvt = Q_NEW_X(QEvt, 2U, ECHO_SIG, QEvt::DYNAMIC); + #else + QEvt const *echoEvt = Q_NEW_X(QEvt, 2U, ECHO_SIG); + #endif + if (echoEvt != nullptr) { // event allocated successfully? + l_cruncher.POST(echoEvt, nullptr); + } break; } case '\033': { // ESC pressed? // NOTE: this constant event is statically pre-allocated. // It can be posted/published as any other event. - // static QEvt const terminateEvt(TERMINATE_SIG); l_cruncher.POST(&terminateEvt, nullptr); break; diff --git a/examples/qutest/dpp/src/.dpp b/examples/qutest/dpp/src/.dpp deleted file mode 100644 index f62f8f69e..000000000 --- a/examples/qutest/dpp/src/.dpp +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - 1 - 0 - 3 - 0 - - - - 2032128 - 0 - - - - - 0 - - - - - 0 - - - 0 - - - - - 0 - - - 0 - - - - - 0 - - - 0 - - - - - 0 - - - 0 - - - - - 0 - - - diff --git a/examples/zephyr/blinky/src/qp_config.hpp b/examples/zephyr/blinky/src/qp_config.hpp index b2de00c8d..3bac92e2c 100644 --- a/examples/zephyr/blinky/src/qp_config.hpp +++ b/examples/zephyr/blinky/src/qp_config.hpp @@ -1,7 +1,7 @@ //============================================================================ // QP configuration file example // Last updated for version: 7.3.0 -// Last updated on: 2023-09-02 +// Last updated on: 2023-09-26 // // Q u a n t u m L e a P s // ------------------------ @@ -33,9 +33,9 @@ #define QP_CONFIG_HPP_ // NOTE: -// The QP configuration takes effect only when the macro QP_CONFIG -// is defined on the command-line to the compiler for all QP source files. - -#define QF_MAX_ACTIVE 64U +// This QP configuration header file must be provided in the QP applications +// for the Zephyr RTOS. This file might be empty, if the default settings of +// the QP framework are adequate. The configuration options for QP framework +// ared documented at: https://www.state-machine.com/qpcpp/qp__config_8hpp.html #endif // QP_CONFIG_HPP_ diff --git a/examples/zephyr/dpp/src/qp_config.hpp b/examples/zephyr/dpp/src/qp_config.hpp index b2de00c8d..3bac92e2c 100644 --- a/examples/zephyr/dpp/src/qp_config.hpp +++ b/examples/zephyr/dpp/src/qp_config.hpp @@ -1,7 +1,7 @@ //============================================================================ // QP configuration file example // Last updated for version: 7.3.0 -// Last updated on: 2023-09-02 +// Last updated on: 2023-09-26 // // Q u a n t u m L e a P s // ------------------------ @@ -33,9 +33,9 @@ #define QP_CONFIG_HPP_ // NOTE: -// The QP configuration takes effect only when the macro QP_CONFIG -// is defined on the command-line to the compiler for all QP source files. - -#define QF_MAX_ACTIVE 64U +// This QP configuration header file must be provided in the QP applications +// for the Zephyr RTOS. This file might be empty, if the default settings of +// the QP framework are adequate. The configuration options for QP framework +// ared documented at: https://www.state-machine.com/qpcpp/qp__config_8hpp.html #endif // QP_CONFIG_HPP_ diff --git a/qpcpp.qm b/qpcpp.qm index 80a0a6588..6cc7cd645 100644 --- a/qpcpp.qm +++ b/qpcpp.qm @@ -9825,7 +9825,7 @@ void glbFilter_(std::int_fast16_t const filter) noexcept { break; case QS_U4_RECORDS: if (isRemove) { - filt_.glb[15] &= 0x1FU; + filt_.glb[15] &= static_cast<std::uint8_t>(~0x1FU & 0xFFU); } else { filt_.glb[15] |= 0x1FU; diff --git a/qpcpp.sha256 b/qpcpp.sha256 index 89d55031a..fe8df8d8e 100644 --- a/qpcpp.sha256 +++ b/qpcpp.sha256 @@ -70,11 +70,6 @@ f9fba84406cf69f6a112535903c2550eeb62d36221c694a3276f4a32a1db668c ports/lint-plu fea069eaa4f086c05fe5d0cd6f468981d8270228b60e3b4afb0fa2d46e4f006c ports/lint-plus/au-autosar19.lnt f021b228f0af091270e17333f35cc4d56678aae5c6efcebb39c64ae6d1ac6a21 ports/lint-plus/au-ds.lnt ebe8b83390154511244d25540b7ecc0f4edbc76c808f531151ccebfb2f0bb0e8 ports/lint-plus/au-ql-cpp11.lnt -18d1ab3cfd7914a63de1c3868acb9490c9fa96501e99ad49e5ba48643a36c31d ports/lint-plus/lint_qf.log -e70a36579b8f7b41db45cbb8877a042b5453e0975fb30aaccc5353ef78486b2d ports/lint-plus/lint_qk.log -26dcb3c0cba6cd47ab55beb151237f2f9e4f2ad0c89167f13ae921300c5f089c ports/lint-plus/lint_qs.log -bcb2198fc0996b6a83c4f15f3bbb87f95a64198631331c2022e950ab7aecfec4 ports/lint-plus/lint_qv.log -9900c4e1394c0be45b133b49d1c8f109f5e16f4c0725aacbe152b9d2dad2b010 ports/lint-plus/lint_qxk.log 954fd9f9ab4f29bac122d6f58b42132ae72f7054eaaf16b50264af9dbc37be52 ports/lint-plus/make.bat ff40bd98d60cbeb979f571d51990ed20803e6b3c86cf0a99aa729c76135e3946 ports/lint-plus/new 3f26a66cfba32649879396fc586514ed1ca2eabca78b1ba6711a5a613332ab3f ports/lint-plus/options.lnt @@ -145,7 +140,7 @@ d5420755b0b0b6a5091ae2a75d07d94a76f88d75bfbbb3872c6e9e08a83de034 ports/win32-qv 4377d5047722c1c458d87d3054e2d0d9e0ea627ba20d010cf4c0cd46b822b24f ports/win32-qv/README.md 8a71e5ecf7284727dedf9af190f5e735459f11d41b08a6b72ce70afd5e25a1d1 ports/win32-qv/safe_std.h 89d6bd776c268f94a27b6de9ebae2c3df604a9d1ad439441cfc5201bfb3332dd ports/zephyr/README.md -5ef009da61d3addc0052619b4fa37f89e24f355e89e4261547a0a5eb798d3605 qpcpp.qm +63a8875df85219b1a3822b8692b59301387d2fcede519078af754042bb0b3a4b qpcpp.qm 4cfbfb688d81b8d2eb1b9f6923ad739d92b88411ac06819f92dcd0e1fdffecac src/qf/qep_hsm.cpp 2ae48adc7e99cf05b0aba282a24cd52e6c574bcc6a7f3bc6a949596518c20cf9 src/qf/qep_msm.cpp c6e9e52a451a7287016f9517f07cc46a3b01c0cd3a7866a68ee4bb955388cf20 src/qf/qf_act.cpp @@ -159,7 +154,7 @@ b54c33dd65cf915f49729ae41dd34a4d985a9bb440842da3c643c0b9a28f2f10 src/qf/qf_qeq. 064df33059131694a07eccd9a12e40d5edcbd4e7b2f376c708acec1fc9593d20 src/qf/qf_qmact.cpp 85b4c84a2d6fed92dcdbd10ee519abf537b016f7185425d20ca58b25a7252235 src/qf/qf_time.cpp 7af26fcdbc1f59dffb655b0e8e1ab65a3d7932a95e1c7bbcd50904c5cb23b6b8 src/qk/qk.cpp -f43b095c616c018ba8fc909b18fc1df37161db465a359e9781aa55ceab4109b6 src/qs/qs.cpp +eb79501b46677f9bad8ca61e9603a6d9c3516a16afb602931da9cb9a7b9debb3 src/qs/qs.cpp 4fe656ea42ce3a0a2b58797aa6c87478eaf9ee733637cbe6f6334848f9303c1e src/qs/qstamp.cpp e8a55c4a7ae5c51b0334950383d528919485918b5aa787c3befb1dd15fb1aa63 src/qs/qs_64bit.cpp 1f4888c4e24f6ebdf947337616d9176293555326e03a86c7c2a3a5f92649daf1 src/qs/qs_fp.cpp diff --git a/src/qs/qs.cpp b/src/qs/qs.cpp index 92392e5f8..7d6900a67 100644 --- a/src/qs/qs.cpp +++ b/src/qs/qs.cpp @@ -342,7 +342,7 @@ void glbFilter_(std::int_fast16_t const filter) noexcept { break; case QS_U4_RECORDS: if (isRemove) { - filt_.glb[15] &= 0x1FU; + filt_.glb[15] &= static_cast(~0x1FU & 0xFFU); } else { filt_.glb[15] |= 0x1FU;