diff --git a/3rd_party b/3rd_party index cc033393..fa069699 160000 --- a/3rd_party +++ b/3rd_party @@ -1 +1 @@ -Subproject commit cc0333938b9618b5a25394ebd81c8f235f5ff192 +Subproject commit fa06969955bfa96cbdb5b9ff8b05b66f49fad890 diff --git a/doxygen/Doxyfile b/doxygen/Doxyfile index 42c446da..18e7bcad 100644 --- a/doxygen/Doxyfile +++ b/doxygen/Doxyfile @@ -7,7 +7,7 @@ #--------------------------------------------------------------------------- DOXYFILE_ENCODING = UTF-8 PROJECT_NAME = QP/C -PROJECT_NUMBER = 7.1.3 +PROJECT_NUMBER = 7.2.0 PROJECT_BRIEF = "Real-Time Embedded Framework" PROJECT_LOGO = ../../ql-doxygen/images/logo_ql.png OUTPUT_DIRECTORY = @@ -149,6 +149,7 @@ INPUT = main.dox \ config.h \ ../include \ ../src \ + ../ports/sample \ ../ports/lint-plus/std.lnt \ ../ports/lint-plus/qpc.lnt \ ../ports/lint-plus/options.lnt @@ -163,8 +164,7 @@ FILE_PATTERNS = *.dox \ *.asm \ *.lnt RECURSIVE = YES -EXCLUDE = ../include/qs_dummy.h \ - ../include/quit.h +EXCLUDE = ../include/qs_dummy.h EXCLUDE_SYMLINKS = NO EXCLUDE_PATTERNS = EXCLUDE_SYMBOLS = QP_IMPL @@ -285,11 +285,12 @@ ENABLE_PREPROCESSING = YES MACRO_EXPANSION = NO EXPAND_ONLY_PREDEF = NO SEARCH_INCLUDES = YES -INCLUDE_PATH = -INCLUDE_FILE_PATTERNS = +INCLUDE_PATH = . +INCLUDE_FILE_PATTERNS = *.h PREDEFINED = Q_SPY \ - QP_IMPL \ Q_UTEST \ + QP_IMPL \ + Q_EVT_CTOR \ QF_MAX_ACTIVE=32 \ QF_MAX_TICK_RATE=2 \ QF_MAX_EPOOL=3 \ @@ -299,11 +300,10 @@ PREDEFINED = Q_SPY \ QF_MPOOL_CTR_SIZE=2 \ QF_TIMEEVT_CTR_SIZE=4 \ QF_ACTIVE_STOP=0 \ + QF_ON_CONTEXT_SW \ QS_TIME_SIZE=4 \ QF_EQUEUE_TYPE=QEQueue \ QF_OS_OBJECT_TYPE=void* \ - QF_THREAD_TYPE=void* \ - QK_ON_CONTEXT_SW \ - QXK_ON_CONTEXT_SW + QF_THREAD_TYPE=void* EXPAND_AS_DEFINED = -SKIP_FUNCTION_MACROS = YES +SKIP_FUNCTION_MACROS = NO diff --git a/doxygen/api.dox b/doxygen/api.dox index e1276970..e4845600 100644 --- a/doxygen/api.dox +++ b/doxygen/api.dox @@ -125,6 +125,7 @@ QS is a software tracing system that enables developers to monitor live event-dr - QS_OBJ_ARR_DICTIONARY() - QS_FUN_DICTIONARY() - QS_USR_DICTIONARY() +- QS_ENUM_DICTIONARY() @subsection api_qs_user QS Application-Specific Records @@ -134,9 +135,9 @@ QS is a software tracing system that enables developers to monitor live event-dr - QS_U8() / QS_I8() - QS_U16() / QS_I16() - QS_U32() / QS_I32() -- QS_U32_HEX() - QS_STR() - QS_MEM() +- QS_ENUM() @section api_qv QV (Cooperative Kernel) @@ -176,7 +177,7 @@ QK is a tiny **preemptive**, run-to-completion (RTC) kernel designed specificall @section api_qxk QXK (Dual-Mode Kernel) -QXK is a small, preemptive, priority-based, dual-mode (run-to-completion/**blocking**) kernel that executes active objects like the @ref srs_qk "QK kernel", but can also execute traditional __blocking__ threads (extended threads). In this respect, QXK behaves exactly as a conventional __RTOS__ (Real-Time Operating System). QXK has been designed specifically for mixing event-driven active objects with traditional blocking code, such as commercial middleware (TCP/IP stacks, UDP stacks, embedded file systems, etc.) or legacy software. +QXK is a small, preemptive, priority-based, dual-mode (run-to-completion/blocking) kernel that executes active objects like the @ref srs_qk "QK kernel", but can also execute traditional __blocking__ threads (extended threads). In this respect, QXK behaves exactly as a conventional __RTOS__ (Real-Time Operating System). QXK has been designed specifically for mixing event-driven active objects with traditional blocking code, such as commercial middleware (TCP/IP stacks, UDP stacks, embedded file systems, etc.) or legacy software. @subsection api_qxk_ctrl Kernel Initialization and Control diff --git a/doxygen/config.h b/doxygen/config.h index 8b7d0598..615cd089 100644 --- a/doxygen/config.h +++ b/doxygen/config.h @@ -1,241 +1,9 @@ /** * @file -* @brief Various macros for configuring and porting QP/C +* @brief Various macros for configuring QP/C (typically used as +* command-line options) */ -/*! The maximum number of active objects in the application. -* -* @description -* This macro *must* be defined in the QF port and should be in range -* of 1U..64U, inclusive. The value of this macro determines the maximum -* priority level of an active object in the system. Not all priority -* levels must be used, but the maximum priority cannot exceed -* #QF_MAX_ACTIVE. -* -* @note Once you choose a certain value of #QF_MAX_ACTIVE, you must -* consistently use the same value in building all the QP component libraries -* and your own application code. The consistency is guaranteed if you define -* this macro only once in the qf_port.h header file and henceforth include -* this header file in all builds. -*/ -#define QF_MAX_ACTIVE 32U - -/*! The maximum number of clock tick rates in the application. -* -* @description -* This macro can be defined in the QF ports and should be in range -* of 1U..15U, inclusive. The value of this macro determines the maximum -* number of clock tick rates for time events (::QTimeEvt). -* -* If the macro is not defined, the default value is 1U. -* -* @note Once you choose a certain value of #QF_MAX_TICK_RATE, you must -* consistently use the same value in building all the QP component libraries -* and your own application code. The consistency is guaranteed if you define -* this macro only once in the qf_port.h header file and henceforth include -* this header file in all builds. -*/ -#define QF_MAX_TICK_RATE 1U - -/*! The maximum number of event pools in the application. -* -* @description -* This macro can be defined in the QF ports and should be in range -* of 1U..255U, inclusive. The value of this macro determines the maximum -* event pools in the system. Not all event pools must be actually used, -* but the maximum number of pools cannot exceed #QF_MAX_EPOOL. -* -* If the macro is not defined, the default value is 3U. Defining the value -* below the maximum saves some memory, mostly for the subscriber-lists. -* @sa ::QSubscrList. -* -* @note Once you choose a certain value of #QF_MAX_EPOOL, you must -* consistently use the same value in building all the QP component libraries -* and your own application code. The consistency is guaranteed if you define -* this macro only once in the qf_port.h header file and henceforth include -* this header file in all builds. -*/ -#define QF_MAX_EPOOL 3U - -/*! The size (in bytes) of the event-size representation in the QF. -* Valid values: 1U, 2U, or 4U; default 2U -* -* @description -* This macro can be defined in the QF ports to configure the size -* of the event-size. -* -* @note Once you choose a certain value of #QF_EVENT_SIZ_SIZE, you must -* consistently use the same value in building all the QP component libraries -* and your own application code. The consistency is guaranteed if you define -* this macro only once in the qf_port.h header file and henceforth include -* this header file in all builds. -*/ -#define QF_EVENT_SIZ_SIZE 2U - -/*! The size (in bytes) of the ring-buffer counters used in the native QF -* event queue implementation. Valid values: 1U, 2U, or 4U; default 1U -* -* @description -* This macro can be defined in the QF ports to configure the ::QEQueueCtr -* type. If the macro is not defined, the default of 1 byte will be chosen in -* qequeue.h. The valid #QF_EQUEUE_CTR_SIZE values of 1U, 2U, or 4U, correspond -* to ::QEQueueCtr of uint8_t, uint16_t, and uint32_t, respectively. The -* ::QEQueueCtr data type determines the dynamic range of numerical values of -* ring-buffer counters inside event queues, or, in other words, the maximum -* number of events that the native QF event queue can manage. -* @sa ::QEQueue -* -* @note Once you choose a certain value of #QF_EQUEUE_CTR_SIZE, you must -* consistently use the same value in building all the QP component libraries -* and your own application code. The consistency is guaranteed if you define -* this macro only once in the qf_port.h header file and henceforth include -* this header file in all builds. -*/ -#define QF_EQUEUE_CTR_SIZE 1U - -/*! The size (in bytes) of the block-size representation in the native QF -* event pool. Valid values: 1U, 2U, or 4U; default #QF_EVENT_SIZ_SIZE. -* -* @description -* This macro can be defined in the QF ports to configure the ::QMPoolSize -* type. If the macro is not defined, the default of #QF_EVENT_SIZ_SIZE -* will be chosen in qmpool.h, because the memory pool is primarily used for -* implementing event pools. -* -* The valid #QF_MPOOL_SIZ_SIZE values of 1U, 2U, or 4U, correspond to -* ::QMPoolSize of uint8_t, uint16_t, and uint32_t, respectively. The -* ::QMPoolSize data type determines the dynamic range of block-sizes that -* the native ::QMPool can handle. -* @sa #QF_EVENT_SIZ_SIZE, ::QMPool -* -* @note Once you choose a certain value of #QF_MPOOL_SIZ_SIZE, you must -* consistently use the same value in building all the QP component libraries -* and your own application code. The consistency is guaranteed if you define -* this macro only once in the qf_port.h header file and henceforth include -* this header file in all builds. -*/ -#define QF_MPOOL_SIZ_SIZE 2U - -/*! The size (in bytes) of the block-counter representation in the -* native QF event pool. Valid values: 1U, 2U, or 4U; default 2U. -* -* @description -* This macro can be defined in the QF ports to configure the ::QMPoolCtr -* type. If the macro is not defined, the default of 2 bytes will be chosen -* in qmpool.h. The valid #QF_MPOOL_CTR_SIZE values of 1U, 2U, or 4U, -* correspond to ::QMPoolSize of uint8_t, uint16_t, and uint32_t, respectively. -* The ::QMPoolCtr data type determines the dynamic range of block-counters -* that the native ::QMPool can handle, or, in other words, the maximum number -* of blocks that the native QF event pool can manage. -* @sa ::QMPool -* -* @note Once you choose a certain value of #QF_MPOOL_CTR_SIZE, you must -* consistently use the same value in building all the QP component libraries -* and your own application code. The consistency is guaranteed if you define -* this macro only once in the qf_port.h header file and henceforth include -* this header file in all builds. -*/ -#define QF_MPOOL_CTR_SIZE 2U - -/*! The size (in bytes) of the time event-counter representation -* in the ::QTimeEvt struct. Valid values: 1U, 2U, or 4U; default 2U. -* -* @description -* This macro can be defined in the QF ports to configure the internal tick -* counters of Time Events. If the macro is not defined, the default of 4 -* bytes will be chosen in qf.h. The valid #QF_TIMEEVT_CTR_SIZE values of 1, -* 2, or 4, correspond to tick counters of uint8_t, uint16_t, and uint32_t, -* respectively. The tick counter representation determines the dynamic range -* of time delays that a Time Event can handle. -* @sa ::QTimeEvt -* -* @note Once you choose a certain value of #QF_TIMEEVT_CTR_SIZE, you must -* consistently use the same value in building all the QP component libraries -* and your own application code. The consistency is guaranteed if you define -* this macro only once in the qf_port.h header file and henceforth include -* this header file in all builds. -*/ -#define QF_TIMEEVT_CTR_SIZE 4U - -/*! Define the interrupt disabling policy. -* -* @description -* This macro encapsulates platform-specific way of disabling interrupts -* from "C" for a given CPU and compiler. -* -* @note -* the #QF_INT_DISABLE macro should always be used in pair with the -* macro #QF_INT_ENABLE. -*/ -#define QF_INT_DISABLE() intDisable() - -/*! Define the interrupt enabling policy. -* -* @description -* This macro encapsulates platform-specific way of enabling interrupts -* from "C" for a given CPU and compiler. -* -* @note the #QF_INT_DISABLE macro should always be used in pair with the -* macro #QF_INT_ENABLE. -*/ -#define QF_INT_ENABLE() intEnable() - -void intDisable(void); -void intEnable(void); - -/*! Define the type of the critical section status. -* -* @description -* Defining this macro configures the "saving and restoring critical section -* status" policy. Coversely, if this macro is not defined, the simple -* "unconditional critical section exit" is used. -*/ -#define QF_CRIT_STAT_TYPE crit_stat_t - -/*! Define the critical section entry policy. -* -* @description -* This macro enters a critical section (often by means of disabling -* interrupts). When the "saving and restoring critical section status" -* policy is used, the macro sets the @a status_ argument to the critical -* section status just before the entry. When the policy of "unconditional -* critical section exit" is used, the macro does not use the @a status_ -* argument. -* -* @note the #QF_CRIT_ENTRY macro should always be used in pair with the -* macro #QF_CRIT_EXIT. -*/ -#define QF_CRIT_ENTRY(stat_) ((stat_) = critEntry()) - -/*! Define the critical section exit policy. -/* -* @description -* This macro enters a critical section (often by means of disabling -* interrupts). When the "saving and restoring critical section status" -* policy is used, the macro restores the critical section status from the -* @a status_ argument. When the policy of "unconditional critical section -* exit" is used, the macro does not use the @a status argument and -* exits the critical section unconditionally (often by means of enabling -* interrupts). -* -* @note the #QF_CRIT_ENTRY macro should always be used in pair with the -* macro #QF_CRIT_EXIT. -*/ -#define QF_CRIT_EXIT(stat_) critExit(stat_) - -typedef unsigned int crit_stat_t; -crit_stat_t critEntry(void); -void critExit(crit_stat_t stat); - -/*! Enable the QActive_stop() API in the QF port. -* -* @description -* Defining this macro enables the QActive_stop() API in a given port. -* This feature should be used with caution, as stopping and re-starting -* active objects **cleanly** can be tricky. -*/ -#define QF_ACTIVE_STOP - /*! The preprocessor switch to disable checking assertions * * @description @@ -251,6 +19,15 @@ void critExit(crit_stat_t stat); */ #define Q_NASSERT +/*! Enable the QActive_stop() API in the QF port. +* +* @description +* Defining this macro enables the QActive_stop() API in a given port. +* This feature should be used with caution, as stopping and re-starting +* active objects **cleanly** can be tricky. +*/ +#define QF_ACTIVE_STOP + /*! The preprocessor switch to activate the QS software tracing * instrumentation in the code * @@ -276,133 +53,10 @@ void critExit(crit_stat_t stat); */ #define Q_EVT_CTOR -/*! This macro defines the type of the thread handle used for AOs */ -#define QF_THREAD_TYPE void* - -/*! This macro defines the type of the event-queue used for AOs */ -#define QF_EQUEUE_TYPE QEQueue - -/*! This macro defines the type of the OS-Object used for blocking -* the native ::QEQueue when the queue is empty -* -* @description -* This macro is used when ::QEQueue is used as the event-queue for AOs -* but also the AO queue must *block* when the queue is empty. -* In that case, #QF_OS_OBJECT_TYPE specifies the blocking mechanism. -* For example, in the POSIX port, the blocking mechanism is a condition -* variable. +/*! This macro enables calling the context-switch callback +* QF_onContextSw() in all build-in kernels (QV, QK, QXK) */ -#define QF_OS_OBJECT_TYPE pthread_cond_t - -/*! Platform-dependent macro defining how QF should block the -* calling task when the QF native queue is empty -* -* @note -* This is just an example of QACTIVE_EQUEUE_WAIT_() for the QK-port -* of QF. QK never activates a task that has no events to process, so in -* this case the macro asserts that the queue is not empty. In other QF -* ports you need to define the macro appropriately for the underlying -* kernel/OS you're using. -*/ -#define QACTIVE_EQUEUE_WAIT_(me_) \ - (Q_ASSERT((me_)->eQueue.frontEvt != (QEvt *)0)) - -#if (QF_MAX_ACTIVE <= 8U) - #define QACTIVE_EQUEUE_SIGNAL_(me_) do { \ - QPSet8_insert(&QF_readySet_, (me_)->prio); \ - if (QF_intNest_ == 0U) { \ - uint_fast8_t p = QK_schedPrio_(); \ - if (p != 0U) { \ - QK_sched_(p); \ - } \ - } \ - } while (0) -#else - /*! Platform-dependent macro defining how QF should signal the - * active object task that an event has just arrived. - * - * @description - * The macro is necessary only when the native QF event queue is used. - * The signaling of task involves unblocking the task if it is blocked. - * - * @note QACTIVE_EQUEUE_SIGNAL_() is called from a critical section. - * It might leave the critical section internally, but must restore - * the critical section before exiting to the caller. - * - * @note This is just an example of QACTIVE_EQUEUE_SIGNAL_() for the - * QK-port of QF. In other QF ports you need to define the macro - * appropriately for the underlying kernel/OS you're using. - */ - #define QACTIVE_EQUEUE_SIGNAL_(me_) do { \ - QPSet64_insert(&QF_readySet_, (me_)->prio); \ - if (QF_intNest_ == 0U) { \ - uint_fast8_t p = QK_schedPrio_(); \ - if (p != 0U) { \ - QK_sched_(p); \ - } \ - } \ - } while (0) -#endif - -/*! This macro defines the type of the event pool used in the QK kernel. -* -* @note This is a specific implementation for the QK-port of QF. -* In other QF ports you need to define the macro appropriately for -* the underlying kernel/OS you're using. -*/ -#define QF_EPOOL_TYPE_ QMPool - -/*! This macro enables calling the QK context-switch callback -* QK_onContextSw() -*/ -#define QK_ON_CONTEXT_SW - -/*! This macro enables calling the QXK context-switch callback -* QXK_onContextSw() -*/ -#define QXK_ON_CONTEXT_SW - -/*! Platform-dependent macro defining the event pool initialization -* -* @note -* This is an example implementation based on the native ::QMPool class. -* In other QF ports, the port might be using a memory pool from the -* underlying kernel/OS. -*/ -#define QF_EPOOL_INIT_(p_, poolSto_, poolSize_, evtSize_) \ - (QMPool_init(&(p_), (poolSto_), (poolSize_), (QMPoolSize)(evtSize_))) - -/*! Platform-dependent macro defining how QF should obtain the -* event pool block-size -* -* @note -* This is a specific implementation for the built-in kernels. -* In other QF ports you need to define the macro appropriately for -* the underlying kernel/OS you're using. -*/ -#define QF_EPOOL_EVENT_SIZE_(p_) ((uint32_t)(p_).blockSize) - -/*! Platform-dependent macro defining how QF should obtain an event -* @a e_ from the event pool @a p_ with the free margin @a m_. -* -* @note -* This is an example implementation based on the native ::QMPool class. -* In other QF ports, the port might be using a memory pool from the -* underlying kernel/OS. -*/ -#define QF_EPOOL_GET_(p_, e_, m_, qs_id_) \ - ((e_) = (QEvt *)QMPool_get(&(p_), (m_), (qs_id_))) - -/*! Platform-dependent macro defining how QF should return an event -* @a e_ to the event pool @a p_ -* -* @note -* This is an example implementation based on the native ::QMPool class. -* In other QF ports, the port might be using a memory pool from the -* underlying kernel/OS. -*/ -#define QF_EPOOL_PUT_(p_, e_, qs_id_) \ - (QMPool_put(&(p_), (e_), (qs_id_))) +#define QF_ON_CONTEXT_SW /*! Macro defined only for the internal QP implementation. It should * be not defined for the application-level code diff --git a/doxygen/dir.dox b/doxygen/dir.dox index 4a79522f..83ae9dc2 100644 --- a/doxygen/dir.dox +++ b/doxygen/dir.dox @@ -16,7 +16,7 @@ The QP™/C src directory needs to be added */ /*##########################################################################*/ /*! @dir src/qf -@brief Platform-independent implementation of the @ref qep and @ref qf components. +@brief Platform-independent implementation of the QEP and QF components. @note Typically, files in this directory need to be added to the application build, but some QP ports might not need all the files in this directory. For example, a QP port to a 3rd-party RTOS kernel might be using a message queue of the RTOS instead of the native QP event queue, in which case the file qf_actq.c would not be needed and should be excluded from the build. @@ -44,15 +44,5 @@ Files in this directory need to be included in the QP application build only if */ /*##########################################################################*/ /*! @dir src/qs -@brief Platform-independent implementation of the @ref qs component (software tracing). -*/ -/*##########################################################################*/ -/*! @dir test -@brief System-level tests of the QP/C framework itself. - -@note -The `qpc/test/` directory is planned to contain a growing number of system-level tests, which are based on QUTest, but *without* the QP-stub. The tests take advantage of the new QUTest configuration, where the QP-stub is NOT included (because the actual QP framework is linked). This configuration is activated by defining macro `Q_UTEST=0`. - -@attention -Many tests provided in the `qpc/test/` directory run only on embedded targets and cannot run on the host machine. +@brief Platform-independent implementation of the QS component (software tracing). */ diff --git a/doxygen/exa_native.dox b/doxygen/exa_native.dox index 8411e84a..8f1294b2 100644 --- a/doxygen/exa_native.dox +++ b/doxygen/exa_native.dox @@ -139,7 +139,8 @@ This example implements the @ref blinky "Blinky sample application" on the EK-TM The Blinky example is located in the directory qpc/examples/arm-cm/blinky_ek-tm4c123gxl, which is organized as follows: -@code{c} +
+@code{.c} qpc/ // QP/C installation directory +-examples/ // QP/C examples directory (application) | +-arm-cm/ // QP/C examples for ARM Cortex-M @@ -275,7 +276,8 @@ This example implements the @ref dpp "Dining Philosophers Problem" sample applic The DPP example is located in the directory qpc/examples/arm-cm/dpp_ek-tm4c123gxl, which is organized as follows: -@code{c} +
+@code{.c} qpc/ // QP/C installation directory +-examples/ // QP/C examples directory (applications) | +-arm-cm/ // QP/C examples for ARM Cortex-M @@ -372,7 +374,8 @@ The application also demonstrates qpc/examples/arm-cm/dpp_efm32-slstk3401a and includes versions for @ref srs_qv "cooperative QV kernel", the @ref srs_qk "preemptive QK kernel", and the @ref srs_qxk "preemptive dual mode QXK RTOS kernel" each provided for the ARM-KEIL, GNU-ARM, and IAR-ARM. The following annotated directory listing describes the contents of the example folder: -@code{c} +
+@code{.c} qpc/ // QP/C installation directory +-examples/ // QP/C examples directory (application) | +-arm-cm/ // QP/C examples for ARM Cortex-M diff --git a/doxygen/exa_os.dox b/doxygen/exa_os.dox index 2a0bffbe..308e2fff 100644 --- a/doxygen/exa_os.dox +++ b/doxygen/exa_os.dox @@ -48,10 +48,11 @@ On Windows, the **make** utility and the GNU GCC toolchain (**MinGW**) are provi @section exa_os-qv Single-Threaded and Multi-Threaded QP/C Ports Each of the examples can be linked to either the single-threaded QP/C ports (@ref win32-qv or @ref posix-qv) or multi-threaded ports (@ref win32 or @ref posix). The choice is made in the `Makefiles`, by editing the line, which defines the `QP_PORT_DIR` symbol. For instance, the following lines select the @ref win32-qv port and leave the @ref win32 port commented-out: -@code +
+@verbatim QP_PORT_DIR := $(QPC)/ports/win32-qv #QP_PORT_DIR := $(QPC)/ports/win32 -@endcode +@endverbatim To reverse the selection, you need to move the comment `#` character. @@ -72,15 +73,16 @@ The `Makefiles` for the examples generally support the following three build con @subsection exa_os-dbg Debug Configuration This is the default build configuration, with full debugging information and minimal optimization. To build this configuration, type: -@code +
+@verbatim make -@endcode +@endverbatim To clean this build, type -@code +@verbatim make clean -@endcode +@endverbatim The object files and the executable is located in the build sub-directory. @@ -90,15 +92,15 @@ The object files and the executable is located in the b This configuration is built with no debugging information and high optimization. Single-stepping and debugging might be difficult due to the lack of debugging information and optimized code. To build this configuration, type: -@code +@verbatim make CONF=rel -@endcode +@endverbatim To clean this build, type -@code +@verbatim make CONF=rel clean -@endcode +@endverbatim The object files and the executable is located in the build_rel directory. @@ -106,15 +108,15 @@ The object files and the executable is located in the b @subsection exa_os-spy Spy Configuration This configuration is built with the QP's Q-SPY trace functionality. The QP/Spy output is performed by a TCP/IP socket and requires launching the QSPY host application with the -t option. To build this configuration, type: -@code +@verbatim make CONF=spy -@endcode +@endverbatim To clean this build, type -@code +@verbatim make CONF=spy clean -@endcode +@endverbatim The object files and the executable are located in the build_spy sub-directory. diff --git a/doxygen/exa_rtos.dox b/doxygen/exa_rtos.dox index e3b422ea..66ef2114 100644 --- a/doxygen/exa_rtos.dox +++ b/doxygen/exa_rtos.dox @@ -425,7 +425,7 @@ The "Blinky" example blinks an on-board LED once per second. The blinking is don [3] west build -b [3a] west build -b nucleo_h743zi [3b] west build -b nucleo_l053r8 -~~~ +... [4] west flush @endverbatim @@ -508,7 +508,7 @@ DPP example with multiple active objects. [3] west build -b [3a] west build -b nucleo_h743zi [3b] west build -b nucleo_l053r8 -~~~ +... [4] west flush @endverbatim @@ -604,7 +604,7 @@ qspy -c /dev/ttyACM0 @endverbatim -@subsection @section zephyr_dpp-qs-output QSPY Output Example +@subsection zephyr_dpp-qs-output QSPY Output Example After resetting the board, you should see output similar to the following: @verbatim ########## Trg-RST QP-Ver=701,Build=220810_150847 diff --git a/doxygen/gen/metrics.txt b/doxygen/gen/metrics.txt index 80d9db88..a3f30552 100644 --- a/doxygen/gen/metrics.txt +++ b/doxygen/gen/metrics.txt @@ -2,7 +2,7 @@ ================================================ NLOC CCN token PARAM length location ------------------------------------------------ - 3 1 16 1 3 QHsm_state@409-411@..\include\qep.h + 3 1 16 1 3 QHsm_state@410-412@..\include\qep.h 3 1 15 1 3 QEQueue_getNFree@306-308@..\include\qequeue.h 3 1 15 1 3 QEQueue_getNMin@323-325@..\include\qequeue.h 3 1 21 1 3 QEQueue_isEmpty@342-344@..\include\qequeue.h @@ -13,41 +13,40 @@ 11 3 105 2 14 QPSet_insert@286-299@..\include\qf.h 12 3 117 2 15 QPSet_remove@302-316@..\include\qf.h 6 3 56 1 9 QPSet_findMax@319-327@..\include\qf.h - 3 1 27 1 3 QActive_getPrio@782-784@..\include\qf.h - 6 1 20 2 6 QF_psInit@1412-1417@..\include\qf.h + 6 1 20 2 6 QF_psInit@1405-1410@..\include\qf.h 3 1 20 1 3 QEvt_refCtr_inc_@180-182@..\include\qf_pkg.h 3 1 20 1 3 QEvt_refCtr_dec_@189-191@..\include\qf_pkg.h - 14 3 67 1 14 QS_rxPut@863-876@..\include\qs.h + 14 3 67 1 14 QS_rxPut@892-905@..\include\qs.h 7 1 33 3 7 QHsm_reservedEvt_@90-96@..\src\qf\qep_hsm.c 18 3 101 2 24 QHsm_isIn@103-126@..\src\qf\qep_hsm.c 22 4 125 2 31 QHsm_childState@129-159@..\src\qf\qep_hsm.c 12 2 57 2 14 QHsm_ctor@162-175@..\src\qf\qep_hsm.c 7 1 29 2 7 QHsm_top@178-184@..\src\qf\qep_hsm.c - 51 8 360 3 77 QHsm_init_@187-263@..\src\qf\qep_hsm.c - 101 15 631 3 154 QHsm_dispatch_@266-419@..\src\qf\qep_hsm.c - 3 1 16 1 3 QHsm_getStateHandler_@423-425@..\src\qf\qep_hsm.c - 91 15 480 3 132 QHsm_tran_@429-560@..\src\qf\qep_hsm.c - 14 3 79 3 17 QHsm_state_entry_@563-579@..\src\qf\qep_hsm.c - 20 3 96 3 23 QHsm_state_exit_@582-604@..\src\qf\qep_hsm.c + 55 10 386 3 82 QHsm_init_@187-268@..\src\qf\qep_hsm.c + 101 15 631 3 154 QHsm_dispatch_@271-424@..\src\qf\qep_hsm.c + 3 1 16 1 3 QHsm_getStateHandler_@428-430@..\src\qf\qep_hsm.c + 91 15 480 3 132 QHsm_tran_@434-565@..\src\qf\qep_hsm.c + 14 3 79 3 17 QHsm_state_entry_@568-584@..\src\qf\qep_hsm.c + 20 3 96 3 23 QHsm_state_exit_@587-609@..\src\qf\qep_hsm.c 15 3 69 2 16 QMsm_isInState@81-96@..\src\qf\qep_msm.c 3 1 17 1 3 QMsm_stateObj@99-101@..\src\qf\qep_msm.c - 22 4 97 2 29 QMsm_childStateObj@104-132@..\src\qf\qep_msm.c - 12 2 60 2 15 QMsm_ctor@135-149@..\src\qf\qep_msm.c - 27 4 202 3 45 QMsm_init_@152-196@..\src\qf\qep_msm.c - 117 19 728 3 168 QMsm_dispatch_@199-366@..\src\qf\qep_msm.c - 3 1 18 1 3 QMsm_getStateHandler_@370-372@..\src\qf\qep_msm.c - 55 9 317 3 68 QMsm_execTatbl_@376-443@..\src\qf\qep_msm.c - 24 4 132 4 32 QMsm_exitToTranSource_@446-477@..\src\qf\qep_msm.c - 45 6 243 3 54 QMsm_enterHistory_@480-533@..\src\qf\qep_msm.c - 82 14 431 4 120 QActive_post_@70-189@..\src\qf\qf_actq.c - 44 7 266 2 66 QActive_postLIFO_@194-259@..\src\qf\qf_actq.c - 34 3 233 1 44 QActive_get_@264-307@..\src\qf\qf_actq.c - 10 2 60 1 11 QF_getQueueMin@313-323@..\src\qf\qf_actq.c - 16 2 79 2 20 QTicker_ctor@342-361@..\src\qf\qf_actq.c - 10 1 45 3 11 QTicker_init_@364-374@..\src\qf\qf_actq.c - 17 2 92 3 20 QTicker_dispatch_@377-396@..\src\qf\qf_actq.c - 30 2 156 4 37 QTicker_post_@399-435@..\src\qf\qf_actq.c - 8 1 30 2 9 QTicker_postLIFO_@438-446@..\src\qf\qf_actq.c + 31 7 153 2 38 QMsm_childStateObj@104-141@..\src\qf\qep_msm.c + 12 2 60 2 15 QMsm_ctor@144-158@..\src\qf\qep_msm.c + 27 4 202 3 45 QMsm_init_@161-205@..\src\qf\qep_msm.c + 118 19 740 3 169 QMsm_dispatch_@208-376@..\src\qf\qep_msm.c + 3 1 18 1 3 QMsm_getStateHandler_@380-382@..\src\qf\qep_msm.c + 55 9 317 3 70 QMsm_execTatbl_@386-455@..\src\qf\qep_msm.c + 24 4 132 4 33 QMsm_exitToTranSource_@458-490@..\src\qf\qep_msm.c + 45 6 243 3 56 QMsm_enterHistory_@493-548@..\src\qf\qep_msm.c + 82 14 431 4 122 QActive_post_@70-191@..\src\qf\qf_actq.c + 44 7 266 2 66 QActive_postLIFO_@196-261@..\src\qf\qf_actq.c + 34 3 233 1 44 QActive_get_@266-309@..\src\qf\qf_actq.c + 10 2 60 1 11 QF_getQueueMin@315-325@..\src\qf\qf_actq.c + 16 2 79 2 20 QTicker_ctor@344-363@..\src\qf\qf_actq.c + 10 1 45 3 11 QTicker_init_@366-376@..\src\qf\qf_actq.c + 16 2 90 3 18 QTicker_dispatch_@379-396@..\src\qf\qf_actq.c + 30 2 156 4 39 QTicker_post_@399-437@..\src\qf\qf_actq.c + 8 1 30 2 9 QTicker_postLIFO_@440-448@..\src\qf\qf_actq.c 15 1 84 3 17 QActive_defer@65-81@..\src\qf\qf_defer.c 34 3 169 2 54 QActive_recall@86-139@..\src\qf\qf_defer.c 13 3 68 2 15 QActive_flushDeferred@144-158@..\src\qf\qf_defer.c @@ -56,25 +55,25 @@ 9 3 59 1 12 QF_getPoolMin@119-130@..\src\qf\qf_dyn.c 39 7 234 3 57 QF_newX_@133-189@..\src\qf\qf_dyn.c 30 4 188 1 46 QF_gc@192-237@..\src\qf\qf_dyn.c - 20 2 99 2 28 QF_newRef_@240-267@..\src\qf\qf_dyn.c - 11 2 67 1 15 QF_deleteRef_@270-284@..\src\qf\qf_dyn.c + 20 3 99 2 30 QF_newRef_@240-269@..\src\qf\qf_dyn.c + 11 2 67 1 15 QF_deleteRef_@272-286@..\src\qf\qf_dyn.c 32 5 233 4 50 QMPool_init@67-116@..\src\qf\qf_mem.c - 45 5 241 3 72 QMPool_get@119-190@..\src\qf\qf_mem.c - 19 3 117 3 26 QMPool_put@193-218@..\src\qf\qf_mem.c + 45 5 241 3 74 QMPool_get@119-192@..\src\qf\qf_mem.c + 19 3 117 3 28 QMPool_put@195-222@..\src\qf\qf_mem.c 8 1 35 2 13 QActive_psInit@73-85@..\src\qf\qf_ps.c - 43 6 232 3 73 QActive_publish_@90-162@..\src\qf\qf_ps.c - 18 5 111 2 24 QActive_subscribe@167-190@..\src\qf\qf_ps.c - 18 5 111 2 27 QActive_unsubscribe@195-221@..\src\qf\qf_ps.c - 19 5 130 1 24 QActive_unsubscribeAll@226-249@..\src\qf\qf_ps.c + 43 6 232 3 75 QActive_publish_@90-164@..\src\qf\qf_ps.c + 18 5 111 2 24 QActive_subscribe@169-192@..\src\qf\qf_ps.c + 18 5 111 2 27 QActive_unsubscribe@197-223@..\src\qf\qf_ps.c + 19 5 130 1 24 QActive_unsubscribeAll@228-251@..\src\qf\qf_ps.c 10 2 46 2 10 QF_bzero@85-94@..\src\qf\qf_qact.c 16 2 72 2 23 QActive_ctor@101-123@..\src\qf\qf_qact.c 28 10 225 1 47 QActive_register_@128-174@..\src\qf\qf_qact.c 10 3 79 1 15 QActive_unregister_@179-193@..\src\qf\qf_qact.c 24 6 143 1 29 QF_LOG2@201-229@..\src\qf\qf_qact.c 14 2 84 3 14 QEQueue_init@67-80@..\src\qf\qf_qeq.c - 57 8 301 4 76 QEQueue_post@83-158@..\src\qf\qf_qeq.c - 36 5 199 3 46 QEQueue_postLIFO@161-206@..\src\qf\qf_qeq.c - 38 4 219 2 48 QEQueue_get@209-256@..\src\qf\qf_qeq.c + 57 8 301 4 78 QEQueue_post@83-160@..\src\qf\qf_qeq.c + 36 5 199 3 48 QEQueue_postLIFO@163-210@..\src\qf\qf_qeq.c + 38 4 219 2 50 QEQueue_get@213-262@..\src\qf\qf_qeq.c 16 2 79 2 35 QMActive_ctor@74-108@..\src\qf\qf_qmact.c 15 2 96 4 32 QTimeEvt_ctorX@78-109@..\src\qf\qf_time.c 33 8 225 3 59 QTimeEvt_armX@112-170@..\src\qf\qf_time.c @@ -82,31 +81,31 @@ 36 8 230 2 64 QTimeEvt_rearm@216-279@..\src\qf\qf_time.c 5 1 36 1 5 QTimeEvt_wasDisarmed@282-286@..\src\qf\qf_time.c 7 1 30 1 8 QTimeEvt_currCtr@289-296@..\src\qf\qf_time.c - 69 7 380 2 110 QTimeEvt_tick_@299-408@..\src\qf\qf_time.c - 14 3 75 1 16 QTimeEvt_noActive@411-426@..\src\qf\qf_time.c + 69 7 380 2 112 QTimeEvt_tick_@299-410@..\src\qf\qf_time.c + 14 3 75 1 16 QTimeEvt_noActive@413-428@..\src\qf\qf_time.c 21 2 112 1 31 QK_schedLock@74-104@..\src\qk\qk.c 20 4 118 1 33 QK_schedUnlock@107-139@..\src\qk\qk.c 11 3 101 1 23 QF_init@144-166@..\src\qk\qk.c 3 1 10 1 4 QF_stop@169-172@..\src\qk\qk.c - 15 4 61 1 25 QF_run@175-199@..\src\qk\qk.c - 25 3 156 7 34 QActive_start_@206-239@..\src\qk\qk.c - 19 4 78 1 24 QK_sched_@244-267@..\src\qk\qk.c - 65 17 384 1 112 QK_activate_@270-381@..\src\qk\qk.c + 18 6 76 1 33 QF_run@175-207@..\src\qk\qk.c + 25 3 156 7 34 QActive_start_@214-247@..\src\qk\qk.c + 19 4 78 1 24 QK_sched_@252-275@..\src\qk\qk.c + 65 17 378 1 112 QK_activate_@278-389@..\src\qk\qk.c 7 3 52 1 13 QF_init@73-85@..\src\qv\qv.c 3 1 10 1 4 QF_stop@88-91@..\src\qv\qv.c - 39 10 197 1 77 QF_run@94-170@..\src\qv\qv.c - 18 1 124 7 25 QActive_start_@177-201@..\src\qv\qv.c + 46 15 251 1 97 QF_run@94-190@..\src\qv\qv.c + 18 1 124 7 25 QActive_start_@197-221@..\src\qv\qv.c 23 3 131 1 34 QXK_schedLock@71-104@..\src\qxk\qxk.c 20 4 118 1 33 QXK_schedUnlock@107-139@..\src\qxk\qxk.c - 11 3 101 1 23 QF_init@144-166@..\src\qxk\qxk.c - 3 1 10 1 4 QF_stop@169-172@..\src\qxk\qxk.c - 18 4 92 1 30 QF_run@175-204@..\src\qxk\qxk.c - 29 5 178 7 42 QActive_start_@211-252@..\src\qxk\qxk.c - 42 8 220 1 53 QXK_sched_@260-312@..\src\qxk\qxk.c - 59 16 383 1 98 QXK_activate_@315-412@..\src\qxk\qxk.c - 12 2 72 1 18 QXK_current@415-432@..\src\qxk\qxk.c - 23 7 132 1 34 QXK_contextSw@436-469@..\src\qxk\qxk.c - 13 2 104 1 23 QXK_threadExit_@476-498@..\src\qxk\qxk.c + 12 3 110 1 24 QF_init@144-167@..\src\qxk\qxk.c + 3 1 10 1 4 QF_stop@170-173@..\src\qxk\qxk.c + 20 6 98 1 35 QF_run@176-210@..\src\qxk\qxk.c + 29 5 178 7 42 QActive_start_@217-258@..\src\qxk\qxk.c + 42 8 220 1 53 QXK_sched_@266-318@..\src\qxk\qxk.c + 59 16 377 1 98 QXK_activate_@321-418@..\src\qxk\qxk.c + 12 2 72 1 18 QXK_current@421-438@..\src\qxk\qxk.c + 19 5 105 1 26 QXK_contextSw@442-467@..\src\qxk\qxk.c + 13 2 104 1 23 QXK_threadExit_@474-496@..\src\qxk\qxk.c 10 2 64 2 13 QXMutex_init@74-86@..\src\qxk\qxk_mutex.c 81 11 724 2 138 QXMutex_lock@89-226@..\src\qxk\qxk_mutex.c 59 9 502 1 97 QXMutex_tryLock@229-325@..\src\qxk\qxk_mutex.c @@ -122,12 +121,12 @@ 10 1 39 3 11 QXThread_init_@247-257@..\src\qxk\qxk_xthr.c 10 1 39 3 11 QXThread_dispatch_@260-270@..\src\qxk\qxk_xthr.c 31 7 216 7 52 QXThread_start_@273-324@..\src\qxk\qxk_xthr.c - 100 15 527 4 138 QXThread_post_@327-464@..\src\qxk\qxk_xthr.c - 8 1 30 2 9 QXThread_postLIFO_@467-475@..\src\qxk\qxk_xthr.c - 5 1 49 1 7 QXThread_block_@478-484@..\src\qxk\qxk_xthr.c - 8 3 56 1 8 QXThread_unblock_@487-494@..\src\qxk\qxk_xthr.c - 20 3 157 3 39 QXThread_teArm_@497-535@..\src\qxk\qxk_xthr.c - 11 2 46 1 13 QXThread_teDisarm_@538-550@..\src\qxk\qxk_xthr.c + 100 15 527 4 140 QXThread_post_@327-466@..\src\qxk\qxk_xthr.c + 8 1 30 2 9 QXThread_postLIFO_@469-477@..\src\qxk\qxk_xthr.c + 5 1 49 1 7 QXThread_block_@480-486@..\src\qxk\qxk_xthr.c + 8 3 56 1 8 QXThread_unblock_@489-496@..\src\qxk\qxk_xthr.c + 20 3 157 3 39 QXThread_teArm_@499-537@..\src\qxk\qxk_xthr.c + 11 2 46 1 13 QXThread_teDisarm_@540-552@..\src\qxk\qxk_xthr.c 33 file analyzed. ============================================================== NLOC Avg.NLOC AvgCCN Avg.token function_cnt file @@ -135,33 +134,33 @@ NLOC Avg.NLOC AvgCCN Avg.token function_cnt file 6 0.0 0.0 0.0 0 ..\include\qassert.h 133 3.0 1.0 16.0 1 ..\include\qep.h 33 3.0 1.0 17.0 3 ..\include\qequeue.h - 226 6.6 2.4 60.1 9 ..\include\qf.h + 226 7.0 2.6 64.2 8 ..\include\qf.h 15 3.0 1.0 20.0 2 ..\include\qf_pkg.h - 19 0.0 0.0 0.0 0 ..\include\qk.h + 16 0.0 0.0 0.0 0 ..\include\qk.h 25 0.0 0.0 0.0 0 ..\include\qmpool.h - 8 0.0 0.0 0.0 0 ..\include\qpc.h - 356 14.0 3.0 67.0 1 ..\include\qs.h + 7 0.0 0.0 0.0 0 ..\include\qpc.h + 361 14.0 3.0 67.0 1 ..\include\qs.h 3 0.0 0.0 0.0 0 ..\include\qstamp.c 2 0.0 0.0 0.0 0 ..\include\qstamp.h 0 0.0 0.0 0.0 0 ..\include\qs_dummy.h 19 0.0 0.0 0.0 0 ..\include\qs_pkg.h 7 0.0 0.0 0.0 0 ..\include\qv.h - 96 0.0 0.0 0.0 0 ..\include\qxk.h - 359 31.5 5.1 182.5 11 ..\src\qf\qep_hsm.c - 336 32.3 5.3 188.3 10 ..\src\qf\qep_msm.c + 93 0.0 0.0 0.0 0 ..\include\qxk.h + 363 31.8 5.3 184.8 11 ..\src\qf\qep_hsm.c + 346 33.3 5.6 195.1 10 ..\src\qf\qep_msm.c 2 0.0 0.0 0.0 0 ..\src\qf\qf_act.c - 258 27.9 3.8 154.7 9 ..\src\qf\qf_actq.c + 257 27.8 3.8 154.4 9 ..\src\qf\qf_actq.c 69 20.7 2.3 107.0 3 ..\src\qf\qf_defer.c - 138 18.4 3.1 111.4 7 ..\src\qf\qf_dyn.c + 138 18.4 3.3 111.4 7 ..\src\qf\qf_dyn.c 103 32.0 4.3 197.0 3 ..\src\qf\qf_mem.c 115 21.2 4.4 123.8 5 ..\src\qf\qf_ps.c 96 17.6 4.6 113.0 5 ..\src\qf\qf_qact.c 152 36.2 4.8 200.8 4 ..\src\qf\qf_qeq.c 18 16.0 2.0 79.0 1 ..\src\qf\qf_qmact.c 218 26.2 4.1 155.6 8 ..\src\qf\qf_time.c - 187 22.4 4.8 127.5 8 ..\src\qk\qk.c - 74 16.8 3.8 95.8 4 ..\src\qv\qv.c - 261 23.0 5.0 140.1 11 ..\src\qxk\qxk.c + 190 22.8 5.0 128.6 8 ..\src\qk\qk.c + 81 18.5 5.0 109.2 4 ..\src\qv\qv.c + 260 22.9 5.0 138.5 11 ..\src\qxk\qxk.c 235 57.0 8.5 490.0 4 ..\src\qxk\qxk_mutex.c 143 34.0 4.5 213.5 4 ..\src\qxk\qxk_sema.c 325 24.4 3.8 156.0 13 ..\src\qxk\qxk_xthr.c @@ -171,5 +170,5 @@ No thresholds exceeded (cyclomatic_complexity > 20 or length > 500 or nloc > 100 ========================================================================================== Total nloc Avg.NLOC AvgCCN Avg.token Fun Cnt Warning cnt Fun Rt nloc Rt ------------------------------------------------------------------------------------------ - 4037 24.2 4.2 149.1 126 0 0.00 0.00 + 4057 24.5 4.3 151.2 125 0 0.00 0.00 @endcode diff --git a/doxygen/gs.dox b/doxygen/gs.dox index 9a2d312d..0da6a10d 100644 --- a/doxygen/gs.dox +++ b/doxygen/gs.dox @@ -8,11 +8,12 @@ The YouTube Video
+ @endhtmlonly Information about the QP/C functionality, architecture, design, and other aspects is provided in the [Certification Package](modules.html): - @ref srs — QP/C functionality @@ -35,7 +36,8 @@ The most recommended way of obtaining QP™/C™ is by downloading the @ @image html qp-bundle.png @image latex qp-bundle.png width=1.5in -@caption{QP-bundle Downloads} +@caption{@webref{#Downloads, QP-bundle™ downloads}} +
@note @htmlonly @@ -243,10 +245,11 @@ While the system clock tick is very useful, it also has the unfortunate side eff @image html exa_low-power_tick.png -@image latex exa_low-power_tick.png width=6.0in +@image latex exa_low-power_tick.png width=5.5in @caption{Additional power dissipation caused by the system clock tick} @subsection arm-cm_low_power_tickless The "Tickless Mode" + Some real-time kernels use the low-power optimization called the "tickless mode" (a.k.a. "tick supression" or "dynamic tick"). In this mode, instead of indiscriminately making the clock tick fire with a fixed period, the kernel adjusts the clock ticks *dynamically*, as needed. Specifically, after each clock tick the kernel re-calculates the time for the next clock tick and then sets the clock tick interrupt for the earliest timeout it has to wait for. So for example, if the shortest wait the kernel has to attend to is 300 milliseconds into the future, then the clock interrupt will be set for 300 milliseconds. This approach maximizes the amount of time the processor can remain asleep, but requires the kernel to perform the additional work to calculate the dynamic tick intervals and to program them into the hardware. This additional bookkeeping adds complexity to the kernel, is often non-deterministic and, most importantly, extends the time CPU spends in the high-power active mode and thus eliminates some of the power gains the "tickless mode" was supposed to bring. @@ -255,6 +258,7 @@ Also, the "tickless mode" requires a more capable hardware timer that must be ab @subsection arm-cm_low_power_multiple Multiple Tick Rates + For the reasons just mentioned, the QP™ Real-Time Embedded Frameworks don't provide the "tickless mode". Instead, the QP™ frameworks support **multiple clock tick rates**, which can be turned on and off, as needed. The QP™ frameworks also provide methods for finding out *when* a given clock tick rate is not used, which allows the idle callback inside the application to shut down the given clock tick rate and also to decide which sleep mode to use for the CPU and the peripherals. The support for multiple static clock tick rates is much *simpler* than the "dynamic tick", and essentially does not increase the complexity of the kernel (because the same code for the single tick rate can handle other tick rates the same way). Also, multiple static tick rates require much simpler hardware timers, which can be clocked specifically to the desired frequency and don't need particularly wide dynamic range. For example, 16-bit timers or even 8-bit timers are completely adequate. @@ -265,6 +269,7 @@ Yet the *multiple clock rates* can deliver similar low-power operation for the s @section arm-cm_low_power_app The Low-Power Example Application The low-power example is located in QP/C and QP/C++ distributions, in the directory with the following structure: +
@code{.c} qpc|qpcpp/ // QP/C/C++ installation directory +-examples/ // QP/C/C++ examples directory (application) @@ -318,6 +323,7 @@ Actually, the **Red-LED** is also turned off for very brief moments, but this is The behavior just described is designed for the slow human interaction with the application. However, for more precise measurements with a logic analyzer, it is more convenient to speed up the application by factor of 100. This speed up can be achieved by editing the `bsp.h` header file: +
@code{.c} /* The following ticks-per-second constants determine the speed of the app. * The default (#if 1) is the SLOW speed for humans to see the blinking. @@ -369,6 +375,7 @@ The versions of this low-power example for the **QK** and **QV** kernels use two @subsection arm-cm_low_power_xt Extended Thread (QXK) The version of this low-power example for the **QXK** kernel uses one active object **Blinky0** (with the state machine shown above), but instead of the Blinky1 active object, the QXK version uses an eXtended thread (::QXThread) called **XBlinky1**, with the code shown below: +
@code{.c} #include "qpc.h" #include "low_power.h" @@ -422,6 +429,7 @@ The version of this low-power example for the **QXK** kernel uses one active obj @subsection arm-cm_low_power_idle The Idle Callback (QK/QXK) The most important functionality in this low-power example is implemented in the **idle callback** located in the BSP (Board Support Package). The idle callback QK_onIdle() for the preemptive QK kernel and the idle callback QXK_onIdle() for the QXK kernel are almost identical and are explained in this section. +
@code{.c} [0] void QXK_onIdle(void) { @@ -486,6 +494,7 @@ The QF_noTimeEvtsActiveX() function is designed to be called from a critical sec @subsection arm-cm_low_power_idle-qv The Idle Callback (QV) The idle callback QV_onIdle() for the cooperative QV kernel is slightly different, because it is called with interrupts **disabled**. The following listing shows the complete QV_onIdle() callback, with the most important points explained in the section below: +
@code{.c} [0] void QV_onIdle(void) { /* NOTE: called with interrupts DISABLED */ diff --git a/doxygen/history.dox b/doxygen/history.dox index cb9c8eab..b4b1bc7a 100644 --- a/doxygen/history.dox +++ b/doxygen/history.dox @@ -1,4 +1,4 @@ -/*! @page history Design History File +/*! @page history Design History File (DHF) @image html qcp_banner.jpg @image latex qcp_banner.jpg width=6.5in @@ -6,11 +6,63 @@ @remark This document is part of the @webref{products/qp#CERT,QP Certification Pack}, which has been specifically designed to aid companies in **safety certification** of their software based on the QP real-time embedded frameworks. +@section qpc_7_2_0 Version 7.2.0, 2023-01-06 +__QP/C Source Code:__ +- Added "enumeration dictionaries" for QS software tracing (see QS_ENUM_DICTIONARY()) +- Introduced common callback `QF_onContextSw()` used in all built-in kernels (QV, QK, QXK). This callback is enabled by the macro #QF_ON_CONTEXT_SW. +- Removed callback `QK_onContextSW()` and macro QK_ON_CONTEXT_SW and replaced with `QF_onContextSw()`/#QF_ON_CONTEXT_SW. +- Removed callback `QXK_onContextSW()` and macro QXK_ON_CONTEXT_SW and replaced with `QF_onContextSw()`/#QF_ON_CONTEXT_SW. +- Added callback `QF_onContextSW()` and macro #QF_ON_CONTEXT_SW to the QV kernel. +- added configuration macro #QS_CTR_SIZE to determine the size of the type ::QSCtr (see also [feature#195](https://sourceforge.net/p/qpc/feature-requests/195)) +- Removed backwards-compatibility with QP 5.4.0 or older. This includes removing workarounds for `QFsm`, `QFsm_ctor()`, `Q_IGNORED()`. +- Modified QMsm_childStateObj() implementation to correctly handle submachine states (see also [bug#316](https://sourceforge.net/p/qpc/bugs/316)) +- Added automatic generation of the QS function dictionary for the QHsm_top() state handler function. This happens only once on the first call to QHSM_INIT(). + +@note +It is no longer necessary to generate QS function dictionary for QHsm_top() in the application (although it is still allowed, but wasteful). + +__Ports:__ +- `ports/arm-cm` added setup of the FPU (if configured) to all build-in kernels (QV, QK, QXK) and toolchains (ARMCLANG, GNU-ARM, IAR). +- `ports/arm-cm` all ports now clear the FPCA bit in the CONTROL register (if FPU configured) right before starting the interrupts. That potentially saves the stack space (MSP) for the automatically reserved FPU context. + +@note +This change means that the applications no longer need to setup the FPU, which was done typically in the BSP. + +- `ports/posix` added configuration macro #QS_CTR_SIZE 4U, to allow QS trace buffers > 64KB (see also [feature#195](https://sourceforge.net/p/qpc/feature-requests/195)) +- `ports/win32` added configuration macro #QS_CTR_SIZE 4U, to allow QS trace buffers > 64KB (see also [feature#195](https://sourceforge.net/p/qpc/feature-requests/195)) +- `ports/esp-idf` fixed compilation error caused by obsolete macro `QF_PTR_RANGE_()` +- `ports/sample` added a sample QP/C port for reference and documentation of all available configuration options. +- `zephyr` updated `qf_port.h` to include `` rather than `` (see also [bug#321](https://sourceforge.net/p/qpc/bugs/321)) + + +__Examples:__ +- examples for QV: added callback `QF_onContextSw()` +- exampels for QK, QXK: replaced callbacks `QK_onContextSw()/QXK_onContextSw()` with `QF_onContextSw()` +- `examples/arm-cm` removed setting up the FPU from the BSPs (the FPU is now setup in the ports). +- `examples/arm-cm` added setting up the MPU (Memory Protection Unit) to catch [NULL-pointer dereferencing](https://www.state-machine.com/null-pointer-protection-with-arm-cortex-m-mpu) and other incorrect memory access. + + +__Testing:__ +- changed the QUTest assertion handler Q_onAssert() to reset the target rather than wait for user commands. This allows proper assertion handling even inside exception handlers, where the target really cannot handle interrupts (which were needed for reception of commands). This change matches the updated policy of **assertion failures** in [QUTest 7.2.0](https://www.state-machine.com/qtools/history.html#qtools_7_2_0). +- examples for QUTest (`examples/qutest` and `test` directories): adjusted makefiels to invoke the `qutest.py` utility with the new [command-line parameters](https://www.state-machine.com/qtools/qutest_use.html#qutest_command). +- modified the test fixtures to use "enum dictionaries" for commands +- added example `examples/qutest/start_seq` that demonstrates testing of start sequences. -@section qpc_7_1_3 Version 7.1.3, 2022-11-18 __Bug Fixes:__ -- This release fixes [bug#317](https://sourceforge.net/p/qpc/bugs/317) in QK kernel +- [bug#315 QSignal defined incorrectly when #Q_SIGNAL_SIZE==4U](https://sourceforge.net/p/qpc/bugs/315) +- [bug#316 Using History with Submachines does not work](https://sourceforge.net/p/qpc/bugs/316) +- [bug#321 zephyr port build error](https://sourceforge.net/p/qpc/bugs/321) + +- [bug#325 QSpy shows Sig=NULL if #Q_EVT_CTOR is used](https://sourceforge.net/p/qpc/bugs/325) + +__Feature Requests:__ +- [feature#195 allow > 64K QS trace buffer on target](https://sourceforge.net/p/qpc/feature-requests/195). This is configurable by setting the macro #QS_CTR_SIZE. + + +@section qpc_7_1_3 Version 7.1.3, 2022-11-18 +__Bug Fixes:__ +- [bug#317 QK works incorrectly in QP/C/C++ 7.1.2](https://sourceforge.net/p/qpc/bugs/317) __Source__ - The file `qstamp.c` has been copied from the `include/` folder to `src/qs/`. This makes it easier to build SPY configuration. (The file `qstamp.c` has been left in the `include/` folder for backwards compatibility). @@ -164,7 +216,7 @@ __Modified QP/C ports:__ - removed unused `ARM_ARCH` symbol from Makefiles for GNU-ARM - fixed the following bugs in QXK port to ARM Cortex-M + [bug#305 Floating-point context corruption in QXK](https://sourceforge.net/p/qpc/bugs/305) - + [bug#306 QXK_ON_CONTEXT_SW option is not compatible with soft-float](https://sourceforge.net/p/qpc/bugs/306) + + [bug#306 #QF_ON_CONTEXT_SW option is not compatible with soft-float](https://sourceforge.net/p/qpc/bugs/306) __Removed QP/C ports:__ - removed QP/C port to PIC24/dsPIC with XC16 (not compatible with C99) @@ -882,7 +934,7 @@ Also, this release adds assertions to the QXK code, which ensure that any availa Also, this release adds protection in the IRQ priorities initialization in QK/QV/QXK for ARM Cortex-M3/M4/M7, so that the number of IRQs is extracted from bits 0-2 of the ICTR register (INTLINESNUM). -Finally, this release consistently changes all example projects (for all toolchains) to use the **src/** directory for QP/C source code, instead of the **source/** directory. The source/ directory is now truly obsolete, but is still provided in this release for backwards compatibility with user projects. +Finally, this release consistently changes all example projects (for all toolchains) to use the **src** directory for QP/C source code, instead of the **source** directory. The source/ directory is now truly obsolete, but is still provided in this release for backwards compatibility with user projects. @section qpc_5_9_5 Version 5.9.5, 2017-07-20 diff --git a/doxygen/images/qk_asynch.png b/doxygen/images/qk_asynch.png deleted file mode 100644 index 9c0d4bc3..00000000 Binary files a/doxygen/images/qk_asynch.png and /dev/null differ diff --git a/doxygen/images/qk_synch.png b/doxygen/images/qk_synch.png deleted file mode 100644 index e4573d92..00000000 Binary files a/doxygen/images/qk_synch.png and /dev/null differ diff --git a/doxygen/main.dox b/doxygen/main.dox index 297bdf6e..249d30b1 100644 --- a/doxygen/main.dox +++ b/doxygen/main.dox @@ -8,7 +8,7 @@ @endif @image{inline} latex logo_github.png width=1in -To check what's new in QP™/C, please see @ref history "QP/C Revision History". You can also get the latest **QP™/C code**, with the recent enhancements and bug fixes, from the GitHub QP™/C repository. +To check what's new in QP™/C, please see @ref history "Design History File". You can also get the latest **QP™/C code**, with the recent enhancements and bug fixes, from the GitHub QP™/C repository.
@@ -21,7 +21,7 @@ The main objectives of the QP/C RTEF are: - to provide a modern, event-driven model of concurrency based on the best practices of concurrent programming collectively known as the @webref{active-object, Active Object (Actor) model of computation}, which is inherently *safer* than the traditional "shared-state concurrency, mutual-exclusion, and blocking" approach based on a conventional Real-Time Operating System (RTOS); -- to provide an efficient, @ref tr "bidirectionally traceable" implementation of @webref{fsm#HSM, Hierarchical State Machines} for specifying the internal behavior of Active Objects; +- to provide an efficient, @ref cert_tr "bidirectionally traceable" implementation of @webref{fsm#HSM, Hierarchical State Machines} for specifying the internal behavior of Active Objects; - to provide a *higher-level of abstraction* closer to the problem domain than the "naked" RTOS threads; @@ -73,7 +73,7 @@ QP/C can also work with many traditional @ref exa_rtos "Real-Time Operating Syst @subsection over_trace Traceability -QP™/C offers unprecedented, bidirectional @ref tr "traceability" among all work artifacts, which gives teams full visibility from requirements through architecture, design, source code, tests, and back again. +QP™/C offers unprecedented, bidirectional @ref cert_tr "traceability" among all work artifacts, which gives teams full visibility from requirements through architecture, design, source code, tests, and back again. @subsection over_popular Popularity & Maturity diff --git a/doxygen/modules-unused.dox b/doxygen/modules-unused.dox index d50d4ede..7d2357a8 100644 --- a/doxygen/modules-unused.dox +++ b/doxygen/modules-unused.dox @@ -229,7 +229,9 @@ The TLS implementations vary, but many systems, including QXK, implement TLS by Typical usage of TLS in QXK is illustrated in the example qpc/examples/arm-cm/dpp_efm32-slstk3401a/qxk/, test.c, and consists: - define the TLS structure -@code{c} + +
+@code{.c} typedef struct { uint32_t foo; uint8_t bar[10]; @@ -237,7 +239,9 @@ typedef struct { @endcode - allocate the TLS storage for all participating threads (extended or basic threads) -@code{c} + +
+@code{.c} static TLS_test l_tls1; static TLS_test l_tls2; @endcode @@ -256,7 +260,9 @@ static void Thread2_run(QXThread * const me) { @endcode - access the TLS from your code: -@code{c} + +
+@code{.c} void lib_fun(uint32_t x) { QXK_TLS(TLS_test *)->foo = x; } diff --git a/doxygen/ports_arm-cm.dox b/doxygen/ports_arm-cm.dox index 131a78dd..a5916bdb 100644 --- a/doxygen/ports_arm-cm.dox +++ b/doxygen/ports_arm-cm.dox @@ -10,6 +10,7 @@ To focus the discussion, this section references the **GNU-ARM toolchain**, the @section arm-cm_files Directories and Files The QP ports to ARM Cortex-M are available in the standard QP distribution. Specifically, the ARM Cortex-M ports are placed in the following directories: +
@code{.c} qpc/ports/arm-cm // QP/C ports to ARM Cortex-M +---qk // QP/C ports to QK preemptive kernel @@ -226,7 +227,7 @@ The QEP header file for the ARM Cortex-M port is located in FPCCR |= (1U << FPU_FPCCR_ASPEN_Pos) | (1U << FPU_FPCCR_LSPEN_Pos); +@endverbatim @subsection arm-cm_qv-fpu_noisr FPU NOT used in the ISRs @@ -535,25 +539,12 @@ If you use the FPU only at the thread-level (inside active objects) and none of FPU->FPCCR &= ~((1U << FPU_FPCCR_ASPEN_Pos) | (1U << FPU_FPCCR_LSPEN_Pos)); @endverbatim -With this setting, the Cortex-M4F processor handles the ISRs in the exact-same way as Cortex-M0-M3, that is, only the standard interrupt frame with R0-R3,R12,LR,PC,xPSR is used. This scheme is the fastest and incurs no additional CPU cycles to save and restore the FPU registers. +With this setting, the processor uses only the standard 8-register interrupt stack frame with R0-R3,R12,LR,PC,xPSR. This scheme is the fastest and incurs no additional CPU cycles to save and restore the FPU registers. -@note +@attention This FPU setting will lead to FPU errors, if any of the ISRs indeed starts to use the FPU -@subsection arm-cm_qv-fpu_isr FPU used in the ISRs -If you use the FPU both at the thread-level (inside active objects) and in any of your ISRs as well, you should setup the FPU to use the automatic state preservation and the lazy stacking feature as follows: - -@verbatim - FPU->FPCCR |= (1U << FPU_FPCCR_ASPEN_Pos) | (1U << FPU_FPCCR_LSPEN_Pos); -@endverbatim - -This will enable the lazy stacking feature of the Cortex-M4F/M7 processor [@ref ARM-AN298]. The the "automatic state saving" and "lazy stacking" are enabled by default, so you typically don't need to change these settings. - -@note -As described in the ARM Application Note "Cortex-M4(F) Lazy Stacking and Context Switching" [@ref ARM-AN298], the FPU automatic state saving requires more stack plus additional CPU time to save the FPU registers, but only when the FPU is actually used. - - @section arm-cm_qv-idle QV Idle Processing Customization in QV_onIdle() When no events are available, the non-preemptive QV kernel invokes the platform-specific callback function QV_onIdle(), which you can use to save CPU power, or perform any other "idle" processing (such as Quantum Spy software trace output). @@ -565,7 +556,7 @@ Because QV_onIdle() must enable interrupts internally, the signature of the func @anchor arm-cm_qv_onidle-code @caption{Listing: QV_onIdle() for ARM Cortex-M} -@code{c} +@code{.c} [1] void QV_onIdle(void) { /* entered with interrupts DISABLED, see NOTE01 */ ~ ~ ~ [2] #if defined NDEBUG @@ -1125,33 +1116,11 @@ If you have the Cortex-M4F CPU and your application uses the hardware FPU, it sh @endverbatim @note -The FPU must be enabled before executing any floating point instruction. An attempt to execute a floating point instruction will fault if the FPU is not enabled. - -Depending on wheter or not you use the FPU in your ISRs, the "Vanilla" QP port allows you to configure the FPU in various ways, as described in the following sub-sections. - - -@subsection arm-cm_qk-fpu_1thread FPU used in ONE thread only and not in any ISR -If you use the FPU only at a single thread (active object) and none of your ISRs use the FPU, you can setup the FPU not to use the automatic state preservation and not to use the lazy stacking feature as follows: - +If the FPU is configured in the project, the QK kernel initializes the FPU to use the automatic state preservation and the lazy stacking feature as follows: @verbatim -FPU->FPCCR &= ~((1U << FPU_FPCCR_ASPEN_Pos) | (1U << FPU_FPCCR_LSPEN_Pos)); + FPU->FPCCR |= (1U << FPU_FPCCR_ASPEN_Pos) | (1U << FPU_FPCCR_LSPEN_Pos); @endverbatim -With this setting, the Cortex-M4F processor handles the ISRs in the exact-same way as Cortex-M0-M3, that is, only the standard interrupt frame with R0-R3,R12,LR,PC,xPSR is used. This scheme is the fastest and incurs no additional CPU cycles to save and restore the FPU registers. - -@note -This FPU setting will lead to FPU errors, if more than one thread or any of the ISRs indeed start to use the FPU - - -@subsection arm-cm_qk-fpu_nthreadd FPU used in more than one thread only or the ISR -If you use the FPU in more than one of the threads (active objects) or in any of your ISRs, you should setup the FPU to use the automatic state preservation and the lazy stacking feature as follows: - -@verbatim -FPU->FPCCR |= (1U << FPU_FPCCR_ASPEN_Pos) | (1U << FPU_FPCCR_LSPEN_Pos); -@endverbatim - -This is actually the default setting of the hardware FPU and is recommended for the QK port, because it is safer in view of code evolution. Future changes to the application can easily introduce FPU use in multiple active objects, which would be unsafe if the FPU context was not preserved automatically. - @note As described in the ARM Application Note "Cortex-M4(F) Lazy Stacking and Context Switching" [@ref ARM-AN298], the FPU automatic state saving requires more stack plus additional CPU time to save the FPU registers, but only when the FPU is actually used. @@ -1163,7 +1132,7 @@ The THUMB-2 instruction set used exclusively in ARM Cortex-M provides a special @anchor arm-cm_qk_onidle-code @caption{Listing: QV_onIdle() for ARM Cortex-M} -@code{c} +@code{.c} [1] void QK_onIdle(void) { ~ ~ ~ @@ -1189,7 +1158,8 @@ The `bsp.c` file included in the examples/arm-cm/dpp_ek The technique described in this section will allow you to trigger an interrupt at any machine instruction and observe the preemption it causes. The interrupt used for the testing purposes is the GPIOA interrupt (INTID == 0). The ISR for this interrupt is shown below: -@code{c} +
+@code{.c} void GPIOPortA_IRQHandler(void) { QK_ISR_ENTRY(); /* inform QK about entering an ISR */ QACTIVE_POST(AO_Table, Q_NEW(QEvt, MAX_PUB_SIG), /* for testing... */ diff --git a/doxygen/ports_rtos.dox b/doxygen/ports_rtos.dox index 08690943..57d746dc 100644 --- a/doxygen/ports_rtos.dox +++ b/doxygen/ports_rtos.dox @@ -93,6 +93,7 @@ The provided examples show how to write regular "kernel-aware" ISRs as well as " Here is an example of a regular "kernel-aware" ISR (note the use of the `FromISR` suffix in the QP APIs): +
@code{.c} /* NOTE: only the "FromISR" API variants are allowed in the ISRs! */ void GPIOPortA_IRQHandler(void) { @@ -111,6 +112,7 @@ void GPIOPortA_IRQHandler(void) { Here is an example of a "kernel-unaware" ISR (See also the FreeRTOS documentation for [configMAX_SYSCALL_INTERRUPT_PRIORITY](https://www.freertos.org/a00110.html#kernel_priority) ): +
@code{.c} /* * ISR for receiving bytes from the QSPY Back-End @@ -134,6 +136,7 @@ void UART0_IRQHandler(void) { @subsection freertos_hook Writing FreeRTOS Hooks Running in ISR Context FreeRTOS provides "hooks" that are user functions that execute in the ISR context (e.g., `vApplicationTickHook()`). Such ISR-level functions are closely related to ISRs and should also use exclusively only the "FromISR" APIs. Here is an example of the `vApplicationTickHook()`: +
@code{.c} /* NOTE: only the "FromISR" API variants are allowed in vApplicationTickHook */ void vApplicationTickHook(void) { @@ -151,6 +154,7 @@ void vApplicationTickHook(void) { @subsection freertos_ao Starting Active Objects in QP/FreeRTOS As mentioned in the @ref freertos_about "FreeRTOS port summary", the QP port to FreeRTOS uses the [static memory allocation of FreeRTOS](https://freertos.org/Static_Vs_Dynamic_Memory_Allocation.html). This means that all memory for an active object, including the private queue buffer and the private **stack** for the the associated FreeRTOS task must be allocated by the user. Here is an example code that starts an active object: +
@code{.c} int main() { . . . @@ -227,6 +231,7 @@ However, this port can also be used as a library, in which case you need to buil @subsection uc-os2_build QP Source Files Needed in this QP Port Whether you use this QP port as source files or as a library, it is important to note that not all QP source files should be included. Here is the list of QP source files needed: +
@code{.c} qpc/ +-src/ @@ -307,34 +312,35 @@ The Zephyr message queue currently supports only the FIFO policy and does NOT su @subsection zephyr_build QP Source Files Needed in this QP Port It is important to note that **NOT** all QP source files should be included. Here is the list of QP source files needed: -@verbatim +
+@code{.c} qpc/ -+-src/ -| | +-qf/ -| | | +-qep_hsm.c -| | | +-qep_msm.c -| | | +-qf_act.c -| | | +-qf_actq.c - NOT included (implemented in Zephyr) -| | | +-qf_defer.c -| | | +-qf_dyn.c -| | | +-qf_mem.c -| | | +-qf_ps.c -| | | +-qf_qeq.c -| | | +-qf_qmact.c -| | | +-qf_time.c -| | -| | +-qs/ -| | | +-qs.c - included only in the Spy build configuration -| | | +-qs_fp.c - included only in the Spy build configuration ++--src/ +| +--qf/ +| | qep_hsm.c +| | qep_msm.c +| | qf_act.c +| | qf_actq.c // NOT included (implemented in Zephyr) +| | qf_defer.c +| | qf_dyn.c +| | qf_mem.c +| | qf_ps.c +| | qf_qeq.c +| | qf_qmact.c +| | qf_time.c +| | +| +--qs/ +| | qs.c // included only in the Spy build configuration +| | qs_fp.c // included only in the Spy build configuration | -+-ports -| +-zephyr -| | +-qep_port.h -| | +-qf_port.h -| | +-qf_port.c - implementation of the Zephyr port -| | +-qs_port.h ++--ports/ +| +--zephyr +| | qep_port.h +| | qf_port.h +| | qf_port.c // implementation of the Zephyr port +| | qs_port.h | -@endverbatim +@endcode @note Specifically, the QP source files qf_actq.c must **NOT** be included in the build, because this functionality is taken from Zephyr. diff --git a/doxygen/snippets/qxk_oncontextsw.c b/doxygen/snippets/qf_oncontextsw.c similarity index 57% rename from doxygen/snippets/qxk_oncontextsw.c rename to doxygen/snippets/qf_oncontextsw.c index 993a9c43..9a0eab9a 100644 --- a/doxygen/snippets/qxk_oncontextsw.c +++ b/doxygen/snippets/qf_oncontextsw.c @@ -1,17 +1,17 @@ -#ifdef QXK_ON_CONTEXT_SW +#ifdef QF_ON_CONTEXT_SW /* NOTE: the context-switch callback is called with interrupts DISABLED */ -void QXK_onContextSw(QActive *prev, QActive *next) { +void QF_onContextSw(QActive *prev, QActive *next) { (void)prev; - if (next != (QActive *)0) { /* next is not the QXK idle thread? */ + if (next != (QActive *)0) { /* next is not the idle thread? */ _impure_ptr = next->thread; /* switch to next TLS */ } /* If you use QS software tracing, use the _NOCRIT() begin/end */ - QS_BEGIN_NOCRIT(ON_CONTEXT_SW, 0U) + QS_BEGIN_NOCRIT(CONTEXT_SW, 0U) QS_OBJ(prev); QS_OBJ(next); QS_END_NOCRIT() } -#endif /* QXK_ON_CONTEXT_SW */ +#endif /* QF_ON_CONTEXT_SW */ diff --git a/doxygen/snippets/qk_oncontextsw.c b/doxygen/snippets/qk_oncontextsw.c deleted file mode 100644 index b36cfc5a..00000000 --- a/doxygen/snippets/qk_oncontextsw.c +++ /dev/null @@ -1,17 +0,0 @@ -#ifdef QK_ON_CONTEXT_SW - -/* NOTE: the context-switch callback is called with interrupts DISABLED */ -void QK_onContextSw(QActive *prev, QActive *next) { - - if (next != (QActive *)0) { /* next is not the QK idle loop? */ - _impure_ptr = next->thread; /* switch to next TLS */ - } - - /* If you use QS software tracing, use the _NOCRIT() begin/end */ - QS_BEGIN_NOCRIT(CONTEXT_SW, QS_AP_ID + 1) - QS_OBJ(prev); - QS_OBJ(next); - QS_END_NOCRIT() -} - -#endif /* QK_ON_CONTEXT_SW */ diff --git a/examples/arm-cm/blinky_efm32-slstk3401a/qk/bsp.c b/examples/arm-cm/blinky_efm32-slstk3401a/qk/bsp.c index 1ee3743b..e7b5178d 100644 --- a/examples/arm-cm/blinky_efm32-slstk3401a/qk/bsp.c +++ b/examples/arm-cm/blinky_efm32-slstk3401a/qk/bsp.c @@ -74,31 +74,7 @@ void BSP_init(void) { */ SystemCoreClockUpdate(); - /* configure the FPU usage by choosing one of the options... */ -#if 1 - /* OPTION 1: - * Use the automatic FPU state preservation and the FPU lazy stacking. - * - * NOTE: - * Use the following setting when FPU is used in more than one task or - * in any ISRs. This setting is the safest and recommended, but requires - * extra stack space and CPU cycles. - */ - FPU->FPCCR |= (1U << FPU_FPCCR_ASPEN_Pos) | (1U << FPU_FPCCR_LSPEN_Pos); -#else - /* OPTION 2: - * Do NOT to use the automatic FPU state preservation and - * do NOT to use the FPU lazy stacking. - * - * NOTE: - * Use the following setting when FPU is used in ONE task only and not - * in any ISR. This setting is very efficient, but if more than one task - * (or ISR) start using the FPU, this can lead to corruption of the - * FPU registers. This option should be used with CAUTION. - */ - FPU->FPCCR &= ~((1U << FPU_FPCCR_ASPEN_Pos) - | (1U << FPU_FPCCR_LSPEN_Pos)); -#endif + /* NOTE The VFP (hardware Floating Point) unit is configured by QK-port */ /* enable clock for to the peripherals used by this application... */ CMU_ClockEnable(cmuClock_HFPER, true); diff --git a/examples/arm-cm/blinky_efm32-slstk3401a/qv/bsp.c b/examples/arm-cm/blinky_efm32-slstk3401a/qv/bsp.c index 274acbbb..3b056326 100644 --- a/examples/arm-cm/blinky_efm32-slstk3401a/qv/bsp.c +++ b/examples/arm-cm/blinky_efm32-slstk3401a/qv/bsp.c @@ -73,17 +73,7 @@ void BSP_init(void) { */ SystemCoreClockUpdate(); - /* configure the FPU usage by choosing one of the options... - * - * Do NOT to use the automatic FPU state preservation and - * do NOT to use the FPU lazy stacking. - * - * NOTE: - * Use the following setting when FPU is used only by active objects - * and NOT in any ISR. This setting is very efficient, but if any ISRs - * start using the FPU, this can lead to corruption of the FPU registers. - */ - FPU->FPCCR &= ~((1U << FPU_FPCCR_ASPEN_Pos) | (1U << FPU_FPCCR_LSPEN_Pos)); + /* NOTE The VFP (hardware Floating Point) unit is configured by QV-port */ /* enable clock for to the peripherals used by this application... */ CMU_ClockEnable(cmuClock_HFPER, true); diff --git a/examples/arm-cm/blinky_ek-tm4c123gxl/qk/bsp.c b/examples/arm-cm/blinky_ek-tm4c123gxl/qk/bsp.c index e0bec97c..8b7b54d4 100644 --- a/examples/arm-cm/blinky_ek-tm4c123gxl/qk/bsp.c +++ b/examples/arm-cm/blinky_ek-tm4c123gxl/qk/bsp.c @@ -1,7 +1,7 @@ /***************************************************************************** * Product: "Blinky" example, EK-TM4C123GXL board, preemptive QK kernel -* Last updated for version 6.9.1 -* Last updated on 2020-09-22 +* Last updated for version 7.2.0 +* Last updated on 2022-12-17 * * Q u a n t u m L e a P s * ------------------------ @@ -68,67 +68,168 @@ void SysTick_Handler(void) { /* BSP functions ===========================================================*/ +/* MPU setup for TM4C123GXL MCU */ +static void TM4C123GXL_MPU_setup(void) { + /* The following MPU configuration contains the general TM4C memory map. + * + * Please note that the actual TM4C MCUs provide much less Flash and SRAM + * than the maximums configured here. This means that actual MCUs have + * unmapped memory regions (e.g., beyond the actual SRAM). Attempts to + * access these regions causes the HardFault exception, which is the + * desired behavior. + */ + static struct { + uint32_t rbar; + uint32_t rasr; + } const mpu_setup[] = { + { /* region #0: Flash: base=0x0000'0000, size=512M=2^(28+1) */ + 0x00000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 0U), /* region #0 */ + (28U << MPU_RASR_SIZE_Pos) /* 2^(18+1) region */ + | (0x6U << MPU_RASR_AP_Pos) /* PA:ro/UA:ro */ + | (1U << MPU_RASR_C_Pos) /* C=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #1: SRAM: base=0x2000'0000, size=512M=2^(28+1) */ + 0x20000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 1U), /* region #1 */ + (28U << MPU_RASR_SIZE_Pos) /* 2^(28+1) region */ + | (0x3U << MPU_RASR_AP_Pos) /* PA:rw/UA:rw */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | (1U << MPU_RASR_S_Pos) /* S=1 */ + | (1U << MPU_RASR_C_Pos) /* C=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + /* region #3: (not configured) */ + { MPU_RBAR_VALID_Msk | (MPU_RBAR_REGION_Msk & 2U), 0U }, + + { /* region #3: Peripherals: base=0x4000'0000, size=512M=2^(28+1) */ + 0x40000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 3U), /* region #3 */ + (28U << MPU_RASR_SIZE_Pos) /* 2^(28+1) region */ + | (0x3U << MPU_RASR_AP_Pos) /* PA:rw/UA:rw */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | (1U << MPU_RASR_S_Pos) /* S=1 */ + | (1U << MPU_RASR_B_Pos) /* B=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #4: Priv. Periph: base=0xE000'0000, size=512M=2^(28+1) */ + 0xE0000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 4U), /* region #4 */ + (28U << MPU_RASR_SIZE_Pos) /* 2^(28+1) region */ + | (0x3U << MPU_RASR_AP_Pos) /* PA:rw/UA:rw */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | (1U << MPU_RASR_S_Pos) /* S=1 */ + | (1U << MPU_RASR_B_Pos) /* B=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #5: Ext RAM: base=0x6000'0000, size=1G=2^(29+1) */ + 0x60000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 5U), /* region #5 */ + (29U << MPU_RASR_SIZE_Pos) /* 2^(28+1) region */ + | (0x3U << MPU_RASR_AP_Pos) /* PA:rw/UA:rw */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | (1U << MPU_RASR_S_Pos) /* S=1 */ + | (1U << MPU_RASR_B_Pos) /* B=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #6: Ext Dev: base=0xA000'0000, size=1G=2^(29+1) */ + 0xA0000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 6U), /* region #6 */ + (29U << MPU_RASR_SIZE_Pos) /* 2^(28+1) region */ + | (0x3U << MPU_RASR_AP_Pos) /* PA:rw/UA:rw */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | (1U << MPU_RASR_S_Pos) /* S=1 */ + | (1U << MPU_RASR_B_Pos) /* B=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #7: NULL-pointer: base=0x000'0000, size=256B */ + 0x00000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 7U), /* region #7 */ + (7U << MPU_RASR_SIZE_Pos) /* 2^(7+1)=256B region */ + | (0x0U << MPU_RASR_AP_Pos) /* PA:na/UA:na */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + }; + + /* enable the MemManage_Handler for MPU exception */ + SCB->SHCSR |= SCB_SHCSR_MEMFAULTENA_Msk; + + __DSB(); + MPU->CTRL = 0U; /* disable the MPU */ + for (uint_fast8_t n = 0U; n < Q_DIM(mpu_setup); ++n) { + MPU->RBAR = mpu_setup[n].rbar; + MPU->RASR = mpu_setup[n].rasr; + } + MPU->CTRL = MPU_CTRL_ENABLE_Msk; /* enable the MPU */ + __ISB(); + __DSB(); +} + +/*..........................................................................*/ void BSP_init(void) { + /* setup the MPU... */ + TM4C123GXL_MPU_setup(); + /* NOTE: SystemInit() already called from the startup code * but SystemCoreClock needs to be updated */ SystemCoreClockUpdate(); - /* configure the FPU usage by choosing one of the options... */ -#if 1 - /* OPTION 1: - * Use the automatic FPU state preservation and the FPU lazy stacking. - * - * NOTE: - * Use the following setting when FPU is used in more than one task or - * in any ISRs. This setting is the safest and recommended, but requires - * extra stack space and CPU cycles. - */ - FPU->FPCCR |= (1U << FPU_FPCCR_ASPEN_Pos) | (1U << FPU_FPCCR_LSPEN_Pos); -#else - /* OPTION 2: - * Do NOT to use the automatic FPU state preservation and - * do NOT to use the FPU lazy stacking. - * - * NOTE: - * Use the following setting when FPU is used in ONE task only and not - * in any ISR. This setting is very efficient, but if more than one task - * (or ISR) start using the FPU, this can lead to corruption of the - * FPU registers. This option should be used with CAUTION. - */ - FPU->FPCCR &= ~((1U << FPU_FPCCR_ASPEN_Pos) - | (1U << FPU_FPCCR_LSPEN_Pos)); -#endif + /* NOTE: The VFP (hardware Floating Point) unit is configured by QK */ /* enable clock for to the peripherals used by this application... */ - SYSCTL->RCGCGPIO |= (1U << 5); /* enable Run mode for GPIOF */ + SYSCTL->RCGCGPIO |= (1U << 5); /* enable Run mode for GPIOF */ + SYSCTL->GPIOHBCTL |= (1U << 5); /* enable AHB for GPIOF */ + __ISB(); + __DSB(); - /* configure the LEDs and push buttons */ - GPIOF->DIR |= (LED_RED | LED_GREEN | LED_BLUE);/* set direction: output */ - GPIOF->DEN |= (LED_RED | LED_GREEN | LED_BLUE); /* digital enable */ - GPIOF->DATA_Bits[LED_RED] = 0U; /* turn the LED off */ - GPIOF->DATA_Bits[LED_GREEN] = 0U; /* turn the LED off */ - GPIOF->DATA_Bits[LED_BLUE] = 0U; /* turn the LED off */ + /* configure LEDs (digital output) */ + GPIOF_AHB->DIR |= (LED_RED | LED_BLUE | LED_GREEN); + GPIOF_AHB->DEN |= (LED_RED | LED_BLUE | LED_GREEN); + GPIOF_AHB->DATA_Bits[LED_RED | LED_BLUE | LED_GREEN] = 0U; - /* configure the Buttons */ - GPIOF->DIR &= ~(BTN_SW1 | BTN_SW2); /* set direction: input */ - ROM_GPIOPadConfigSet(GPIOF_BASE, (BTN_SW1 | BTN_SW2), - GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU); -} -/*..........................................................................*/ -void BSP_ledOff(void) { - GPIOF->DATA_Bits[LED_GREEN] = 0U; + /* configure switches... */ + + /* unlock access to the SW2 pin because it is PROTECTED */ + GPIOF_AHB->LOCK = 0x4C4F434BU; /* unlock GPIOCR register for SW2 */ + /* commit the write (cast const away) */ + *(uint32_t volatile *)&GPIOF_AHB->CR = 0x01U; + + GPIOF_AHB->DIR &= ~(BTN_SW1 | BTN_SW2); /* input */ + GPIOF_AHB->DEN |= (BTN_SW1 | BTN_SW2); /* digital enable */ + GPIOF_AHB->PUR |= (BTN_SW1 | BTN_SW2); /* pull-up resistor enable */ + + *(uint32_t volatile *)&GPIOF_AHB->CR = 0x00U; + GPIOF_AHB->LOCK = 0x0; /* lock GPIOCR register for SW2 */ } /*..........................................................................*/ void BSP_ledOn(void) { - /* exercise the FPU with some floating point computations */ + GPIOF_AHB->DATA_Bits[LED_RED] = 0xFFU; +} +/*..........................................................................*/ +void BSP_ledOff(void) { + /* exercise the FPU with some floating point computations */ float volatile x = 3.1415926F; x = x + 2.7182818F; - GPIOF->DATA_Bits[LED_GREEN] = 0xFFU; + GPIOF_AHB->DATA_Bits[LED_RED] = 0x00U; } - /* QF callbacks ============================================================*/ void QF_onStartup(void) { /* set up the SysTick timer to fire at BSP_TICKS_PER_SEC rate */ @@ -152,17 +253,23 @@ void QF_onStartup(void) { void QF_onCleanup(void) { } /*..........................................................................*/ +#ifdef QF_ON_CONTEXT_SW +/* NOTE: the context-switch callback is called with interrupts DISABLED */ +void QF_onContextSw(QActive *prev, QActive *next) { +} +#endif /* QF_ON_CONTEXT_SW */ +/*..........................................................................*/ void QK_onIdle(void) { - /* toggle LED2 on and then off, see NOTE01 */ + /* toggle the User LED on and then off, see NOTE2 */ QF_INT_DISABLE(); - GPIOF->DATA_Bits[LED_BLUE] = 0xFFU; - GPIOF->DATA_Bits[LED_BLUE] = 0x00U; + GPIOF_AHB->DATA_Bits[LED_BLUE] = 0xFFU; /* turn the Blue LED on */ + GPIOF_AHB->DATA_Bits[LED_BLUE] = 0U; /* turn the Blue LED off */ QF_INT_ENABLE(); #ifdef 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. + * see the datasheet for your particular Cortex-M MCU. */ __WFI(); /* Wait-For-Interrupt */ #endif @@ -179,7 +286,7 @@ Q_NORETURN Q_onAssert(char const * const module, int_t const loc) { NVIC_SystemReset(); } -/***************************************************************************** +/*============================================================================ * NOTE1: * The QF_AWARE_ISR_CMSIS_PRI constant from the QF port specifies the highest * ISR priority that is disabled by the QF framework. The value is suitable @@ -187,18 +294,19 @@ Q_NORETURN Q_onAssert(char const * const module, int_t const loc) { * * Only ISRs prioritized at or below the QF_AWARE_ISR_CMSIS_PRI level (i.e., * with the numerical values of priorities equal or higher than -* QF_AWARE_ISR_CMSIS_PRI) are allowed to call any QF services. These ISRs -* are "QF-aware". +* QF_AWARE_ISR_CMSIS_PRI) are allowed to call the QXK_ISR_ENTRY/QXK_ISR_EXIT +* macros or any other QF/QXK services. These ISRs are "QF-aware". * * Conversely, any ISRs prioritized above the QF_AWARE_ISR_CMSIS_PRI priority * level (i.e., with the numerical values of priorities less than * QF_AWARE_ISR_CMSIS_PRI) are never disabled and are not aware of the kernel. -* Such "QF-unaware" ISRs cannot call any QF services. The only mechanism +* Such "QF-unaware" ISRs cannot call any QF/QXK services. In particular they +* can NOT call the macros QXK_ISR_ENTRY/QXK_ISR_ENTRY. The only mechanism * by which a "QF-unaware" ISR can communicate with the QF framework is by * triggering a "QF-aware" ISR, which can post/publish events. * * NOTE2: -* One of the LEDs is used to visualize the idle loop activity. The brightness +* The User LED is used to visualize the idle loop activity. The brightness * of the LED is proportional to the frequency of invcations of the idle loop. * Please note that the LED is toggled with interrupts locked, so no interrupt * execution time contributes to the brightness of the User LED. diff --git a/examples/arm-cm/blinky_ek-tm4c123gxl/qv/bsp.c b/examples/arm-cm/blinky_ek-tm4c123gxl/qv/bsp.c index 49b8cb79..be819aa3 100644 --- a/examples/arm-cm/blinky_ek-tm4c123gxl/qv/bsp.c +++ b/examples/arm-cm/blinky_ek-tm4c123gxl/qv/bsp.c @@ -1,7 +1,7 @@ /***************************************************************************** * Product: "Blinky" on EK-TM4C123GXL board, cooperative Vanilla kernel -* Last updated for version 6.9.1 -* Last updated on 2020-09-23 +* Last updated for version 7.2.0 +* Last updated on 2022-12-17 * * Q u a n t u m L e a P s * ------------------------ @@ -66,53 +66,168 @@ void SysTick_Handler(void) { } /* BSP functions ===========================================================*/ +/* MPU setup for TM4C123GXL MCU */ +static void TM4C123GXL_MPU_setup(void) { + /* The following MPU configuration contains the general TM4C memory map. + * + * Please note that the actual TM4C MCUs provide much less Flash and SRAM + * than the maximums configured here. This means that actual MCUs have + * unmapped memory regions (e.g., beyond the actual SRAM). Attempts to + * access these regions causes the HardFault exception, which is the + * desired behavior. + */ + static struct { + uint32_t rbar; + uint32_t rasr; + } const mpu_setup[] = { + { /* region #0: Flash: base=0x0000'0000, size=512M=2^(28+1) */ + 0x00000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 0U), /* region #0 */ + (28U << MPU_RASR_SIZE_Pos) /* 2^(18+1) region */ + | (0x6U << MPU_RASR_AP_Pos) /* PA:ro/UA:ro */ + | (1U << MPU_RASR_C_Pos) /* C=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #1: SRAM: base=0x2000'0000, size=512M=2^(28+1) */ + 0x20000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 1U), /* region #1 */ + (28U << MPU_RASR_SIZE_Pos) /* 2^(28+1) region */ + | (0x3U << MPU_RASR_AP_Pos) /* PA:rw/UA:rw */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | (1U << MPU_RASR_S_Pos) /* S=1 */ + | (1U << MPU_RASR_C_Pos) /* C=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + /* region #3: (not configured) */ + { MPU_RBAR_VALID_Msk | (MPU_RBAR_REGION_Msk & 2U), 0U }, + + { /* region #3: Peripherals: base=0x4000'0000, size=512M=2^(28+1) */ + 0x40000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 3U), /* region #3 */ + (28U << MPU_RASR_SIZE_Pos) /* 2^(28+1) region */ + | (0x3U << MPU_RASR_AP_Pos) /* PA:rw/UA:rw */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | (1U << MPU_RASR_S_Pos) /* S=1 */ + | (1U << MPU_RASR_B_Pos) /* B=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #4: Priv. Periph: base=0xE000'0000, size=512M=2^(28+1) */ + 0xE0000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 4U), /* region #4 */ + (28U << MPU_RASR_SIZE_Pos) /* 2^(28+1) region */ + | (0x3U << MPU_RASR_AP_Pos) /* PA:rw/UA:rw */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | (1U << MPU_RASR_S_Pos) /* S=1 */ + | (1U << MPU_RASR_B_Pos) /* B=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #5: Ext RAM: base=0x6000'0000, size=1G=2^(29+1) */ + 0x60000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 5U), /* region #5 */ + (29U << MPU_RASR_SIZE_Pos) /* 2^(28+1) region */ + | (0x3U << MPU_RASR_AP_Pos) /* PA:rw/UA:rw */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | (1U << MPU_RASR_S_Pos) /* S=1 */ + | (1U << MPU_RASR_B_Pos) /* B=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #6: Ext Dev: base=0xA000'0000, size=1G=2^(29+1) */ + 0xA0000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 6U), /* region #6 */ + (29U << MPU_RASR_SIZE_Pos) /* 2^(28+1) region */ + | (0x3U << MPU_RASR_AP_Pos) /* PA:rw/UA:rw */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | (1U << MPU_RASR_S_Pos) /* S=1 */ + | (1U << MPU_RASR_B_Pos) /* B=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #7: NULL-pointer: base=0x000'0000, size=256B */ + 0x00000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 7U), /* region #7 */ + (7U << MPU_RASR_SIZE_Pos) /* 2^(7+1)=256B region */ + | (0x0U << MPU_RASR_AP_Pos) /* PA:na/UA:na */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + }; + + /* enable the MemManage_Handler for MPU exception */ + SCB->SHCSR |= SCB_SHCSR_MEMFAULTENA_Msk; + + __DSB(); + MPU->CTRL = 0U; /* disable the MPU */ + for (uint_fast8_t n = 0U; n < Q_DIM(mpu_setup); ++n) { + MPU->RBAR = mpu_setup[n].rbar; + MPU->RASR = mpu_setup[n].rasr; + } + MPU->CTRL = MPU_CTRL_ENABLE_Msk; /* enable the MPU */ + __ISB(); + __DSB(); +} + +/*..........................................................................*/ void BSP_init(void) { + /* setup the MPU... */ + TM4C123GXL_MPU_setup(); + /* NOTE: SystemInit() already called from the startup code * but SystemCoreClock needs to be updated */ SystemCoreClockUpdate(); - /* configure the FPU usage by choosing one of the options... - * - * Do NOT to use the automatic FPU state preservation and - * do NOT to use the FPU lazy stacking. - * - * NOTE: - * Use the following setting when FPU is used only by active objects - * and NOT in any ISR. This setting is very efficient, but if any ISRs - * start using the FPU, this can lead to corruption of the FPU registers. - */ - FPU->FPCCR &= ~((1U << FPU_FPCCR_ASPEN_Pos) | (1U << FPU_FPCCR_LSPEN_Pos)); + /* NOTE: The VFP (hardware Floating Point) unit is configured by QV */ /* enable clock for to the peripherals used by this application... */ - SYSCTL->RCGCGPIO |= (1U << 5); /* enable Run mode for GPIOF */ + SYSCTL->RCGCGPIO |= (1U << 5); /* enable Run mode for GPIOF */ + SYSCTL->GPIOHBCTL |= (1U << 5); /* enable AHB for GPIOF */ + __ISB(); + __DSB(); - /* configure the LEDs and push buttons */ - GPIOF->DIR |= (LED_RED | LED_GREEN | LED_BLUE);/* set direction: output */ - GPIOF->DEN |= (LED_RED | LED_GREEN | LED_BLUE); /* digital enable */ - GPIOF->DATA_Bits[LED_RED] = 0U; /* turn the LED off */ - GPIOF->DATA_Bits[LED_GREEN] = 0U; /* turn the LED off */ - GPIOF->DATA_Bits[LED_BLUE] = 0U; /* turn the LED off */ + /* configure LEDs (digital output) */ + GPIOF_AHB->DIR |= (LED_RED | LED_BLUE | LED_GREEN); + GPIOF_AHB->DEN |= (LED_RED | LED_BLUE | LED_GREEN); + GPIOF_AHB->DATA_Bits[LED_RED | LED_BLUE | LED_GREEN] = 0U; - /* configure the Buttons */ - GPIOF->DIR &= ~(BTN_SW1 | BTN_SW2); /* set direction: input */ - ROM_GPIOPadConfigSet(GPIOF_BASE, (BTN_SW1 | BTN_SW2), - GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU); -} -/*..........................................................................*/ -void BSP_ledOff(void) { - GPIOF->DATA_Bits[LED_GREEN] = 0U; + /* configure switches... */ + + /* unlock access to the SW2 pin because it is PROTECTED */ + GPIOF_AHB->LOCK = 0x4C4F434BU; /* unlock GPIOCR register for SW2 */ + /* commit the write (cast const away) */ + *(uint32_t volatile *)&GPIOF_AHB->CR = 0x01U; + + GPIOF_AHB->DIR &= ~(BTN_SW1 | BTN_SW2); /* input */ + GPIOF_AHB->DEN |= (BTN_SW1 | BTN_SW2); /* digital enable */ + GPIOF_AHB->PUR |= (BTN_SW1 | BTN_SW2); /* pull-up resistor enable */ + + *(uint32_t volatile *)&GPIOF_AHB->CR = 0x00U; + GPIOF_AHB->LOCK = 0x0; /* lock GPIOCR register for SW2 */ } /*..........................................................................*/ void BSP_ledOn(void) { - /* exercise the FPU with some floating point computations */ + GPIOF_AHB->DATA_Bits[LED_RED] = 0xFFU; +} +/*..........................................................................*/ +void BSP_ledOff(void) { + /* exercise the FPU with some floating point computations */ float volatile x = 3.1415926F; x = x + 2.7182818F; - GPIOF->DATA_Bits[LED_GREEN] = 0xFFU; + GPIOF_AHB->DATA_Bits[LED_RED] = 0x00U; } - /* QF callbacks ============================================================*/ void QF_onStartup(void) { /* set up the SysTick timer to fire at BSP_TICKS_PER_SEC rate */ @@ -136,10 +251,16 @@ void QF_onStartup(void) { void QF_onCleanup(void) { } /*..........................................................................*/ +#ifdef QF_ON_CONTEXT_SW +/* NOTE: the context-switch callback is called with interrupts DISABLED */ +void QF_onContextSw(QActive *prev, QActive *next) { +} +#endif /* QF_ON_CONTEXT_SW */ +/*..........................................................................*/ void QV_onIdle(void) { /* CATION: called with interrupts DISABLED, NOTE2 */ - /* toggle LED2 on and then off, see NOTE3 */ - GPIOF->DATA_Bits[LED_BLUE] = 0xFFU; - GPIOF->DATA_Bits[LED_BLUE] = 0x00U; + /* toggle the User LED on and then off, see NOTE2 */ + GPIOF_AHB->DATA_Bits[LED_BLUE] = 0xFFU; /* turn the Blue LED on */ + GPIOF_AHB->DATA_Bits[LED_BLUE] = 0U; /* turn the Blue LED off */ #ifdef NDEBUG /* Put the CPU and peripherals to the low-power mode. @@ -163,7 +284,7 @@ Q_NORETURN Q_onAssert(char const * const module, int_t const loc) { NVIC_SystemReset(); } -/***************************************************************************** +/*============================================================================ * NOTE1: * The QF_AWARE_ISR_CMSIS_PRI constant from the QF port specifies the highest * ISR priority that is disabled by the QF framework. The value is suitable @@ -171,13 +292,14 @@ Q_NORETURN Q_onAssert(char const * const module, int_t const loc) { * * Only ISRs prioritized at or below the QF_AWARE_ISR_CMSIS_PRI level (i.e., * with the numerical values of priorities equal or higher than -* QF_AWARE_ISR_CMSIS_PRI) are allowed to call any QF services. These ISRs -* are "QF-aware". +* QF_AWARE_ISR_CMSIS_PRI) are allowed to call the QXK_ISR_ENTRY/QXK_ISR_EXIT +* macros or any other QF/QXK services. These ISRs are "QF-aware". * * Conversely, any ISRs prioritized above the QF_AWARE_ISR_CMSIS_PRI priority * level (i.e., with the numerical values of priorities less than * QF_AWARE_ISR_CMSIS_PRI) are never disabled and are not aware of the kernel. -* Such "QF-unaware" ISRs cannot call any QF services. The only mechanism +* Such "QF-unaware" ISRs cannot call any QF/QXK services. In particular they +* can NOT call the macros QXK_ISR_ENTRY/QXK_ISR_ENTRY. The only mechanism * by which a "QF-unaware" ISR can communicate with the QF framework is by * triggering a "QF-aware" ISR, which can post/publish events. * diff --git a/examples/arm-cm/dpp_efm32-slstk3401a/dpp.h b/examples/arm-cm/dpp_efm32-slstk3401a/dpp.h index 9c462046..59d06383 100644 --- a/examples/arm-cm/dpp_efm32-slstk3401a/dpp.h +++ b/examples/arm-cm/dpp_efm32-slstk3401a/dpp.h @@ -3,7 +3,7 @@ * Model: dpp.qm * File: ${.::dpp.h} * -* This code has been generated by QM 5.2.2 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later diff --git a/examples/arm-cm/dpp_efm32-slstk3401a/dpp.qm b/examples/arm-cm/dpp_efm32-slstk3401a/dpp.qm index 87124687..80c3da88 100644 --- a/examples/arm-cm/dpp_efm32-slstk3401a/dpp.qm +++ b/examples/arm-cm/dpp_efm32-slstk3401a/dpp.qm @@ -1,5 +1,5 @@ - + Dining Philosopher Problem example diff --git a/examples/arm-cm/dpp_efm32-slstk3401a/philo.c b/examples/arm-cm/dpp_efm32-slstk3401a/philo.c index 63b37279..c6e46806 100644 --- a/examples/arm-cm/dpp_efm32-slstk3401a/philo.c +++ b/examples/arm-cm/dpp_efm32-slstk3401a/philo.c @@ -3,7 +3,7 @@ * Model: dpp.qm * File: ${.::philo.c} * -* This code has been generated by QM 5.2.2 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later @@ -68,8 +68,8 @@ static QState Philo_eating(Philo * const me, QEvt const * const e); /* Global objects ----------------------------------------------------------*/ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/examples/arm-cm/dpp_efm32-slstk3401a/qk/armclang/dpp-qk.uvoptx b/examples/arm-cm/dpp_efm32-slstk3401a/qk/armclang/dpp-qk.uvoptx index 87b03802..fcf58664 100644 --- a/examples/arm-cm/dpp_efm32-slstk3401a/qk/armclang/dpp-qk.uvoptx +++ b/examples/arm-cm/dpp_efm32-slstk3401a/qk/armclang/dpp-qk.uvoptx @@ -140,7 +140,7 @@ 0 DLGTARM - (1010=1913,720,2363,1277,1)(1007=1124,641,1311,916,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) + (1010=1913,720,2363,1277,0)(1007=1124,641,1311,916,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=2701,333,3178,648,0) 0 @@ -153,12 +153,77 @@ -U0E2006F4 -O4622 -S4 -FO61 - + + + 0 + 0 + 377 + 1 +
6704
+ 0 + 0 + 0 + 0 + 0 + 1 + ..\bsp.c + + \\dpp_qk\../bsp.c\377 +
+ + 1 + 0 + 413 + 1 +
446
+ 0 + 0 + 0 + 0 + 0 + 1 + ..\..\..\..\..\3rd_party\efm32pg1b\arm\startup_efm32pg1b.s + + \\dpp_qk\../../../../../3rd_party/efm32pg1b/arm/startup_efm32pg1b.s\413 +
+ + 2 + 0 + 216 + 1 +
376
+ 0 + 0 + 0 + 0 + 0 + 1 + ..\..\..\..\..\3rd_party\efm32pg1b\arm\startup_efm32pg1b.s + + \\dpp_qk\../../../../../3rd_party/efm32pg1b/arm/startup_efm32pg1b.s\216 +
+ + 3 + 0 + 228 + 1 +
382
+ 0 + 0 + 0 + 0 + 0 + 1 + ..\..\..\..\..\3rd_party\efm32pg1b\arm\startup_efm32pg1b.s + + \\dpp_qk\../../../../../3rd_party/efm32pg1b/arm/startup_efm32pg1b.s\228 +
+
1 2 - 0x20000200 + 0x20000B70 0 diff --git a/examples/arm-cm/dpp_efm32-slstk3401a/qk/armclang/dpp-qk.uvprojx b/examples/arm-cm/dpp_efm32-slstk3401a/qk/armclang/dpp-qk.uvprojx index 7e55e50c..28af283f 100644 --- a/examples/arm-cm/dpp_efm32-slstk3401a/qk/armclang/dpp-qk.uvprojx +++ b/examples/arm-cm/dpp_efm32-slstk3401a/qk/armclang/dpp-qk.uvprojx @@ -183,7 +183,7 @@ 1 0 0 - 2 + 1 0 0 0 diff --git a/examples/arm-cm/dpp_efm32-slstk3401a/qk/bsp.c b/examples/arm-cm/dpp_efm32-slstk3401a/qk/bsp.c index d47f1f81..764b408c 100644 --- a/examples/arm-cm/dpp_efm32-slstk3401a/qk/bsp.c +++ b/examples/arm-cm/dpp_efm32-slstk3401a/qk/bsp.c @@ -1,7 +1,7 @@ /***************************************************************************** * Product: DPP example, EFM32-SLSTK3401A board, preemptive QK kernel -* Last updated for version 6.9.3 -* Last updated on 2021-03-03 +* Last updated for version 7.2.0 +* Last updated on 2022-12-17 * * Q u a n t u m L e a P s * ------------------------ @@ -79,32 +79,22 @@ static uint32_t l_rnd; /* random seed */ /*..........................................................................*/ void SysTick_Handler(void) { - /* state of the button debouncing, see below */ - static struct ButtonsDebouncing { - uint32_t depressed; - uint32_t previous; - } buttons = { 0U, 0U }; - uint32_t current; - uint32_t tmp; - QK_ISR_ENTRY(); /* inform QK about entering an ISR */ -#ifdef Q_SPY - { - tmp = SysTick->CTRL; /* clear SysTick_CTRL_COUNTFLAG */ - QS_tickTime_ += QS_tickPeriod_; /* account for the clock rollover */ - } -#endif - - QTIMEEVT_TICK_X(0U, &l_SysTick_Handler); /* process time events for rate 0 */ + QTIMEEVT_TICK_X(0U, &l_SysTick_Handler); /* process time-evts for rate 0 */ //QACTIVE_POST(the_Ticker0, 0, &l_SysTick_Handler); /* post to Ticker0 */ /* Perform the debouncing of buttons. The algorithm for debouncing * adapted from the book "Embedded Systems Dictionary" by Jack Ganssle * and Michael Barr, page 71. */ - current = ~GPIO->P[PB_PORT].DIN; /* read PB0 and BP1 */ - tmp = buttons.depressed; /* save the debounced depressed buttons */ + /* state of the button debouncing, see below */ + static struct ButtonsDebouncing { + uint32_t depressed; + uint32_t previous; + } buttons = { 0U, 0U }; + uint32_t current = ~GPIO->P[PB_PORT].DIN; /* read PB0 and BP1 */ + uint32_t tmp = buttons.depressed; /* the debounced depressed buttons */ buttons.depressed |= (buttons.previous & current); /* set depressed */ buttons.depressed &= (buttons.previous | current); /* clear released */ buttons.previous = current; /* update the history */ @@ -120,6 +110,13 @@ void SysTick_Handler(void) { } } +#ifdef Q_SPY + { + tmp = SysTick->CTRL; /* clear SysTick_CTRL_COUNTFLAG */ + QS_tickTime_ += QS_tickPeriod_; /* account for the clock rollover */ + } +#endif + QK_ISR_EXIT(); /* inform QK about exiting an ISR */ } /*..........................................................................*/ @@ -153,36 +150,131 @@ void USART0_RX_IRQHandler(void) {} /* BSP functions ===========================================================*/ +/* MPU setup for EFM32PG1B200F256GM48 MCU */ +static void EFM32PG182_MPU_setup(void) { + /* The following MPU configuration contains the general EFM32PG1 memory + * map described in the EFM32PG1 Data Sheet Figure 3.2. EFM32PG1 Memory Map + * + * Please note that the actual STM32 MCUs provide much less Flash and SRAM + * than the maximums configured here. This means that actual MCUs have + * unmapped memory regions (e.g., beyond the actual SRAM). Attempts to + * access these regions causes the HardFault exception, which is the + * desired behavior. + */ + static struct { + uint32_t rbar; + uint32_t rasr; + } const mpu_setup[] = { + + { /* region #0: Flash: base=0x0000'0000, size=512M=2^(28+1) */ + 0x00000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 0U), /* region #0 */ + (28U << MPU_RASR_SIZE_Pos) /* 2^(18+1) region */ + | (0x6U << MPU_RASR_AP_Pos) /* PA:ro/UA:ro */ + | (1U << MPU_RASR_C_Pos) /* C=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #1: SRAM: base=0x2000'0000, size=512M=2^(28+1) */ + 0x20000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 1U), /* region #1 */ + (28U << MPU_RASR_SIZE_Pos) /* 2^(28+1) region */ + | (0x3U << MPU_RASR_AP_Pos) /* PA:rw/UA:rw */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | (1U << MPU_RASR_S_Pos) /* S=1 */ + | (1U << MPU_RASR_C_Pos) /* C=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + /* region #3: (not configured) */ + { MPU_RBAR_VALID_Msk | (MPU_RBAR_REGION_Msk & 2U), 0U }, + + { /* region #3: Peripherals: base=0x4000'0000, size=512M=2^(28+1) */ + 0x40000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 3U), /* region #3 */ + (28U << MPU_RASR_SIZE_Pos) /* 2^(28+1) region */ + | (0x3U << MPU_RASR_AP_Pos) /* PA:rw/UA:rw */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | (1U << MPU_RASR_S_Pos) /* S=1 */ + | (1U << MPU_RASR_B_Pos) /* B=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #4: Priv. Periph: base=0xE000'0000, size=512M=2^(28+1) */ + 0xE0000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 4U), /* region #4 */ + (28U << MPU_RASR_SIZE_Pos) /* 2^(28+1) region */ + | (0x3U << MPU_RASR_AP_Pos) /* PA:rw/UA:rw */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | (1U << MPU_RASR_S_Pos) /* S=1 */ + | (1U << MPU_RASR_B_Pos) /* B=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #5: Ext RAM: base=0x6000'0000, size=1G=2^(29+1) */ + 0x60000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 5U), /* region #5 */ + (29U << MPU_RASR_SIZE_Pos) /* 2^(28+1) region */ + | (0x3U << MPU_RASR_AP_Pos) /* PA:rw/UA:rw */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | (1U << MPU_RASR_S_Pos) /* S=1 */ + | (1U << MPU_RASR_B_Pos) /* B=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #6: Ext Dev: base=0xA000'0000, size=1G=2^(29+1) */ + 0xA0000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 6U), /* region #6 */ + (29U << MPU_RASR_SIZE_Pos) /* 2^(28+1) region */ + | (0x3U << MPU_RASR_AP_Pos) /* PA:rw/UA:rw */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | (1U << MPU_RASR_S_Pos) /* S=1 */ + | (1U << MPU_RASR_B_Pos) /* B=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #7: NULL-pointer: base=0x000'0000, size=256B, NOTE0 */ + 0x00000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 7U), /* region #7 */ + (7U << MPU_RASR_SIZE_Pos) /* 2^(7+1)=256B region */ + | (0x0U << MPU_RASR_AP_Pos) /* PA:na/UA:na */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + }; + + /* enable the MemManage_Handler for MPU exception */ + SCB->SHCSR |= SCB_SHCSR_MEMFAULTENA_Msk; + + __DSB(); + MPU->CTRL = 0U; /* disable the MPU */ + for (uint_fast8_t n = 0U; n < Q_DIM(mpu_setup); ++n) { + MPU->RBAR = mpu_setup[n].rbar; + MPU->RASR = mpu_setup[n].rasr; + } + MPU->CTRL = MPU_CTRL_ENABLE_Msk; /* enable the MPU */ + __ISB(); + __DSB(); +} + +/*..........................................................................*/ void BSP_init(void) { + /* setup the MPU... */ + EFM32PG182_MPU_setup(); + /* NOTE: SystemInit() already called from the startup code * but SystemCoreClock needs to be updated */ SystemCoreClockUpdate(); - /* configure the FPU usage by choosing one of the options... */ -#if 1 - /* OPTION 1: - * Use the automatic FPU state preservation and the FPU lazy stacking. - * - * NOTE: - * Use the following setting when FPU is used in more than one task or - * in any ISRs. This setting is the safest and recommended, but requires - * extra stack space and CPU cycles. - */ - FPU->FPCCR |= (1U << FPU_FPCCR_ASPEN_Pos) | (1U << FPU_FPCCR_LSPEN_Pos); -#else - /* OPTION 2: - * Do NOT to use the automatic FPU state preservation and - * do NOT to use the FPU lazy stacking. - * - * NOTE: - * Use the following setting when FPU is used in ONE task only and not - * in any ISR. This setting is very efficient, but if more than one task - * (or ISR) start using the FPU, this can lead to corruption of the - * FPU registers. This option should be used with CAUTION. - */ - FPU->FPCCR &= ~((1U << FPU_FPCCR_ASPEN_Pos) | (1U << FPU_FPCCR_LSPEN_Pos)); -#endif + /* NOTE: The VFP (hardware Floating Point) unit is configured by QK-port */ /* enable clock for to the peripherals used by this application... */ CMU_ClockEnable(cmuClock_HFPER, true); @@ -292,7 +384,7 @@ void QF_onStartup(void) { /* set up the SysTick timer to fire at BSP_TICKS_PER_SEC rate */ SysTick_Config(SystemCoreClock / BSP_TICKS_PER_SEC); - /* assing all priority bits for preemption-prio. and none to sub-prio. */ + /* assign all priority bits for preemption-prio. and none to sub-prio. */ NVIC_SetPriorityGrouping(0U); /* set priorities of ALL ISRs used in the system, see NOTE1 @@ -358,8 +450,8 @@ Q_NORETURN Q_onAssert(char const * const module, int_t const loc) { #ifndef NDEBUG /* light up both LEDs */ GPIO->P[LED_PORT].DOUT |= ((1U << LED0_PIN) | (1U << LED1_PIN)); - /* for debugging, hang on in an endless loop until PB1 is pressed... */ - while ((GPIO->P[PB_PORT].DIN & (1U << PB1_PIN)) != 0) { + /* for debugging, hang on in an endless loop... */ + for (;;) { } #endif @@ -473,7 +565,7 @@ void QS_onCommand(uint8_t cmdId, (void)param1; (void)param2; (void)param3; - QS_BEGIN_ID(COMMAND_STAT, 0U) /* application-specific record begin */ + QS_BEGIN_ID(COMMAND_STAT, 0U) /* app-specific record */ QS_U8(2, cmdId); QS_U32(8, param1); QS_U32(8, param2); @@ -491,7 +583,15 @@ void QS_onCommand(uint8_t cmdId, #endif /* Q_SPY */ /*--------------------------------------------------------------------------*/ -/***************************************************************************** +/*============================================================================ +* NOTE0: +* The MPU protection against NULL-pointer dereferencing sets up a no-access +* MPU region #7 around the NULL address (0x0). This works even though the +* Vector Table also resides at address 0x0. However, the *size* of the +* no-access region should not exceed the size of the Vector Table. In this +* case, the size is set to 2**(7+1)==256 bytes, which does not contain any +* data that the CPU would legitimately read with the LDR instruction. +* * NOTE1: * The QF_AWARE_ISR_CMSIS_PRI constant from the QF port specifies the highest * ISR priority that is disabled by the QF framework. The value is suitable diff --git a/examples/arm-cm/dpp_efm32-slstk3401a/qv/bsp.c b/examples/arm-cm/dpp_efm32-slstk3401a/qv/bsp.c index 7e6cab09..e83d52e0 100644 --- a/examples/arm-cm/dpp_efm32-slstk3401a/qv/bsp.c +++ b/examples/arm-cm/dpp_efm32-slstk3401a/qv/bsp.c @@ -1,7 +1,7 @@ /***************************************************************************** * Product: DPP example, EFM32-SLSTK3401A board, cooperative QV kernel -* Last updated for version 6.9.3 -* Last updated on 2021-03-03 +* Last updated for version 7.2.0 +* Last updated on 2022-12-17 * * Q u a n t u m L e a P s * ------------------------ @@ -79,30 +79,20 @@ static uint32_t l_rnd; /* random seed */ /*..........................................................................*/ void SysTick_Handler(void) { - /* state of the button debouncing, see below */ - static struct ButtonsDebouncing { - uint32_t depressed; - uint32_t previous; - } buttons = { 0U, 0U }; - uint32_t current; - uint32_t tmp; - -#ifdef Q_SPY - { - tmp = SysTick->CTRL; /* clear SysTick_CTRL_COUNTFLAG */ - QS_tickTime_ += QS_tickPeriod_; /* account for the clock rollover */ - } -#endif - - //QTIMEEVT_TICK_X(0U, &l_SysTick_Handler); /* process time events for rate 0 */ - QACTIVE_POST(the_Ticker0, 0, &l_SysTick_Handler); /* post to Ticker0 */ + QTIMEEVT_TICK_X(0U, &l_SysTick_Handler); /* process time-evts for rate 0 */ + //QACTIVE_POST(the_Ticker0, 0, &l_SysTick_Handler); /* post to Ticker0 */ /* Perform the debouncing of buttons. The algorithm for debouncing * adapted from the book "Embedded Systems Dictionary" by Jack Ganssle * and Michael Barr, page 71. */ - current = ~GPIO->P[PB_PORT].DIN; /* read PB0 and BP1 */ - tmp = buttons.depressed; /* save the debounced depressed buttons */ + /* state of the button debouncing, see below */ + static struct ButtonsDebouncing { + uint32_t depressed; + uint32_t previous; + } buttons = { 0U, 0U }; + uint32_t current = ~GPIO->P[PB_PORT].DIN; /* read PB0 and BP1 */ + uint32_t tmp = buttons.depressed; /* the debounced depressed buttons */ buttons.depressed |= (buttons.previous & current); /* set depressed */ buttons.depressed &= (buttons.previous | current); /* clear released */ buttons.previous = current; /* update the history */ @@ -117,6 +107,13 @@ void SysTick_Handler(void) { QACTIVE_PUBLISH(&serveEvt, &l_SysTick_Handler); } } + +#ifdef Q_SPY + { + tmp = SysTick->CTRL; /* clear SysTick_CTRL_COUNTFLAG */ + QS_tickTime_ += QS_tickPeriod_; /* account for the clock rollover */ + } +#endif QV_ARM_ERRATUM_838869(); } /*..........................................................................*/ @@ -144,37 +141,133 @@ void USART0_RX_IRQHandler(void) { void USART0_RX_IRQHandler(void) {} #endif + +/* BSP functions ===========================================================*/ +/* MPU setup for EFM32PG1B200F256GM48 MCU */ +static void EFM32PG182_MPU_setup(void) { + /* The following MPU configuration contains the general EFM32PG1 memory + * map described in the EFM32PG1 Data Sheet Figure 3.2. EFM32PG1 Memory Map + * + * Please note that the actual STM32 MCUs provide much less Flash and SRAM + * than the maximums configured here. This means that actual MCUs have + * unmapped memory regions (e.g., beyond the actual SRAM). Attempts to + * access these regions causes the HardFault exception, which is the + * desired behavior. + */ + static struct { + uint32_t rbar; + uint32_t rasr; + } const mpu_setup[] = { + + { /* region #0: Flash: base=0x0000'0000, size=512M=2^(28+1) */ + 0x00000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 0U), /* region #0 */ + (28U << MPU_RASR_SIZE_Pos) /* 2^(18+1) region */ + | (0x6U << MPU_RASR_AP_Pos) /* PA:ro/UA:ro */ + | (1U << MPU_RASR_C_Pos) /* C=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #1: SRAM: base=0x2000'0000, size=512M=2^(28+1) */ + 0x20000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 1U), /* region #1 */ + (28U << MPU_RASR_SIZE_Pos) /* 2^(28+1) region */ + | (0x3U << MPU_RASR_AP_Pos) /* PA:rw/UA:rw */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | (1U << MPU_RASR_S_Pos) /* S=1 */ + | (1U << MPU_RASR_C_Pos) /* C=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + /* region #3: (not configured) */ + { MPU_RBAR_VALID_Msk | (MPU_RBAR_REGION_Msk & 2U), 0U }, + + { /* region #3: Peripherals: base=0x4000'0000, size=512M=2^(28+1) */ + 0x40000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 3U), /* region #3 */ + (28U << MPU_RASR_SIZE_Pos) /* 2^(28+1) region */ + | (0x3U << MPU_RASR_AP_Pos) /* PA:rw/UA:rw */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | (1U << MPU_RASR_S_Pos) /* S=1 */ + | (1U << MPU_RASR_B_Pos) /* B=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #4: Priv. Periph: base=0xE000'0000, size=512M=2^(28+1) */ + 0xE0000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 4U), /* region #4 */ + (28U << MPU_RASR_SIZE_Pos) /* 2^(28+1) region */ + | (0x3U << MPU_RASR_AP_Pos) /* PA:rw/UA:rw */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | (1U << MPU_RASR_S_Pos) /* S=1 */ + | (1U << MPU_RASR_B_Pos) /* B=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #5: Ext RAM: base=0x6000'0000, size=1G=2^(29+1) */ + 0x60000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 5U), /* region #5 */ + (29U << MPU_RASR_SIZE_Pos) /* 2^(28+1) region */ + | (0x3U << MPU_RASR_AP_Pos) /* PA:rw/UA:rw */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | (1U << MPU_RASR_S_Pos) /* S=1 */ + | (1U << MPU_RASR_B_Pos) /* B=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #6: Ext Dev: base=0xA000'0000, size=1G=2^(29+1) */ + 0xA0000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 6U), /* region #6 */ + (29U << MPU_RASR_SIZE_Pos) /* 2^(28+1) region */ + | (0x3U << MPU_RASR_AP_Pos) /* PA:rw/UA:rw */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | (1U << MPU_RASR_S_Pos) /* S=1 */ + | (1U << MPU_RASR_B_Pos) /* B=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #7: NULL-pointer: base=0x000'0000, size=256B, NOTE0 */ + 0x00000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 7U), /* region #7 */ + (7U << MPU_RASR_SIZE_Pos) /* 2^(7+1)=256B region */ + | (0x0U << MPU_RASR_AP_Pos) /* PA:na/UA:na */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + }; + + /* enable the MemManage_Handler for MPU exception */ + SCB->SHCSR |= SCB_SHCSR_MEMFAULTENA_Msk; + + __DSB(); + MPU->CTRL = 0U; /* disable the MPU */ + for (uint_fast8_t n = 0U; n < Q_DIM(mpu_setup); ++n) { + MPU->RBAR = mpu_setup[n].rbar; + MPU->RASR = mpu_setup[n].rasr; + } + MPU->CTRL = MPU_CTRL_ENABLE_Msk; /* enable the MPU */ + __ISB(); + __DSB(); +} + /*..........................................................................*/ void BSP_init(void) { + /* setup the MPU... */ + EFM32PG182_MPU_setup(); + /* NOTE: SystemInit() already called from the startup code * but SystemCoreClock needs to be updated */ SystemCoreClockUpdate(); - /* configure the FPU usage by choosing one of the options... */ -#if 1 - /* OPTION 1: - * Use the automatic FPU state preservation and the FPU lazy stacking. - * - * NOTE: - * Use the following setting when FPU is used in more than one task or - * in any ISRs. This setting is the safest and recommended, but requires - * extra stack space and CPU cycles. - */ - FPU->FPCCR |= (1U << FPU_FPCCR_ASPEN_Pos) | (1U << FPU_FPCCR_LSPEN_Pos); -#else - /* OPTION 2: - * Do NOT to use the automatic FPU state preservation and - * do NOT to use the FPU lazy stacking. - * - * NOTE: - * Use the following setting when FPU is used in ONE task only and not - * in any ISR. This setting is very efficient, but if more than one task - * (or ISR) start using the FPU, this can lead to corruption of the - * FPU registers. This option should be used with CAUTION. - */ - FPU->FPCCR &= ~((1U << FPU_FPCCR_ASPEN_Pos) | (1U << FPU_FPCCR_LSPEN_Pos)); -#endif + /* NOTE The VFP (hardware Floating Point) unit is configured by QV-port */ /* enable clock for to the peripherals used by this application... */ CMU_ClockEnable(cmuClock_HFPER, true); @@ -192,7 +285,7 @@ void BSP_init(void) { GPIO_PinModeSet(PB_PORT, PB0_PIN, gpioModeInputPull, 1); GPIO_PinModeSet(PB_PORT, PB1_PIN, gpioModeInputPull, 1); - //... + /*... */ BSP_randomSeed(1234U); if (QS_INIT((void *)0) == 0) { /* initialize the QS software tracing */ @@ -231,7 +324,7 @@ void BSP_displayPhilStat(uint8_t n, char const *stat) { QS_BEGIN_ID(PHILO_STAT, AO_Philo[n]->prio) /* app-specific record */ QS_U8(1, n); /* Philosopher number */ QS_STR(stat); /* Philosopher status */ - QS_END() + QS_END() /* application-specific record end */ } /*..........................................................................*/ void BSP_displayPaused(uint8_t paused) { @@ -267,7 +360,7 @@ void BSP_terminate(int16_t result) { (void)result; } -/*..........................................................................*/ +/* QF callbacks ============================================================*/ void QF_onStartup(void) { /* set up the SysTick timer to fire at BSP_TICKS_PER_SEC rate */ SysTick_Config(SystemCoreClock / BSP_TICKS_PER_SEC); @@ -434,7 +527,7 @@ void QS_onFlush(void) { /* while TXE not empty */ while ((l_USART0->STATUS & USART_STATUS_TXBL) == 0U) { } - l_USART0->TXDATA = (b & 0xFFU); /* put into the DR register */ + l_USART0->TXDATA = (b & 0xFFU); /* put into the DR register */ QF_INT_DISABLE(); } QF_INT_ENABLE(); @@ -472,7 +565,15 @@ void QS_onCommand(uint8_t cmdId, #endif /* Q_SPY */ /*--------------------------------------------------------------------------*/ -/***************************************************************************** +/*============================================================================ +* NOTE0: +* The MPU protection against NULL-pointer dereferencing sets up a no-access +* MPU region #7 around the NULL address (0x0). This works even though the +* Vector Table also resides at address 0x0. However, the *size* of the +* no-access region should not exceed the size of the Vector Table. In this +* case, the size is set to 2**(7+1)==256 bytes, which does not contain any +* data that the CPU would legitimately read with the LDR instruction. +* * NOTE1: * The QF_AWARE_ISR_CMSIS_PRI constant from the QF port specifies the highest * ISR priority that is disabled by the QF framework. The value is suitable diff --git a/examples/arm-cm/dpp_efm32-slstk3401a/qxk/armclang/dpp-qxk.uvprojx b/examples/arm-cm/dpp_efm32-slstk3401a/qxk/armclang/dpp-qxk.uvprojx index bcde63b8..4fbdccff 100644 --- a/examples/arm-cm/dpp_efm32-slstk3401a/qxk/armclang/dpp-qxk.uvprojx +++ b/examples/arm-cm/dpp_efm32-slstk3401a/qxk/armclang/dpp-qxk.uvprojx @@ -1677,7 +1677,7 @@ 0 - Q_SPY QXK_ON_CONTEXT_SW QXK_USE_IRQ_HANDLER=CRYPTO_IRQHandler QXK_USE_IRQ_NUM=25 + Q_SPY QF_ON_CONTEXT_SW QXK_USE_IRQ_HANDLER=CRYPTO_IRQHandler QXK_USE_IRQ_NUM=25 ..\..;..\..\..\..\..\include;..\..\..\..\..\ports\arm-cm\qxk\armclang;..\..\..\..\..\3rd_party\CMSIS\Include;..\..\..\..\..\3rd_party\efm32pg1b diff --git a/examples/arm-cm/dpp_efm32-slstk3401a/qxk/bsp.c b/examples/arm-cm/dpp_efm32-slstk3401a/qxk/bsp.c index eb9509f3..e095a229 100644 --- a/examples/arm-cm/dpp_efm32-slstk3401a/qxk/bsp.c +++ b/examples/arm-cm/dpp_efm32-slstk3401a/qxk/bsp.c @@ -1,7 +1,7 @@ /***************************************************************************** * Product: DPP example, EFM32-SLSTK3401A board, preemptive QXK kernel -* Last updated for version 7.1.0 -* Last updated on 2022-08-28 +* Last updated for version 7.2.0 +* Last updated on 2022-12-22 * * Q u a n t u m L e a P s * ------------------------ @@ -206,8 +206,6 @@ void BSP_init(void) { QS_USR_DICTIONARY(CONTEXT_SW); QS_USR_DICTIONARY(COMMAND_STAT); - QS_FUN_DICTIONARY(&QHsm_top); - /* setup the QS filters... */ QS_GLB_FILTER(QS_ALL_RECORDS); /* all records */ QS_GLB_FILTER(-QS_QF_TICK); /* exclude the clock tick */ @@ -310,9 +308,9 @@ void QF_onStartup(void) { void QF_onCleanup(void) { } /*..........................................................................*/ -#ifdef QXK_ON_CONTEXT_SW +#ifdef QF_ON_CONTEXT_SW /* NOTE: the context-switch callback is called with interrupts DISABLED */ -void QXK_onContextSw(QActive *prev, QActive *next) { +void QF_onContextSw(QActive *prev, QActive *next) { (void)prev; if (next != (QActive *)0) { //_impure_ptr = next->thread; /* switch to next TLS */ @@ -322,7 +320,7 @@ void QXK_onContextSw(QActive *prev, QActive *next) { QS_OBJ(next); QS_END_NOCRIT() } -#endif /* QXK_ON_CONTEXT_SW */ +#endif /* QF_ON_CONTEXT_SW */ /*..........................................................................*/ void QXK_onIdle(void) { float volatile x; @@ -334,7 +332,7 @@ void QXK_onIdle(void) { GPIO->P[LED_PORT].DOUT &= ~(1U << LED1_PIN); QF_INT_ENABLE(); */ - /* Some flating point code is to exercise the VFP... */ + /* Some floating point code is to exercise the VFP... */ x = 1.73205F; x = x * 1.73205F; diff --git a/examples/arm-cm/dpp_efm32-slstk3401a/qxk/gnu/Makefile b/examples/arm-cm/dpp_efm32-slstk3401a/qxk/gnu/Makefile index f82fe516..b972bbf4 100644 --- a/examples/arm-cm/dpp_efm32-slstk3401a/qxk/gnu/Makefile +++ b/examples/arm-cm/dpp_efm32-slstk3401a/qxk/gnu/Makefile @@ -1,7 +1,7 @@ ############################################################################## # Product: Makefile for QP/C on EMF32-SLSTK3401A, QXK kernel, GNU-ARM -# Last Updated for Version: 7.0.2 -# Date of the Last Update: 2022-08-18 +# Last Updated for Version: 7.2.0 +# Date of the Last Update: 2022-12-13 # # Q u a n t u m L e a P s # ------------------------ @@ -142,7 +142,7 @@ LIBS := # defines DEFINES := -DEFM32PG1B200F256GM48=1 \ - -DQXK_ON_CONTEXT_SW \ + -DQF_ON_CONTEXT_SW \ -DQXK_USE_IRQ_HANDLER=CRYPTO_IRQHandler \ -DQXK_USE_IRQ_NUM=25 diff --git a/examples/arm-cm/dpp_efm32-slstk3401a/qxk/gnu/Makefile-nassert b/examples/arm-cm/dpp_efm32-slstk3401a/qxk/gnu/Makefile-nassert index b30a49c5..ee36667b 100644 --- a/examples/arm-cm/dpp_efm32-slstk3401a/qxk/gnu/Makefile-nassert +++ b/examples/arm-cm/dpp_efm32-slstk3401a/qxk/gnu/Makefile-nassert @@ -1,13 +1,13 @@ ############################################################################## # Product: Makefile for QP/C on EMF32-SLSTK3401A, QXK kernel, GNU-ARM -# Last Updated for Version: 7.1.0 -# Date of the Last Update: 2022-08-28 +# Last Updated for Version: 7.2.0 +# Date of the Last Update: 2022-12-13 # # Q u a n t u m L e a P s # ------------------------ # Modern Embedded Software # -# Copyright (C) 2005-2022 Quantum Leaps, LLC. All rights reserved. +# Copyright (C) 2005 Quantum Leaps, LLC. All rights reserved. # # This program is open source software: you can redistribute it and/or # modify it under the terms of the GNU General Public License as published @@ -142,7 +142,7 @@ LIBS := # defines DEFINES := -DEFM32PG1B200F256GM48=1 \ - -DQXK_ON_CONTEXT_SW \ + -DQF_ON_CONTEXT_SW \ -DQXK_USE_IRQ_HANDLER=CRYPTO_IRQHandler \ -DQXK_USE_IRQ_NUM=25 \ -DQ_NASSERT diff --git a/examples/arm-cm/dpp_efm32-slstk3401a/qxk/iar/dpp-qxk.ewp b/examples/arm-cm/dpp_efm32-slstk3401a/qxk/iar/dpp-qxk.ewp index 09e630c1..c7e52ebb 100644 --- a/examples/arm-cm/dpp_efm32-slstk3401a/qxk/iar/dpp-qxk.ewp +++ b/examples/arm-cm/dpp_efm32-slstk3401a/qxk/iar/dpp-qxk.ewp @@ -217,7 +217,7 @@ EFM32PG1B200F256GM48 QXK_USE_IRQ_HANDLER=CRYPTO_IRQHandler QXK_USE_IRQ_NUM=25 - QXK_ON_CONTEXT_SW=1 + QF_ON_CONTEXT_SW - - BILINK - 0 - - Coder 0 @@ -1072,9 +1063,13 @@ General 3 - 31 + 33 1 0 + - - - - - + + ICCARM 2 - 35 + 37 1 0 - - - + AARM 2 - 10 + 11 1 0 + @@ -1734,13 +1709,9 @@ 0 + inputOutputBased - - BICOMP - 0 - - BUILDACTION 1 @@ -1753,17 +1724,13 @@ ILINK 0 - 23 + 25 1 0 - + + + + + @@ -2112,11 +2099,6 @@ - - BILINK - 0 - - Coder 0 @@ -2133,9 +2115,13 @@ General 3 - 31 + 33 1 1 + - - - - - + + ICCARM 2 - 35 + 37 1 1 - - - + AARM 2 - 10 + 11 1 1 + @@ -2795,13 +2761,9 @@ 0 + inputOutputBased - - BICOMP - 0 - - BUILDACTION 1 @@ -2814,17 +2776,13 @@ ILINK 0 - 23 + 25 1 1 - + + + + + @@ -3173,11 +3151,6 @@ - - BILINK - 0 - - Coder 0 @@ -3185,7 +3158,6 @@ - Debug Release Spy diff --git a/examples/arm-cm/dpp_ek-tm4c123gxl/table.c b/examples/arm-cm/dpp_ek-tm4c123gxl/table.c index b06ef085..1030cfe3 100644 --- a/examples/arm-cm/dpp_ek-tm4c123gxl/table.c +++ b/examples/arm-cm/dpp_ek-tm4c123gxl/table.c @@ -3,7 +3,7 @@ * Model: dpp.qm * File: ${.::table.c} * -* This code has been generated by QM 5.2.2 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later @@ -64,8 +64,8 @@ static QState Table_paused(Table * const me, QEvt const * const e); /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/examples/arm-cm/dpp_mbed-lpc1768/dpp.h b/examples/arm-cm/dpp_mbed-lpc1768/dpp.h index 08294733..c45cc7c6 100644 --- a/examples/arm-cm/dpp_mbed-lpc1768/dpp.h +++ b/examples/arm-cm/dpp_mbed-lpc1768/dpp.h @@ -3,7 +3,7 @@ * Model: dpp.qm * File: ${.::dpp.h} * -* This code has been generated by QM 5.2.2 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later diff --git a/examples/arm-cm/dpp_mbed-lpc1768/dpp.qm b/examples/arm-cm/dpp_mbed-lpc1768/dpp.qm index c7d2d40f..79ff1da8 100644 --- a/examples/arm-cm/dpp_mbed-lpc1768/dpp.qm +++ b/examples/arm-cm/dpp_mbed-lpc1768/dpp.qm @@ -1,5 +1,5 @@ - + Dining Philosopher Problem example diff --git a/examples/arm-cm/dpp_mbed-lpc1768/philo.c b/examples/arm-cm/dpp_mbed-lpc1768/philo.c index ef62b226..919e39d6 100644 --- a/examples/arm-cm/dpp_mbed-lpc1768/philo.c +++ b/examples/arm-cm/dpp_mbed-lpc1768/philo.c @@ -3,7 +3,7 @@ * Model: dpp.qm * File: ${.::philo.c} * -* This code has been generated by QM 5.2.2 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later @@ -67,8 +67,8 @@ static Philo l_philo[N_PHILO]; /* storage for all Philos */ /* Global objects ----------------------------------------------------------*/ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/examples/arm-cm/dpp_mbed-lpc1768/qk/armclang/dpp-qk.uvoptx b/examples/arm-cm/dpp_mbed-lpc1768/qk/armclang/dpp-qk.uvoptx index cfb28a71..93313050 100644 --- a/examples/arm-cm/dpp_mbed-lpc1768/qk/armclang/dpp-qk.uvoptx +++ b/examples/arm-cm/dpp_mbed-lpc1768/qk/armclang/dpp-qk.uvoptx @@ -10,7 +10,7 @@ *.s*; *.src; *.a* *.obj *.lib - *.txt; *.h; *.inc + *.txt; *.h; *.inc; *.md *.plm *.cpp 0 @@ -215,6 +215,13 @@ + + 1 + 1 + 0 + 2 + 10000000 + @@ -583,6 +590,13 @@ + + 1 + 1 + 0 + 2 + 10000000 + @@ -703,7 +717,7 @@ 0 0 0 - ..\..\..\..\.arm\startup-lpc1768\armclang\startup_LPC17xx.s + ..\..\..\..\..\3rd_party\mbed-lpc1768\arm\startup_LPC17xx.s startup_LPC17xx.s 0 0 diff --git a/examples/arm-cm/dpp_mbed-lpc1768/qk/armclang/dpp-qk.uvprojx b/examples/arm-cm/dpp_mbed-lpc1768/qk/armclang/dpp-qk.uvprojx index 0772ad2d..b9d96f14 100644 --- a/examples/arm-cm/dpp_mbed-lpc1768/qk/armclang/dpp-qk.uvprojx +++ b/examples/arm-cm/dpp_mbed-lpc1768/qk/armclang/dpp-qk.uvprojx @@ -10,13 +10,13 @@ dpp-dbg 0x4 ARM-ADS - 6130001::V6.13.1::.\ARMCLANG + 6160000::V6.16::ARMCLANG 1 LPC1768 NXP - Keil.LPC1700_DFP.2.2.0 + Keil.LPC1700_DFP.2.7.1 http://www.keil.com/pack/ IROM(0x00000000,0x80000) IRAM(0x10000000,0x8000) IRAM2(0x2007C000,0x8000) CPUTYPE("Cortex-M3") CLOCK(12000000) ELITTLE @@ -185,6 +185,7 @@ 0 0 0 + 0 1 0 8 @@ -351,7 +352,7 @@ 0 1 0 - 0 + 4 Stack_Size=2048 Heap_Size=16 @@ -610,7 +611,7 @@ 2 2 2 - 2 + 0 @@ -655,7 +656,7 @@ LPC1768 NXP - Keil.LPC1700_DFP.2.2.0 + Keil.LPC1700_DFP.2.7.1 http://www.keil.com/pack/ IROM(0x00000000,0x80000) IRAM(0x10000000,0x8000) IRAM2(0x2007C000,0x8000) CPUTYPE("Cortex-M3") CLOCK(12000000) ELITTLE @@ -824,6 +825,7 @@ 0 0 0 + 0 1 0 8 @@ -990,7 +992,7 @@ 0 1 0 - 0 + 4 Stack_Size=2048 Heap_Size=16 @@ -1249,7 +1251,7 @@ 2 2 2 - 2 + 0 @@ -1288,13 +1290,13 @@ dpp-spy 0x4 ARM-ADS - 6130001::V6.13.1::.\ARMCLANG + 6160000::V6.16::ARMCLANG 1 LPC1768 NXP - Keil.LPC1700_DFP.2.2.0 + Keil.LPC1700_DFP.2.7.1 http://www.keil.com/pack/ IROM(0x00000000,0x80000) IRAM(0x10000000,0x8000) IRAM2(0x2007C000,0x8000) CPUTYPE("Cortex-M3") CLOCK(12000000) ELITTLE @@ -1463,6 +1465,7 @@ 0 0 0 + 0 1 0 8 @@ -1629,7 +1632,7 @@ 0 1 0 - 0 + 4 Stack_Size=2048 Heap_Size=16 diff --git a/examples/arm-cm/dpp_mbed-lpc1768/qk/bsp.c b/examples/arm-cm/dpp_mbed-lpc1768/qk/bsp.c index 44c64ff8..17eb91d8 100644 --- a/examples/arm-cm/dpp_mbed-lpc1768/qk/bsp.c +++ b/examples/arm-cm/dpp_mbed-lpc1768/qk/bsp.c @@ -132,6 +132,22 @@ void EINT0_IRQHandler(void) { /* BSP functions ===========================================================*/ void BSP_init(void) { + /* enable the MemManage_Handler for MPU exception */ + SCB->SHCSR |= SCB_SHCSR_MEMFAULTENA_Msk; + + /* Configure the MPU to prevent NULL-pointer dereferencing ... */ + MPU->RBAR = 0x0U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 7U); /* region 7 */ + MPU->RASR = (7U << MPU_RASR_SIZE_Pos) /* 2**(7+1) region */ + | (0x0U << MPU_RASR_AP_Pos) /* no access */ + | MPU_RASR_ENABLE_Msk; /* region enable */ + + MPU->CTRL = MPU_CTRL_PRIVDEFENA_Msk /* enable background region */ + | MPU_CTRL_ENABLE_Msk; /* enable the MPU */ + __ISB(); + __DSB(); + /* NOTE: SystemInit() has been already called from the startup code * but SystemCoreClock needs to be updated */ diff --git a/examples/arm-cm/dpp_mbed-lpc1768/qk/iar/dpp-qk.ewd b/examples/arm-cm/dpp_mbed-lpc1768/qk/iar/dpp-qk.ewd index be6e11ed..f782d88e 100644 --- a/examples/arm-cm/dpp_mbed-lpc1768/qk/iar/dpp-qk.ewd +++ b/examples/arm-cm/dpp_mbed-lpc1768/qk/iar/dpp-qk.ewd @@ -1,4462 +1,4582 @@ - - + - 2 - - Debug - - ARM - - 1 - - C-SPY - 2 - - 26 - 1 + 3 + + Debug + + ARM + 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ARMSIM_ID - 2 - - 1 - 1 - 1 - - - - - - - - ANGEL_ID - 2 - - 0 - 1 - 1 - - - - - - - - - - - - CMSISDAP_ID - 2 - - 2 - 1 - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - GDBSERVER_ID - 2 - - 0 - 1 - 1 - - - - - - - - - - - IARROM_ID - 2 - - 1 - 1 - 1 - - - - - - - - - IJET_ID - 2 - - 6 - 1 - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - JLINK_ID - 2 - - 15 - 1 - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - LMIFTDI_ID - 2 - - 2 - 1 - 1 - - - - - - - - - - MACRAIGOR_ID - 2 - - 3 - 1 - 1 - - - - - - - - - - - - - - - - - - - - - - - PEMICRO_ID - 2 - - 1 - 1 - 1 - - - - - - - - - - - - - - - - - - - RDI_ID - 2 - - 2 - 1 - 1 - - - - - - - - - - - - - - - - STLINK_ID - 2 - - 2 - 1 - 1 - - - - - - - - - - - THIRDPARTY_ID - 2 - - 0 - 1 - 1 - - - - - - - - XDS100_ID - 2 - - 4 - 1 - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - $TOOLKIT_DIR$\plugins\middleware\HCCWare\HCCWare.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\AVIX\AVIX.ENU.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\MQX\MQXRtosPlugin.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\Quadros\Quadros_EWB7_Plugin.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin - 0 - - - $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin - 1 - - - $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin - 0 - - - $EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin - 1 - - - $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin - 0 - - - - - Release - - ARM - - 0 - - C-SPY - 2 - - 26 - 1 + + C-SPY + 2 + + 32 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 1 + 1 + 1 + + + + + + + + CADI_ID + 2 + + 0 + 1 + 1 + + + + + + + + + CMSISDAP_ID + 2 + + 4 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + GDBSERVER_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + IJET_ID + 2 + + 9 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + JLINK_ID + 2 + + 16 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 3 + 1 + 1 + + + + + + + + + + + + + NULINK_ID + 2 + + 0 + 1 + 1 + + + + + + + PEMICRO_ID + 2 + + 3 + 1 + 1 + + + + + + + + STLINK_ID + 2 + + 7 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + TIFET_ID + 2 + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + + + XDS100_ID + 2 + + 8 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\FreeRtos\FreeRtosArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\Mbed\MbedArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\Mbed\MbedArmPlugin2.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\SMX\smxAwareIarArm9.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\SMX\smxAwareIarArm9BE.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\TargetAccessServer\TargetAccessServer.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin + 0 + + + + + Release + + ARM + 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ARMSIM_ID - 2 - - 1 - 1 - 0 - - - - - - - - ANGEL_ID - 2 - - 0 - 1 - 0 - - - - - - - - - - - - CMSISDAP_ID - 2 - - 2 - 1 - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - GDBSERVER_ID - 2 - - 0 - 1 - 0 - - - - - - - - - - - IARROM_ID - 2 - - 1 - 1 - 0 - - - - - - - - - IJET_ID - 2 - - 6 - 1 - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - JLINK_ID - 2 - - 15 - 1 - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - LMIFTDI_ID - 2 - - 2 - 1 - 0 - - - - - - - - - - MACRAIGOR_ID - 2 - - 3 - 1 - 0 - - - - - - - - - - - - - - - - - - - - - - - PEMICRO_ID - 2 - - 1 - 1 - 0 - - - - - - - - - - - - - - - - - - - RDI_ID - 2 - - 2 - 1 - 0 - - - - - - - - - - - - - - - - STLINK_ID - 2 - - 2 - 1 - 0 - - - - - - - - - - - THIRDPARTY_ID - 2 - - 0 - 1 - 0 - - - - - - - - XDS100_ID - 2 - - 4 - 1 - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - $TOOLKIT_DIR$\plugins\middleware\HCCWare\HCCWare.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\AVIX\AVIX.ENU.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\MQX\MQXRtosPlugin.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\Quadros\Quadros_EWB7_Plugin.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin - 0 - - - $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin - 1 - - - $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin - 0 - - - $EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin - 1 - - - $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin - 0 - - - - - Spy - - ARM - - 1 - - C-SPY - 2 - - 26 - 1 + + C-SPY + 2 + + 32 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 1 + 1 + 0 + + + + + + + + CADI_ID + 2 + + 0 + 1 + 0 + + + + + + + + + CMSISDAP_ID + 2 + + 4 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + GDBSERVER_ID + 2 + + 0 + 1 + 0 + + + + + + + + + + + IJET_ID + 2 + + 9 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + JLINK_ID + 2 + + 16 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 3 + 1 + 0 + + + + + + + + + + + + + NULINK_ID + 2 + + 0 + 1 + 0 + + + + + + + PEMICRO_ID + 2 + + 3 + 1 + 0 + + + + + + + + STLINK_ID + 2 + + 7 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 0 + + + + + + + + TIFET_ID + 2 + + 1 + 1 + 0 + + + + + + + + + + + + + + + + + + + XDS100_ID + 2 + + 8 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\FreeRtos\FreeRtosArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\Mbed\MbedArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\Mbed\MbedArmPlugin2.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\SMX\smxAwareIarArm9.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\SMX\smxAwareIarArm9BE.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\TargetAccessServer\TargetAccessServer.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin + 0 + + + + + Spy + + ARM + 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ARMSIM_ID - 2 - - 1 - 1 - 1 - - - - - - - - ANGEL_ID - 2 - - 0 - 1 - 1 - - - - - - - - - - - - CMSISDAP_ID - 2 - - 2 - 1 - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - GDBSERVER_ID - 2 - - 0 - 1 - 1 - - - - - - - - - - - IARROM_ID - 2 - - 1 - 1 - 1 - - - - - - - - - IJET_ID - 2 - - 6 - 1 - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - JLINK_ID - 2 - - 15 - 1 - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - LMIFTDI_ID - 2 - - 2 - 1 - 1 - - - - - - - - - - MACRAIGOR_ID - 2 - - 3 - 1 - 1 - - - - - - - - - - - - - - - - - - - - - - - PEMICRO_ID - 2 - - 1 - 1 - 1 - - - - - - - - - - - - - - - - - - - RDI_ID - 2 - - 2 - 1 - 1 - - - - - - - - - - - - - - - - STLINK_ID - 2 - - 2 - 1 - 1 - - - - - - - - - - - THIRDPARTY_ID - 2 - - 0 - 1 - 1 - - - - - - - - XDS100_ID - 2 - - 4 - 1 - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - $TOOLKIT_DIR$\plugins\middleware\HCCWare\HCCWare.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\AVIX\AVIX.ENU.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\MQX\MQXRtosPlugin.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\Quadros\Quadros_EWB7_Plugin.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin - 0 - - - $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin - 1 - - - $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin - 0 - - - $EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin - 1 - - - $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin - 0 - - - + + C-SPY + 2 + + 32 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 1 + 1 + 1 + + + + + + + + CADI_ID + 2 + + 0 + 1 + 1 + + + + + + + + + CMSISDAP_ID + 2 + + 4 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + GDBSERVER_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + IJET_ID + 2 + + 9 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + JLINK_ID + 2 + + 16 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 3 + 1 + 1 + + + + + + + + + + + + + NULINK_ID + 2 + + 0 + 1 + 1 + + + + + + + PEMICRO_ID + 2 + + 3 + 1 + 1 + + + + + + + + STLINK_ID + 2 + + 7 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + TIFET_ID + 2 + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + + + XDS100_ID + 2 + + 8 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\FreeRtos\FreeRtosArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\Mbed\MbedArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\Mbed\MbedArmPlugin2.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\SMX\smxAwareIarArm9.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\SMX\smxAwareIarArm9BE.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\TargetAccessServer\TargetAccessServer.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin + 0 + + + - - diff --git a/examples/arm-cm/dpp_mbed-lpc1768/qk/iar/dpp-qk.ewp b/examples/arm-cm/dpp_mbed-lpc1768/qk/iar/dpp-qk.ewp index c015ed95..8db76478 100644 --- a/examples/arm-cm/dpp_mbed-lpc1768/qk/iar/dpp-qk.ewp +++ b/examples/arm-cm/dpp_mbed-lpc1768/qk/iar/dpp-qk.ewp @@ -1,3008 +1,3266 @@ - - + - 2 - - Debug - - ARM - - 1 - - General - 3 - - 24 - 1 + 3 + + Debug + + ARM + 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ICCARM - 2 - - 31 - 1 - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - AARM - 2 - - 9 - 1 - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - OBJCOPY - 0 - - 1 - 1 - 1 - - - - - - - - - CUSTOM - 3 - - - - 0 - - - - BICOMP - 0 - - - - BUILDACTION - 1 - - cmd /c "if exist $OBJ_DIR$\qstamp.o del $OBJ_DIR$\qstamp.o" - - - - - ILINK - 0 - - 16 - 1 - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - IARCHIVE - 0 - - 0 - 1 - 1 - - - - - - - BILINK - 0 - - - - Coder - 0 - - - - - Release - - ARM - - 0 - - General - 3 - - 24 - 1 + + General + 3 + + 33 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 37 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 11 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OBJCOPY + 0 + + 1 + 1 + 1 + + + + + + + + + CUSTOM + 3 + + + + 0 + inputOutputBased + + + + BUILDACTION + 1 + + cmd /c "if exist $OBJ_DIR$\qstamp.o del $OBJ_DIR$\qstamp.o" + + + + + ILINK + 0 + + 25 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IARCHIVE + 0 + + 0 + 1 + 1 + + + + + + + Coder + 0 + + + + + Release + + ARM + 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ICCARM - 2 - - 31 - 1 - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - AARM - 2 - - 9 - 1 - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - OBJCOPY - 0 - - 1 - 1 - 0 - - - - - - - - - CUSTOM - 3 - - - - 0 - - - - BICOMP - 0 - - - - BUILDACTION - 1 - - cmd /c "if exist $OBJ_DIR$\qstamp.o del $OBJ_DIR$\qstamp.o" - - - - - ILINK - 0 - - 16 - 1 - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - IARCHIVE - 0 - - 0 - 1 - 0 - - - - - - - BILINK - 0 - - - - Coder - 0 - - - - - Spy - - ARM - - 1 - - General - 3 - - 24 - 1 + + General + 3 + + 33 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 37 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 11 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OBJCOPY + 0 + + 1 + 1 + 0 + + + + + + + + + CUSTOM + 3 + + + + 0 + inputOutputBased + + + + BUILDACTION + 1 + + cmd /c "if exist $OBJ_DIR$\qstamp.o del $OBJ_DIR$\qstamp.o" + + + + + ILINK + 0 + + 25 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IARCHIVE + 0 + + 0 + 1 + 0 + + + + + + + Coder + 0 + + + + + Spy + + ARM + 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ICCARM - 2 - - 31 - 1 - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - AARM - 2 - - 9 - 1 - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - OBJCOPY - 0 - - 1 - 1 - 1 - - - - - - - - - CUSTOM - 3 - - - - 0 - - - - BICOMP - 0 - - - - BUILDACTION - 1 - - cmd /c "if exist $OBJ_DIR$\qstamp.o del $OBJ_DIR$\qstamp.o" - - - - - ILINK - 0 - - 16 - 1 - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - IARCHIVE - 0 - - 0 - 1 - 1 - - - - - - - BILINK - 0 - - - - Coder - 0 - - - - - Application - - $PROJ_DIR$\..\bsp.c - - - $PROJ_DIR$\..\..\bsp.h - - - $PROJ_DIR$\..\..\dpp.h - - - $PROJ_DIR$\..\..\main.c - - - $PROJ_DIR$\..\..\philo.c - - - $PROJ_DIR$\..\..\..\..\..\include\qstamp.c - - - $PROJ_DIR$\..\..\table.c - - - - mbed-lpc1768 - - $PROJ_DIR$\..\..\..\..\..\3rd_party\mbed-lpc1768\LPC17xx.h - - - $PROJ_DIR$\..\..\..\..\..\3rd_party\mbed-lpc1768\iar\startup_LPC17xx.s - - - $PROJ_DIR$\..\..\..\..\..\3rd_party\mbed-lpc1768\system_LPC17xx.c - - - $PROJ_DIR$\..\..\..\..\..\3rd_party\mbed-lpc1768\system_LPC17xx.h - - - - QP - - $PROJ_DIR$\..\..\..\..\..\src\qf\qep_hsm.c - - - $PROJ_DIR$\..\..\..\..\..\src\qf\qep_msm.c - - - $PROJ_DIR$\..\..\..\..\..\src\qf\qf_act.c - - - $PROJ_DIR$\..\..\..\..\..\src\qf\qf_actq.c - - - $PROJ_DIR$\..\..\..\..\..\src\qf\qf_defer.c - - - $PROJ_DIR$\..\..\..\..\..\src\qf\qf_dyn.c - - - $PROJ_DIR$\..\..\..\..\..\src\qf\qf_mem.c - - - $PROJ_DIR$\..\..\..\..\..\src\qf_pkg.h - - - $PROJ_DIR$\..\..\..\..\..\src\qf\qf_ps.c - - - $PROJ_DIR$\..\..\..\..\..\src\qf\qf_qact.c - - - $PROJ_DIR$\..\..\..\..\..\src\qf\qf_qeq.c - - - $PROJ_DIR$\..\..\..\..\..\src\qf\qf_qmact.c - - - $PROJ_DIR$\..\..\..\..\..\src\qf\qf_time.c - - - $PROJ_DIR$\..\..\..\..\..\src\qk\qk.c - - - $PROJ_DIR$\..\..\..\..\..\src\qk_pkg.h - - - - QP_port - - $PROJ_DIR$\..\..\..\..\..\ports\arm-cm\qk\iar\qk_port.c - - - - QS - - Debug - Release - - - $PROJ_DIR$\..\..\..\..\..\src\qs\qs.c - - - $PROJ_DIR$\..\..\..\..\..\src\qs\qs_fp.c - - - $PROJ_DIR$\..\..\..\..\..\src\qs\qs_pkg.h - - + + General + 3 + + 33 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 37 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 11 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OBJCOPY + 0 + + 1 + 1 + 1 + + + + + + + + + CUSTOM + 3 + + + + 0 + inputOutputBased + + + + BUILDACTION + 1 + + cmd /c "if exist $OBJ_DIR$\qstamp.o del $OBJ_DIR$\qstamp.o" + + + + + ILINK + 0 + + 25 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IARCHIVE + 0 + + 0 + 1 + 1 + + + + + + + Coder + 0 + + + + + Application + + $PROJ_DIR$\..\bsp.c + + + $PROJ_DIR$\..\..\bsp.h + + + $PROJ_DIR$\..\..\dpp.h + + + $PROJ_DIR$\..\..\main.c + + + $PROJ_DIR$\..\..\philo.c + + + $PROJ_DIR$\..\..\..\..\..\include\qstamp.c + + + $PROJ_DIR$\..\..\table.c + + + + mbed-lpc1768 + + $PROJ_DIR$\..\..\..\..\..\3rd_party\mbed-lpc1768\LPC17xx.h + + + $PROJ_DIR$\..\..\..\..\..\3rd_party\mbed-lpc1768\iar\startup_LPC17xx.s + + + $PROJ_DIR$\..\..\..\..\..\3rd_party\mbed-lpc1768\system_LPC17xx.c + + + $PROJ_DIR$\..\..\..\..\..\3rd_party\mbed-lpc1768\system_LPC17xx.h + + + + QP + + $PROJ_DIR$\..\..\..\..\..\src\qf\qep_hsm.c + + + $PROJ_DIR$\..\..\..\..\..\src\qf\qep_msm.c + + + $PROJ_DIR$\..\..\..\..\..\src\qf\qf_act.c + + + $PROJ_DIR$\..\..\..\..\..\src\qf\qf_actq.c + + + $PROJ_DIR$\..\..\..\..\..\src\qf\qf_defer.c + + + $PROJ_DIR$\..\..\..\..\..\src\qf\qf_dyn.c + + + $PROJ_DIR$\..\..\..\..\..\src\qf\qf_mem.c + + + $PROJ_DIR$\..\..\..\..\..\src\qf_pkg.h + + + $PROJ_DIR$\..\..\..\..\..\src\qf\qf_ps.c + + + $PROJ_DIR$\..\..\..\..\..\src\qf\qf_qact.c + + + $PROJ_DIR$\..\..\..\..\..\src\qf\qf_qeq.c + + + $PROJ_DIR$\..\..\..\..\..\src\qf\qf_qmact.c + + + $PROJ_DIR$\..\..\..\..\..\src\qf\qf_time.c + + + $PROJ_DIR$\..\..\..\..\..\src\qk\qk.c + + + $PROJ_DIR$\..\..\..\..\..\src\qk_pkg.h + + + + QP_port + + $PROJ_DIR$\..\..\..\..\..\ports\arm-cm\qk\iar\qk_port.c + + + + QS + + Debug + Release + + + $PROJ_DIR$\..\..\..\..\..\src\qs\qs.c + + + $PROJ_DIR$\..\..\..\..\..\src\qs\qs_fp.c + + + $PROJ_DIR$\..\..\..\..\..\src\qs\qs_pkg.h + + - - diff --git a/examples/arm-cm/dpp_mbed-lpc1768/table.c b/examples/arm-cm/dpp_mbed-lpc1768/table.c index 0dd847c2..d655896e 100644 --- a/examples/arm-cm/dpp_mbed-lpc1768/table.c +++ b/examples/arm-cm/dpp_mbed-lpc1768/table.c @@ -3,7 +3,7 @@ * Model: dpp.qm * File: ${.::table.c} * -* This code has been generated by QM 5.2.2 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later @@ -65,8 +65,8 @@ static Table l_table; /* the single instance of the Table active object */ /* Global-scope objects ----------------------------------------------------*/ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/examples/arm-cm/dpp_nucleo-h743zi/dpp.h b/examples/arm-cm/dpp_nucleo-h743zi/dpp.h index 83694d8f..da094c2c 100644 --- a/examples/arm-cm/dpp_nucleo-h743zi/dpp.h +++ b/examples/arm-cm/dpp_nucleo-h743zi/dpp.h @@ -3,7 +3,7 @@ * Model: dpp.qm * File: ${.::dpp.h} * -* This code has been generated by QM 5.2.2 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later diff --git a/examples/arm-cm/dpp_nucleo-h743zi/dpp.qm b/examples/arm-cm/dpp_nucleo-h743zi/dpp.qm index 908bccd8..f1256b39 100644 --- a/examples/arm-cm/dpp_nucleo-h743zi/dpp.qm +++ b/examples/arm-cm/dpp_nucleo-h743zi/dpp.qm @@ -1,5 +1,5 @@ - + Dining Philosopher Problem example diff --git a/examples/arm-cm/dpp_nucleo-h743zi/philo.c b/examples/arm-cm/dpp_nucleo-h743zi/philo.c index f79384e4..a5be8e68 100644 --- a/examples/arm-cm/dpp_nucleo-h743zi/philo.c +++ b/examples/arm-cm/dpp_nucleo-h743zi/philo.c @@ -3,7 +3,7 @@ * Model: dpp.qm * File: ${.::philo.c} * -* This code has been generated by QM 5.2.2 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later @@ -66,8 +66,8 @@ static QState Philo_eating(Philo * const me, QEvt const * const e); /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/examples/arm-cm/dpp_nucleo-h743zi/qk/armclang/dpp-qk.uvoptx b/examples/arm-cm/dpp_nucleo-h743zi/qk/armclang/dpp-qk.uvoptx index 91d2c454..ea946d50 100644 --- a/examples/arm-cm/dpp_nucleo-h743zi/qk/armclang/dpp-qk.uvoptx +++ b/examples/arm-cm/dpp_nucleo-h743zi/qk/armclang/dpp-qk.uvoptx @@ -75,7 +75,7 @@ 1 0 - 1 + 0 18 @@ -140,7 +140,7 @@ 0 DLGTARM - (1010=-1,-1,-1,-1,0)(6017=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(6016=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) + (1010=-1,-1,-1,-1,0)(6017=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(6016=-1,-1,-1,-1,0)(1012=3268,1338,3745,1653,0) 0 @@ -148,12 +148,29 @@ - + + + 0 + 0 + 68 + 1 +
134227432
+ 0 + 0 + 0 + 0 + 0 + 1 + ..\main.c + + \\dpp_qk\../main.c\68 +
+
1 2 - 0x20000200 + 0xE000ED08 0 @@ -299,7 +316,7 @@ 1 0 0 - 5 + 6 @@ -467,7 +484,7 @@ 1 0 - 0 + 1 18 @@ -517,7 +534,7 @@ 0 ST-LINKIII-KEIL_SWO - -U0675FF504955857567065746 -O8399 -SF4000 -C0 -A0 -I0 -HNlocalhost -HP7184 -P2 -N00("ARM CoreSight SW-DP") -D00(6BA02477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8004 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20010000 -FC1000 -FN1 -FF0STM32H7x_2048.FLM -FS08000000 -FL0200000 -FP0($$Device:STM32H743ZITx$CMSIS\Flash\STM32H7x_2048.FLM) + -U0675FF504955857567065746 -O8399 -SF10000 -C0 -A0 -I0 -HNlocalhost -HP7184 -P2 -N00("ARM CoreSight SW-DP (ARM Core") -D00(6BA02477) -L00(0) -TO131090 -TC10000000 -TT10000000 -TP21 -TDS8004 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20010000 -FC1000 -FN1 -FF0STM32H7x_2048.FLM -FS08000000 -FL0200000 -FP0($$Device:STM32H743ZITx$CMSIS\Flash\STM32H7x_2048.FLM) 0 @@ -532,7 +549,7 @@ 0 DLGTARM - (1010=-1,-1,-1,-1,0)(6017=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(6016=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) + (1010=-1,-1,-1,-1,0)(6017=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(6016=-1,-1,-1,-1,0)(1012=2104,292,2581,607,0) 0 diff --git a/examples/arm-cm/dpp_nucleo-h743zi/qk/armclang/dpp-qk.uvprojx b/examples/arm-cm/dpp_nucleo-h743zi/qk/armclang/dpp-qk.uvprojx index aa334fdf..2e185521 100644 --- a/examples/arm-cm/dpp_nucleo-h743zi/qk/armclang/dpp-qk.uvprojx +++ b/examples/arm-cm/dpp_nucleo-h743zi/qk/armclang/dpp-qk.uvprojx @@ -322,7 +322,7 @@ 0 0 0 - 0 + 3 0 1 0 @@ -1683,7 +1683,7 @@ 0 - 2 + 1 0 0 1 @@ -1692,7 +1692,7 @@ 0 0 0 - 0 + 3 0 1 0 @@ -1996,7 +1996,7 @@ 2 2 2 - 2 + 0 2 2 2 diff --git a/examples/arm-cm/dpp_nucleo-h743zi/qk/bsp.c b/examples/arm-cm/dpp_nucleo-h743zi/qk/bsp.c index 21e4a592..a0f88601 100644 --- a/examples/arm-cm/dpp_nucleo-h743zi/qk/bsp.c +++ b/examples/arm-cm/dpp_nucleo-h743zi/qk/bsp.c @@ -23,8 +23,8 @@ * ============================================================================*/ /*! -* @date Last updated on: 2022-02-25 -* @version Last updated for: @ref qpc_7_0_0 +* @date Last updated on: 2022-12-18 +* @version Last updated for: @ref qpc_7_2_0 * * @file * @brief DPP example, NUCLEO-H743ZIE board, preemptive QK kernel @@ -61,7 +61,7 @@ static uint32_t l_rnd; /* random seed */ PHILO_STAT = QS_USER, PAUSED_STAT, COMMAND_STAT, - CONTEXT_SW + CONTEXT_SW, }; #endif @@ -85,7 +85,8 @@ void SysTick_Handler(void) { } #endif - QTIMEEVT_TICK_X(0U, &l_SysTick_Handler); /* process time events for rate 0 */ + //QTIMEEVT_TICK_X(0U, &l_SysTick_Handler); /* process time events for rate 0 */ + QACTIVE_POST(&ticker0.super, 0, &l_SysTick_Handler); /* post to ticker0 */ /* Perform the debouncing of buttons. The algorithm for debouncing * adapted from the book "Embedded Systems Dictionary" by Jack Ganssle @@ -129,8 +130,63 @@ void USART3_IRQHandler(void) { } #endif +/* BSP functions ===========================================================*/ +/*..........................................................................*/ +/* MPU setup for STM32H743ZI MCU */ +static void STM32H743ZI_MPU_setup(void) { + /* The following MPU configuration contains just a generic ROM + * region (with read-only access) and NULL-pointer protection region. + * Otherwise, the MPU will fall back on the background region (PRIVDEFENA). + */ + static struct { + uint32_t rbar; + uint32_t rasr; + } const mpu_setup[] = { + + { /* region #0: Flash: base=0x0000'0000, size=512M=2^(28+1) */ + 0x00000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 0U), /* region #0 */ + (28U << MPU_RASR_SIZE_Pos) /* 2^(18+1) region */ + | (0x6U << MPU_RASR_AP_Pos) /* PA:ro/UA:ro */ + | (1U << MPU_RASR_C_Pos) /* C=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #7: NULL-pointer: base=0x000'0000, size=128M=2^(26+1) */ + /* NOTE: this region extends to 0x080'0000, which is where + * the ROM is re-mapped by STM32 + */ + 0x00000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 7U), /* region #7 */ + (26U << MPU_RASR_SIZE_Pos) /* 2^(26+1)=128M region */ + | (0x0U << MPU_RASR_AP_Pos) /* PA:na/UA:na */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + }; + + /* enable the MemManage_Handler for MPU exception */ + SCB->SHCSR |= SCB_SHCSR_MEMFAULTENA_Msk; + + __DSB(); + MPU->CTRL = 0U; /* disable the MPU */ + for (uint_fast8_t n = 0U; n < Q_DIM(mpu_setup); ++n) { + MPU->RBAR = mpu_setup[n].rbar; + MPU->RASR = mpu_setup[n].rasr; + } + MPU->CTRL = MPU_CTRL_ENABLE_Msk /* enable the MPU */ + | MPU_CTRL_PRIVDEFENA_Msk; /* enable background region */ + __ISB(); + __DSB(); +} + /*..........................................................................*/ void BSP_init(void) { + /* setup the MPU... */ + STM32H743ZI_MPU_setup(); + /* NOTE: SystemInit() has been already called from the startup code * but SystemCoreClock needs to be updated */ @@ -167,6 +223,7 @@ void BSP_init(void) { QS_OBJ_DICTIONARY(AO_Philo[2]); QS_OBJ_DICTIONARY(AO_Philo[3]); QS_OBJ_DICTIONARY(AO_Philo[4]); + QS_OBJ_DICTIONARY(&ticker0); QS_OBJ_DICTIONARY(&l_SysTick_Handler); QS_USR_DICTIONARY(PHILO_STAT); @@ -175,8 +232,8 @@ void BSP_init(void) { QS_USR_DICTIONARY(CONTEXT_SW); /* setup the QS filters... */ - QS_GLB_FILTER(QS_SM_RECORDS); - QS_GLB_FILTER(QS_UA_RECORDS); + QS_GLB_FILTER(QS_ALL_RECORDS); /* all records */ + QS_GLB_FILTER(-QS_QF_TICK); /* exclude the clock tick */ } /*..........................................................................*/ void BSP_ledOn(void) { @@ -238,18 +295,15 @@ void BSP_terminate(int16_t result) { /*..........................................................................*/ void QF_onStartup(void) { - /* assing all priority bits for preemption-prio. and none to sub-prio. */ + /* assign all priority bits for preemption-prio. and none to sub-prio. + * NOTE: this might have been changed by STM32Cube. + */ NVIC_SetPriorityGrouping(0U); /* set up the SysTick timer to fire at BSP_TICKS_PER_SEC rate */ SysTick_Config(SystemCoreClock / BSP_TICKS_PER_SEC); - /* set priorities of ALL ISRs used in the system, see NOTE1 - * - * !!!!!!!!!!!!!!!!!!!!!!!!!!!! CAUTION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - * Assign a priority to EVERY ISR explicitly by calling NVIC_SetPriority(). - * DO NOT LEAVE THE ISR PRIORITIES AT THE DEFAULT VALUE! - */ + /* set priorities of ALL ISRs used in the system, see NOTE1 */ NVIC_SetPriority(USART3_IRQn, 0U); /* kernel unaware interrupt */ NVIC_SetPriority(SysTick_IRQn, QF_AWARE_ISR_CMSIS_PRI); /* ... */ @@ -262,21 +316,19 @@ void QF_onStartup(void) { /*..........................................................................*/ void QF_onCleanup(void) { } - /*..........................................................................*/ -#ifdef QK_ON_CONTEXT_SW +#ifdef QF_ON_CONTEXT_SW /* NOTE: the context-switch callback is called with interrupts DISABLED */ -void QK_onContextSw(QActive *prev, QActive *next) { - (void)prev; - if (next != (QActive *)0) { - //_impure_ptr = next->thread; /* switch to next TLS */ +void QF_onContextSw(QActive *prev, QActive *next) { + if ((prev != &ticker0.super) && (next != &ticker0.super)) { + QS_BEGIN_NOCRIT(CONTEXT_SW, 0U) /* no critical section! */ + QS_OBJ(prev); + QS_OBJ(next); + QS_END_NOCRIT() } - QS_BEGIN_NOCRIT(CONTEXT_SW, 0U) /* no critical section! */ - QS_OBJ(prev); - QS_OBJ(next); - QS_END_NOCRIT() } -#endif /* QK_ON_CONTEXT_SW */ +#endif /* QF_ON_CONTEXT_SW */ + /*..........................................................................*/ void QK_onIdle(void) { /* toggle the User LED on and then off, see NOTE2 */ @@ -345,7 +397,7 @@ Q_NORETURN Q_onAssert(char const * const module, int_t const loc) { /*..........................................................................*/ uint8_t QS_onStartup(void const *arg) { static uint8_t qsTxBuf[2*1024]; /* buffer for QS-TX channel */ - static uint8_t qsRxBuf[100]; /* buffer for QS-RX channel */ + static uint8_t qsRxBuf[256]; /* buffer for QS-RX channel */ QS_initBuf (qsTxBuf, sizeof(qsTxBuf)); QS_rxInitBuf(qsRxBuf, sizeof(qsRxBuf)); @@ -407,22 +459,15 @@ void QS_onReset(void) { void QS_onCommand(uint8_t cmdId, uint32_t param1, uint32_t param2, uint32_t param3) { - void assert_failed(char const *module, int loc); - (void)cmdId; - (void)param1; - (void)param2; - (void)param3; + Q_UNUSED_PAR(cmdId); + Q_UNUSED_PAR(param1); + Q_UNUSED_PAR(param2); + Q_UNUSED_PAR(param3); + QS_BEGIN_ID(COMMAND_STAT, 0U) /* app-specific record */ QS_U8(2, cmdId); QS_U32(8, param1); QS_END() - - if (cmdId == 10U) { - Q_ERROR(); - } - else if (cmdId == 11U) { - assert_failed("QS_onCommand", 123); - } } #endif /* Q_SPY */ diff --git a/examples/arm-cm/dpp_nucleo-h743zi/qk/gnu/Makefile b/examples/arm-cm/dpp_nucleo-h743zi/qk/gnu/Makefile index 83656950..da832168 100644 --- a/examples/arm-cm/dpp_nucleo-h743zi/qk/gnu/Makefile +++ b/examples/arm-cm/dpp_nucleo-h743zi/qk/gnu/Makefile @@ -1,13 +1,13 @@ ############################################################################## # Product: Makefile for QP/C on NUCLEO-H743ZI, QK kernel, GNU-ARM -# Last Updated for Version: 7.0.1 -# Date of the Last Update: 2022-05-23 +# Last Updated for Version: 7.2.0 +# Date of the Last Update: 2022-12-13 # # Q u a n t u m L e a P s # ------------------------ # Modern Embedded Software # -# Copyright (C) 2005-2021 Quantum Leaps, LLC. All rights reserved. +# Copyright (C) 2005 Quantum Leaps, LLC. All rights reserved. # # This program is open source software: you can redistribute it and/or # modify it under the terms of the GNU General Public License as published @@ -146,9 +146,9 @@ LIB_DIRS := LIBS := # defines -DEFINES := -DQP_API_VERSION=9999 \ +DEFINES := \ -DSTM32H743xx -DUSE_HAL_DRIVER -DUSE_STM32H7XX_NUCLEO_144 \ - -DQK_ON_CONTEXT_SW + -DQF_ON_CONTEXT_SW # ARM CPU, ARCH, FPU, and Float-ABI types... # ARM_CPU: [cortex-m0 | cortex-m0plus | cortex-m1 | cortex-m3 | cortex-m4] diff --git a/examples/arm-cm/dpp_nucleo-h743zi/qk/main.c b/examples/arm-cm/dpp_nucleo-h743zi/qk/main.c index a6a6a7cc..3e07268c 100644 --- a/examples/arm-cm/dpp_nucleo-h743zi/qk/main.c +++ b/examples/arm-cm/dpp_nucleo-h743zi/qk/main.c @@ -1,42 +1,43 @@ -/***************************************************************************** -* Product: DPP example -* Last updated for version 7.1.1 -* Last updated on 2022-09-22 -* -* Q u a n t u m L e a P s -* ------------------------ -* Modern Embedded Software -* +/*============================================================================ +* QP/C Real-Time Embedded Framework (RTEF) * Copyright (C) 2005 Quantum Leaps, LLC. All rights reserved. * -* This program is open source software: you can redistribute it and/or -* modify it under the terms of the GNU General Public License as published -* by the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. +* SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-QL-commercial * -* 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 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. * -* 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. +* The terms of the open source GNU General Public License version 3 +* can be found at: * -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . +* 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: 2022-12-25 +* @version Last updated for: @ref qpc_7_2_0 +* +* @file +* @brief DPP example +*/ #include "qpc.h" #include "dpp.h" #include "bsp.h" Q_DEFINE_THIS_FILE +/*..........................................................................*/ +QTicker ticker0; /* global ticker0 AO */ + /*..........................................................................*/ int main() { static QEvt const *tableQueueSto[N_PHILO]; @@ -64,9 +65,16 @@ int main() { 0U, /* size of the stack [bytes] */ (void *)0); /* initialization param */ } + + /* example of prioritizing the Ticker0 active object */ + QTicker_ctor(&ticker0, 0U); /* ticker AO for tick rate 0 */ + QACTIVE_START(&ticker0.super, N_PHILO + 1U, + 0, 0, 0, 0, 0); /* not used */ + QS_LOC_FILTER(-ticker0.super.prio); /* don't trace ticker0 */ + Table_ctor(); /* instantiate the Table active object */ QACTIVE_START(AO_Table, /* AO to start */ - N_PHILO + 1U, /* QF-prio/pre-thre. */ + N_PHILO + 2U, /* QF-prio/pre-thre. */ tableQueueSto, /* event queue storage */ Q_DIM(tableQueueSto), /* queue length [events] */ (void *)0, /* stack storage (not used) */ diff --git a/examples/arm-cm/dpp_nucleo-h743zi/qv/armclang/dpp-qv.uvoptx b/examples/arm-cm/dpp_nucleo-h743zi/qv/armclang/dpp-qv.uvoptx index 5cbc99ef..9e040fba 100644 --- a/examples/arm-cm/dpp_nucleo-h743zi/qv/armclang/dpp-qv.uvoptx +++ b/examples/arm-cm/dpp_nucleo-h743zi/qv/armclang/dpp-qv.uvoptx @@ -125,7 +125,7 @@ 0 ST-LINKIII-KEIL_SWO - -U0675FF504955857567065746 -O8399 -SF4000 -C0 -A0 -I0 -HNlocalhost -HP7184 -P2 -N00("ARM CoreSight SW-DP") -D00(6BA02477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8004 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20010000 -FC1000 -FN1 -FF0STM32H7x_2048.FLM -FS08000000 -FL0200000 -FP0($$Device:STM32H743ZITx$CMSIS\Flash\STM32H7x_2048.FLM) + -U0675FF504955857567065746 -O8399 -SF10000 -C0 -A0 -I0 -HNlocalhost -HP7184 -P2 -N00("ARM CoreSight SW-DP (ARM Core") -D00(6BA02477) -L00(0) -TO131090 -TC10000000 -TT10000000 -TP21 -TDS8004 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20010000 -FC1000 -FN1 -FF0STM32H7x_2048.FLM -FS08000000 -FL0200000 -FP0($$Device:STM32H743ZITx$CMSIS\Flash\STM32H7x_2048.FLM) 0 @@ -148,7 +148,24 @@ - + + + 0 + 0 + 235 + 1 +
134219106
+ 0 + 0 + 0 + 0 + 0 + 1 + ..\..\..\..\..\3rd_party\STM32CubeH7\Drivers\BSP\STM32H7xx_Nucleo_144\stm32h7xx_nucleo_144.c + + \\dpp_qv\../../../../../3rd_party/STM32CubeH7/Drivers/BSP/STM32H7xx_Nucleo_144/stm32h7xx_nucleo_144.c\235 +
+
1 diff --git a/examples/arm-cm/dpp_nucleo-h743zi/qv/armclang/dpp-qv.uvprojx b/examples/arm-cm/dpp_nucleo-h743zi/qv/armclang/dpp-qv.uvprojx index 5ab3fcec..5fd495d3 100644 --- a/examples/arm-cm/dpp_nucleo-h743zi/qv/armclang/dpp-qv.uvprojx +++ b/examples/arm-cm/dpp_nucleo-h743zi/qv/armclang/dpp-qv.uvprojx @@ -1017,7 +1017,7 @@ 3 0 0 - 0 + 1 0 0 @@ -1692,7 +1692,7 @@ 0 0 0 - 0 + 3 0 1 0 diff --git a/examples/arm-cm/dpp_nucleo-h743zi/qv/bsp.c b/examples/arm-cm/dpp_nucleo-h743zi/qv/bsp.c index d36f21e3..03699bf1 100644 --- a/examples/arm-cm/dpp_nucleo-h743zi/qv/bsp.c +++ b/examples/arm-cm/dpp_nucleo-h743zi/qv/bsp.c @@ -23,8 +23,8 @@ * ============================================================================*/ /*! -* @date Last updated on: 2022-02-25 -* @version Last updated for: @ref qpc_7_0_0 +* @date Last updated on: 2022-12-18 +* @version Last updated for: @ref qpc_7_2_0 * * @file * @brief DPP example, NUCLEO-H743ZIE board, cooperative QV kernel @@ -59,7 +59,9 @@ static uint32_t l_rnd; /* random seed */ enum AppRecords { /* application-specific trace records */ PHILO_STAT = QS_USER, - COMMAND_STAT + PAUSED_STAT, + COMMAND_STAT, + CONTEXT_SW, }; #endif @@ -81,7 +83,8 @@ void SysTick_Handler(void) { } #endif - QTIMEEVT_TICK_X(0U, &l_SysTick_Handler); /* process time events for rate 0 */ + //QTIMEEVT_TICK_X(0U, &l_SysTick_Handler); /* process time events for rate 0 */ + QACTIVE_POST(&ticker0.super, 0, &l_SysTick_Handler); /* post to ticker0 */ /* Perform the debouncing of buttons. The algorithm for debouncing * adapted from the book "Embedded Systems Dictionary" by Jack Ganssle @@ -103,6 +106,7 @@ void SysTick_Handler(void) { QACTIVE_PUBLISH(&serveEvt, &l_SysTick_Handler); } } + QV_ARM_ERRATUM_838869(); } @@ -123,8 +127,68 @@ void USART3_IRQHandler(void) { } #endif +/* BSP functions ===========================================================*/ +/*..........................................................................*/ +/* MPU setup for STM32H743ZI MCU */ +static void STM32H743ZI_MPU_setup(void) { + /* The following MPU configuration contains just a generic ROM + * region (with read-only access) and NULL-pointer protection region. + * Otherwise, the MPU will fall back on the background region (PRIVDEFENA). + */ + static struct { + uint32_t rbar; + uint32_t rasr; + } const mpu_setup[] = { + + { /* region #0: Flash: base=0x0000'0000, size=512M=2^(28+1) */ + 0x00000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 0U), /* region #0 */ + (28U << MPU_RASR_SIZE_Pos) /* 2^(18+1) region */ + | (0x6U << MPU_RASR_AP_Pos) /* PA:ro/UA:ro */ + | (1U << MPU_RASR_C_Pos) /* C=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #7: NULL-pointer: base=0x000'0000, size=128M=2^(26+1) */ + /* NOTE: this region extends to 0x080'0000, which is where + * the ROM is re-mapped by STM32 + */ + 0x00000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 7U), /* region #7 */ + (26U << MPU_RASR_SIZE_Pos) /* 2^(26+1)=128M region */ + | (0x0U << MPU_RASR_AP_Pos) /* PA:na/UA:na */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + }; + + /* enable the MemManage_Handler for MPU exception */ + SCB->SHCSR |= SCB_SHCSR_MEMFAULTENA_Msk; + + __DSB(); + MPU->CTRL = 0U; /* disable the MPU */ + for (uint_fast8_t n = 0U; n < Q_DIM(mpu_setup); ++n) { + MPU->RBAR = mpu_setup[n].rbar; + MPU->RASR = mpu_setup[n].rasr; + } + MPU->CTRL = MPU_CTRL_ENABLE_Msk /* enable the MPU */ + | MPU_CTRL_PRIVDEFENA_Msk; /* enable background region */ + __ISB(); + __DSB(); +} + /*..........................................................................*/ void BSP_init(void) { + /* setup the MPU... */ + STM32H743ZI_MPU_setup(); + + /* NOTE: SystemInit() has been already called from the startup code + * but SystemCoreClock needs to be updated + */ + SystemCoreClockUpdate(); + SCB_EnableICache(); /* Enable I-Cache */ SCB_EnableDCache(); /* Enable D-Cache */ @@ -144,7 +208,8 @@ void BSP_init(void) { //... BSP_randomSeed(1234U); - if (QS_INIT((void *)0) == 0) { /* initialize the QS software tracing */ + /* initialize the QS software tracing... */ + if (QS_INIT((void *)0) == 0) { Q_ERROR(); } @@ -155,14 +220,17 @@ void BSP_init(void) { QS_OBJ_DICTIONARY(AO_Philo[2]); QS_OBJ_DICTIONARY(AO_Philo[3]); QS_OBJ_DICTIONARY(AO_Philo[4]); + QS_OBJ_DICTIONARY(&ticker0); QS_OBJ_DICTIONARY(&l_SysTick_Handler); QS_USR_DICTIONARY(PHILO_STAT); + QS_USR_DICTIONARY(PAUSED_STAT); QS_USR_DICTIONARY(COMMAND_STAT); + QS_USR_DICTIONARY(CONTEXT_SW); /* setup the QS filters... */ - QS_GLB_FILTER(QS_SM_RECORDS); - QS_GLB_FILTER(QS_UA_RECORDS); + QS_GLB_FILTER(QS_ALL_RECORDS); /* all records */ + QS_GLB_FILTER(-QS_QF_TICK); /* exclude the clock tick */ } /*..........................................................................*/ void BSP_ledOn(void) { @@ -230,12 +298,7 @@ void QF_onStartup(void) { /* set up the SysTick timer to fire at BSP_TICKS_PER_SEC rate */ SysTick_Config(SystemCoreClock / BSP_TICKS_PER_SEC); - /* set priorities of ALL ISRs used in the system, see NOTE1 - * - * !!!!!!!!!!!!!!!!!!!!!!!!!!!! CAUTION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - * Assign a priority to EVERY ISR explicitly by calling NVIC_SetPriority(). - * DO NOT LEAVE THE ISR PRIORITIES AT THE DEFAULT VALUE! - */ + /* set priorities of ALL ISRs used in the system, see NOTE1 */ NVIC_SetPriority(USART3_IRQn, 0U); /* kernel unaware interrupt */ NVIC_SetPriority(SysTick_IRQn, QF_AWARE_ISR_CMSIS_PRI); /* ... */ @@ -248,6 +311,18 @@ void QF_onStartup(void) { /*..........................................................................*/ void QF_onCleanup(void) { } +/*..........................................................................*/ +#ifdef QF_ON_CONTEXT_SW +/* NOTE: the context-switch callback is called with interrupts DISABLED */ +void QF_onContextSw(QActive *prev, QActive *next) { + if ((prev != &ticker0.super) && (next != &ticker0.super)) { + QS_BEGIN_NOCRIT(CONTEXT_SW, 0U) /* no critical section! */ + QS_OBJ(prev); + QS_OBJ(next); + QS_END_NOCRIT() + } +} +#endif /* QF_ON_CONTEXT_SW */ /*..........................................................................*/ void QV_onIdle(void) { /* CATION: called with interrupts DISABLED, NOTE01 */ @@ -318,8 +393,8 @@ Q_NORETURN Q_onAssert(char const * const module, int_t const loc) { #ifdef Q_SPY /*..........................................................................*/ uint8_t QS_onStartup(void const *arg) { - static uint8_t qsTxBuf[1024]; /* buffer for QS-TX channel */ - static uint8_t qsRxBuf[256]; /* buffer for QS-RX channel */ + static uint8_t qsTxBuf[2*1024]; /* buffer for QS-TX channel */ + static uint8_t qsRxBuf[256]; /* buffer for QS-RX channel */ QS_initBuf (qsTxBuf, sizeof(qsTxBuf)); QS_rxInitBuf(qsRxBuf, sizeof(qsRxBuf)); @@ -381,22 +456,15 @@ void QS_onReset(void) { void QS_onCommand(uint8_t cmdId, uint32_t param1, uint32_t param2, uint32_t param3) { - void assert_failed(char const *module, int loc); - (void)cmdId; - (void)param1; - (void)param2; - (void)param3; + Q_UNUSED_PAR(cmdId); + Q_UNUSED_PAR(param1); + Q_UNUSED_PAR(param2); + Q_UNUSED_PAR(param3); + QS_BEGIN_ID(COMMAND_STAT, 0U) /* app-specific record */ QS_U8(2, cmdId); QS_U32(8, param1); QS_END() - - if (cmdId == 10U) { - Q_ERROR(); - } - else if (cmdId == 11U) { - assert_failed("QS_onCommand", 123); - } } #endif /* Q_SPY */ diff --git a/examples/arm-cm/dpp_nucleo-h743zi/qv/gnu/Makefile b/examples/arm-cm/dpp_nucleo-h743zi/qv/gnu/Makefile index 06fa4dea..83be1e83 100644 --- a/examples/arm-cm/dpp_nucleo-h743zi/qv/gnu/Makefile +++ b/examples/arm-cm/dpp_nucleo-h743zi/qv/gnu/Makefile @@ -1,7 +1,7 @@ ############################################################################## # Product: Makefile for QP/C on NUCLEO-H743ZI, QV kernel, GNU-ARM -# Last Updated for Version: 7.0.1 -# Date of the Last Update: 2022-05-23 +# Last Updated for Version: 7.2.0 +# Date of the Last Update: 2022-12-15 # # Q u a n t u m L e a P s # ------------------------ @@ -146,7 +146,10 @@ LIB_DIRS := LIBS := # defines -DEFINES := -DSTM32H743xx -DUSE_HAL_DRIVER -DUSE_STM32H7XX_NUCLEO_144 +DEFINES := -DSTM32H743xx \ + -DUSE_HAL_DRIVER \ + -DUSE_STM32H7XX_NUCLEO_144 \ + -DQF_ON_CONTEXT_SW # ARM CPU, ARCH, FPU, and Float-ABI types... # ARM_CPU: [cortex-m0 | cortex-m0plus | cortex-m1 | cortex-m3 | cortex-m4] diff --git a/examples/arm-cm/dpp_nucleo-h743zi/qv/iar/dpp-qv.ewp b/examples/arm-cm/dpp_nucleo-h743zi/qv/iar/dpp-qv.ewp index 6744dd74..f90666c5 100644 --- a/examples/arm-cm/dpp_nucleo-h743zi/qv/iar/dpp-qv.ewp +++ b/examples/arm-cm/dpp_nucleo-h743zi/qv/iar/dpp-qv.ewp @@ -3171,6 +3171,9 @@ + + Release + Application diff --git a/examples/arm-cm/dpp_nucleo-h743zi/qv/main.c b/examples/arm-cm/dpp_nucleo-h743zi/qv/main.c index 5a601fa3..ba8fee04 100644 --- a/examples/arm-cm/dpp_nucleo-h743zi/qv/main.c +++ b/examples/arm-cm/dpp_nucleo-h743zi/qv/main.c @@ -23,8 +23,8 @@ * ============================================================================*/ /*! -* @date Last updated on: 2022-02-25 -* @version Last updated for: @ref qpc_7_0_0 +* @date Last updated on: 2022-12-25 +* @version Last updated for: @ref qpc_7_2_0 * * @file * @brief DPP example @@ -35,6 +35,9 @@ Q_DEFINE_THIS_FILE +/*..........................................................................*/ +QTicker ticker0; /* global ticker0 AO */ + /*..........................................................................*/ int main() { static QEvt const *tableQueueSto[N_PHILO]; @@ -54,22 +57,29 @@ int main() { /* start the active objects... */ Philo_ctor(); /* instantiate all Philosopher active objects */ for (uint8_t n = 0U; n < N_PHILO; ++n) { - QACTIVE_START(AO_Philo[n], /* AO to start */ - n + 1U, /* QP priority of the AO */ - philoQueueSto[n], /* event queue storage */ - Q_DIM(philoQueueSto[n]), /* queue length [events] */ - (void *)0, /* stack storage (not used) */ - 0U, /* size of the stack [bytes] */ - (QEvt *)0); /* initialization event */ + QACTIVE_START(AO_Philo[n], /* AO to start */ + n + 1U, /* QP priority of the AO */ + philoQueueSto[n], /* event queue storage */ + Q_DIM(philoQueueSto[n]), /* queue length [events] */ + (void *)0, /* stack storage (not used) */ + 0U, /* size of the stack [bytes] */ + (void *)0); /* initialization param */ } + + /* example of prioritizing the Ticker0 active object */ + QTicker_ctor(&ticker0, 0U); /* ticker AO for tick rate 0 */ + QACTIVE_START(&ticker0.super, N_PHILO + 1U, + 0, 0, 0, 0, 0); /* not used */ + QS_LOC_FILTER(-ticker0.super.prio); /* don't trace ticker0 */ + Table_ctor(); /* instantiate the Table active object */ - QACTIVE_START(AO_Table, /* AO to start */ - N_PHILO + 1U, /* QP priority of the AO */ - tableQueueSto, /* event queue storage */ - Q_DIM(tableQueueSto), /* queue length [events] */ - (void *)0, /* stack storage (not used) */ - 0U, /* size of the stack [bytes] */ - (QEvt *)0); /* initialization event */ + QACTIVE_START(AO_Table, /* AO to start */ + N_PHILO + 2U, /* QP priority of the AO */ + tableQueueSto, /* event queue storage */ + Q_DIM(tableQueueSto), /* queue length [events] */ + (void *)0, /* stack storage (not used) */ + 0U, /* size of the stack [bytes] */ + (void *)0); /* initialization param */ return QF_run(); /* run the QF application */ } diff --git a/examples/arm-cm/dpp_nucleo-h743zi/qxk/armclang/dpp-qxk.uvoptx b/examples/arm-cm/dpp_nucleo-h743zi/qxk/armclang/dpp-qxk.uvoptx index 7f8d52ef..8e0d778e 100644 --- a/examples/arm-cm/dpp_nucleo-h743zi/qxk/armclang/dpp-qxk.uvoptx +++ b/examples/arm-cm/dpp_nucleo-h743zi/qxk/armclang/dpp-qxk.uvoptx @@ -544,36 +544,27 @@ 0 0 - 279 + 327 1 -
0
+
134242960
0 0 0 0 0 - 0 + 1 ..\bsp.c - -
- - 1 - 0 - 280 - 1 -
0
- 0 - 0 - 0 - 0 - 0 - 0 - ..\bsp.c - - + \\dpp_qxk\../bsp.c\327
+ + + 0 + 1 + ticker0 + + 1 diff --git a/examples/arm-cm/dpp_nucleo-h743zi/qxk/armclang/dpp-qxk.uvprojx b/examples/arm-cm/dpp_nucleo-h743zi/qxk/armclang/dpp-qxk.uvprojx index 387d33c7..990cc375 100644 --- a/examples/arm-cm/dpp_nucleo-h743zi/qxk/armclang/dpp-qxk.uvprojx +++ b/examples/arm-cm/dpp_nucleo-h743zi/qxk/armclang/dpp-qxk.uvprojx @@ -1747,7 +1747,7 @@ 0 -Wno-padded - Q_SPY,QXK_ON_CONTEXT_SW,STM32H743xx,USE_HAL_DRIVER,USE_STM32H7XX_NUCLEO_144 + Q_SPY,QF_ON_CONTEXT_SW,STM32H743xx,USE_HAL_DRIVER,USE_STM32H7XX_NUCLEO_144 ..\..;..\..\..\..\..\include;..\..\..\..\..\ports\arm-cm\qxk\armclang;..\..\..\..\..\3rd_party\CMSIS\Include;..\..\..\..\..\3rd_party\STM32CubeH7\Drivers\CMSIS\Device\ST/STM32H7xx\Include;..\..\..\..\..\3rd_party\STM32CubeH7\Drivers\BSP\STM32H7xx_Nucleo_144;..\..\..\..\..\3rd_party\STM32CubeH7\Drivers\STM32H7xx_HAL_Driver\Inc diff --git a/examples/arm-cm/dpp_nucleo-h743zi/qxk/bsp.c b/examples/arm-cm/dpp_nucleo-h743zi/qxk/bsp.c index 86c84bef..1209bb44 100644 --- a/examples/arm-cm/dpp_nucleo-h743zi/qxk/bsp.c +++ b/examples/arm-cm/dpp_nucleo-h743zi/qxk/bsp.c @@ -23,8 +23,8 @@ * ============================================================================*/ /*! -* @date Last updated on: 2022-02-25 -* @version Last updated for: @ref qpc_7_0_0 +* @date Last updated on: 2022-12-18 +* @version Last updated for: @ref qpc_7_2_0 * * @file * @brief DPP example, NUCLEO-H743ZIE board, dual-mode QXK kernel @@ -131,8 +131,63 @@ void USART3_IRQHandler(void) { } #endif +/* BSP functions ===========================================================*/ +/*..........................................................................*/ +/* MPU setup for STM32H743ZI MCU */ +static void STM32H743ZI_MPU_setup(void) { + /* The following MPU configuration contains just a generic ROM + * region (with read-only access) and NULL-pointer protection region. + * Otherwise, the MPU will fall back on the background region (PRIVDEFENA). + */ + static struct { + uint32_t rbar; + uint32_t rasr; + } const mpu_setup[] = { + + { /* region #0: Flash: base=0x0000'0000, size=512M=2^(28+1) */ + 0x00000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 0U), /* region #0 */ + (28U << MPU_RASR_SIZE_Pos) /* 2^(18+1) region */ + | (0x6U << MPU_RASR_AP_Pos) /* PA:ro/UA:ro */ + | (1U << MPU_RASR_C_Pos) /* C=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #7: NULL-pointer: base=0x000'0000, size=128M=2^(26+1) */ + /* NOTE: this region extends to 0x080'0000, which is where + * the ROM is re-mapped by STM32 + */ + 0x00000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 7U), /* region #7 */ + (26U << MPU_RASR_SIZE_Pos) /* 2^(26+1)=128M region */ + | (0x0U << MPU_RASR_AP_Pos) /* PA:na/UA:na */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + }; + + /* enable the MemManage_Handler for MPU exception */ + SCB->SHCSR |= SCB_SHCSR_MEMFAULTENA_Msk; + + __DSB(); + MPU->CTRL = 0U; /* disable the MPU */ + for (uint_fast8_t n = 0U; n < Q_DIM(mpu_setup); ++n) { + MPU->RBAR = mpu_setup[n].rbar; + MPU->RASR = mpu_setup[n].rasr; + } + MPU->CTRL = MPU_CTRL_ENABLE_Msk /* enable the MPU */ + | MPU_CTRL_PRIVDEFENA_Msk; /* enable background region */ + __ISB(); + __DSB(); +} + /*..........................................................................*/ void BSP_init(void) { + /* setup the MPU... */ + STM32H743ZI_MPU_setup(); + /* NOTE: SystemInit() has been already called from the startup code * but SystemCoreClock needs to be updated */ @@ -181,8 +236,8 @@ void BSP_init(void) { QS_USR_DICTIONARY(CONTEXT_SW); /* setup the QS filters... */ - QS_GLB_FILTER(QS_SM_RECORDS); - QS_GLB_FILTER(QS_UA_RECORDS); + QS_GLB_FILTER(QS_ALL_RECORDS); /* all records */ + QS_GLB_FILTER(-QS_QF_TICK); /* exclude the clock tick */ } /*..........................................................................*/ void BSP_ledOn(void) { @@ -244,18 +299,13 @@ void BSP_terminate(int16_t result) { /*..........................................................................*/ void QF_onStartup(void) { - /* assing all priority bits for preemption-prio. and none to sub-prio. */ + /* assign all priority bits for preemption-prio. and none to sub-prio. */ NVIC_SetPriorityGrouping(0U); /* set up the SysTick timer to fire at BSP_TICKS_PER_SEC rate */ SysTick_Config(SystemCoreClock / BSP_TICKS_PER_SEC); - /* set priorities of ALL ISRs used in the system, see NOTE1 - * - * !!!!!!!!!!!!!!!!!!!!!!!!!!!! CAUTION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - * Assign a priority to EVERY ISR explicitly by calling NVIC_SetPriority(). - * DO NOT LEAVE THE ISR PRIORITIES AT THE DEFAULT VALUE! - */ + /* set priorities of ALL ISRs used in the system, see NOTE1 */ NVIC_SetPriority(USART3_IRQn, 0U); /* kernel unaware interrupt */ NVIC_SetPriority(SysTick_IRQn, QF_AWARE_ISR_CMSIS_PRI); /* ... */ @@ -270,19 +320,18 @@ void QF_onCleanup(void) { } /*..........................................................................*/ -#ifdef QXK_ON_CONTEXT_SW +#ifdef QF_ON_CONTEXT_SW /* NOTE: the context-switch callback is called with interrupts DISABLED */ -void QXK_onContextSw(QActive *prev, QActive *next) { - (void)prev; - if (next != (QActive *)0) { - //_impure_ptr = next->thread; /* switch to next TLS */ +void QF_onContextSw(QActive *prev, QActive *next) { + if ((prev != &ticker0.super) && (next != &ticker0.super)) { + QS_BEGIN_NOCRIT(CONTEXT_SW, 0U) /* no critical section! */ + QS_OBJ(prev); + QS_OBJ(next); + QS_END_NOCRIT() } - QS_BEGIN_NOCRIT(CONTEXT_SW, 0U) /* no critical section! */ - QS_OBJ(prev); - QS_OBJ(next); - QS_END_NOCRIT() } -#endif /* QXK_ON_CONTEXT_SW */ +#endif /* QF_ON_CONTEXT_SW */ + /*..........................................................................*/ void QXK_onIdle(void) { /* toggle the User LED on and then off, see NOTE2 */ @@ -351,7 +400,7 @@ Q_NORETURN Q_onAssert(char const * const module, int_t const loc) { /*..........................................................................*/ uint8_t QS_onStartup(void const *arg) { static uint8_t qsTxBuf[2*1024]; /* buffer for QS-TX channel */ - static uint8_t qsRxBuf[100]; /* buffer for QS-RX channel */ + static uint8_t qsRxBuf[256]; /* buffer for QS-RX channel */ QS_initBuf (qsTxBuf, sizeof(qsTxBuf)); QS_rxInitBuf(qsRxBuf, sizeof(qsRxBuf)); @@ -413,22 +462,15 @@ void QS_onReset(void) { void QS_onCommand(uint8_t cmdId, uint32_t param1, uint32_t param2, uint32_t param3) { - void assert_failed(char const *module, int loc); - (void)cmdId; - (void)param1; - (void)param2; - (void)param3; + Q_UNUSED_PAR(cmdId); + Q_UNUSED_PAR(param1); + Q_UNUSED_PAR(param2); + Q_UNUSED_PAR(param3); + QS_BEGIN_ID(COMMAND_STAT, 0U) /* app-specific record */ QS_U8(2, cmdId); QS_U32(8, param1); QS_END() - - if (cmdId == 10U) { - Q_ERROR(); - } - else if (cmdId == 11U) { - assert_failed("QS_onCommand", 123); - } } #endif /* Q_SPY */ diff --git a/examples/arm-cm/dpp_nucleo-h743zi/qxk/gnu/Makefile b/examples/arm-cm/dpp_nucleo-h743zi/qxk/gnu/Makefile index 60690c13..89c2b7d3 100644 --- a/examples/arm-cm/dpp_nucleo-h743zi/qxk/gnu/Makefile +++ b/examples/arm-cm/dpp_nucleo-h743zi/qxk/gnu/Makefile @@ -1,13 +1,13 @@ ############################################################################## # Product: Makefile for QP/C on NUCLEO-H743ZI, QXK kernel, GNU-ARM -# Last Updated for Version: 7.0.1 -# Date of the Last Update: 2022-05-23 +# Last Updated for Version: 7.2.0 +# Date of the Last Update: 2022-12-13 # # Q u a n t u m L e a P s # ------------------------ # Modern Embedded Software # -# Copyright (C) 2005-2021 Quantum Leaps, LLC. All rights reserved. +# Copyright (C) 2005 Quantum Leaps, LLC. All rights reserved. # # This program is open source software: you can redistribute it and/or # modify it under the terms of the GNU General Public License as published @@ -150,7 +150,7 @@ LIB_DIRS := LIBS := # defines -DEFINES := -DQXK_ON_CONTEXT_SW -DSTM32H743xx -DUSE_HAL_DRIVER -DUSE_STM32H7XX_NUCLEO_144 +DEFINES := -DQF_ON_CONTEXT_SW -DSTM32H743xx -DUSE_HAL_DRIVER -DUSE_STM32H7XX_NUCLEO_144 # ARM CPU, ARCH, FPU, and Float-ABI types... # ARM_CPU: [cortex-m0 | cortex-m0plus | cortex-m1 | cortex-m3 | cortex-m4] diff --git a/examples/arm-cm/dpp_nucleo-h743zi/qxk/iar/dpp-qxk.ewp b/examples/arm-cm/dpp_nucleo-h743zi/qxk/iar/dpp-qxk.ewp index b22a8fa3..ec76fd0a 100644 --- a/examples/arm-cm/dpp_nucleo-h743zi/qxk/iar/dpp-qxk.ewp +++ b/examples/arm-cm/dpp_nucleo-h743zi/qxk/iar/dpp-qxk.ewp @@ -214,7 +214,7 @@
diff --git a/examples/arm-cm/dpp_nucleo-l053r8/qk/armclang/dpp-qk.uvprojx b/examples/arm-cm/dpp_nucleo-l053r8/qk/armclang/dpp-qk.uvprojx index 5672f721..18bd9d97 100644 --- a/examples/arm-cm/dpp_nucleo-l053r8/qk/armclang/dpp-qk.uvprojx +++ b/examples/arm-cm/dpp_nucleo-l053r8/qk/armclang/dpp-qk.uvprojx @@ -313,7 +313,7 @@ 0 - 7 + 0 0 0 1 diff --git a/examples/arm-cm/dpp_nucleo-l053r8/qk/bsp.c b/examples/arm-cm/dpp_nucleo-l053r8/qk/bsp.c index 7af1811d..382e9b59 100644 --- a/examples/arm-cm/dpp_nucleo-l053r8/qk/bsp.c +++ b/examples/arm-cm/dpp_nucleo-l053r8/qk/bsp.c @@ -1,7 +1,7 @@ -/***************************************************************************** +/*============================================================================ * Product: DPP example, NUCLEO-L053R8 board, preemptive QK kernel -* Last updated for version 6.9.3 -* Last updated on 2021-03-03 +* Last updated for version 7.2.0 +* Last updated on 2022-12-13 * * Q u a n t u m L e a P s * ------------------------ @@ -30,7 +30,7 @@ * Contact information: * * -*****************************************************************************/ +============================================================================*/ #include "qpc.h" #include "dpp.h" #include "bsp.h" @@ -107,7 +107,7 @@ void SysTick_Handler(void) { /* system clock tick ISR */ static QEvt const pauseEvt = { PAUSE_SIG, 0U, 0U}; QACTIVE_PUBLISH(&pauseEvt, &l_SysTick_Handler); } - else { /* the button is released */ + else { /* the button is released */ static QEvt const serveEvt = { SERVE_SIG, 0U, 0U}; QACTIVE_PUBLISH(&serveEvt, &l_SysTick_Handler); } @@ -136,7 +136,128 @@ void USART2_IRQHandler(void) { /* used in QS-RX (kernel UNAWARE interrutp) */ #endif /* BSP functions ===========================================================*/ +/*..........................................................................*/ +/* MPU setup for STM32L053R8 MCU */ +static void STM32L053R8_MPU_setup(void) { + /* The following MPU configuration contains the general STM32 memory model + * as described in the ST AppNote AN4838 "Managing memory protection unit + * in STM32 MCUs", Figure 2. Cortex-M0+/M3/M4/M7 processor memory map. + * + * Please note that the actual STM32 MCUs provide much less Flash and SRAM + * than the maximums configured here. This means that actual MCUs have + * unmapped memory regions (e.g., beyond the actual SRAM). Attempts to + * access these regions causes the HardFault exception, which is the + * desired behavior. + */ + static struct { + uint32_t rbar; + uint32_t rasr; + } const mpu_setup[] = { + + { /* region #0: Flash: base=0x0000'0000, size=512M=2^(28+1) */ + 0x00000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 0U), /* region #0 */ + (28U << MPU_RASR_SIZE_Pos) /* 2^(18+1) region */ + | (0x6U << MPU_RASR_AP_Pos) /* PA:ro/UA:ro */ + | (1U << MPU_RASR_C_Pos) /* C=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #1: SRAM: base=0x2000'0000, size=512M=2^(28+1) */ + 0x20000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 1U), /* region #1 */ + (28U << MPU_RASR_SIZE_Pos) /* 2^(28+1) region */ + | (0x3U << MPU_RASR_AP_Pos) /* PA:rw/UA:rw */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | (1U << MPU_RASR_S_Pos) /* S=1 */ + | (1U << MPU_RASR_C_Pos) /* C=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + /* region #3: (not configured) */ + { MPU_RBAR_VALID_Msk | (MPU_RBAR_REGION_Msk & 2U), 0U }, + + { /* region #3: Peripherals: base=0x4000'0000, size=512M=2^(28+1) */ + 0x40000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 3U), /* region #3 */ + (28U << MPU_RASR_SIZE_Pos) /* 2^(28+1) region */ + | (0x3U << MPU_RASR_AP_Pos) /* PA:rw/UA:rw */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | (1U << MPU_RASR_S_Pos) /* S=1 */ + | (1U << MPU_RASR_B_Pos) /* B=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #4: Priv. Periph: base=0xE000'0000, size=512M=2^(28+1) */ + 0xE0000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 4U), /* region #4 */ + (28U << MPU_RASR_SIZE_Pos) /* 2^(28+1) region */ + | (0x3U << MPU_RASR_AP_Pos) /* PA:rw/UA:rw */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | (1U << MPU_RASR_S_Pos) /* S=1 */ + | (1U << MPU_RASR_B_Pos) /* B=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #5: Ext RAM: base=0x6000'0000, size=1G=2^(29+1) */ + 0x60000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 5U), /* region #5 */ + (29U << MPU_RASR_SIZE_Pos) /* 2^(28+1) region */ + | (0x3U << MPU_RASR_AP_Pos) /* PA:rw/UA:rw */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | (1U << MPU_RASR_S_Pos) /* S=1 */ + | (1U << MPU_RASR_B_Pos) /* B=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #6: Ext Dev: base=0xA000'0000, size=1G=2^(29+1) */ + 0xA0000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 6U), /* region #6 */ + (29U << MPU_RASR_SIZE_Pos) /* 2^(28+1) region */ + | (0x3U << MPU_RASR_AP_Pos) /* PA:rw/UA:rw */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | (1U << MPU_RASR_S_Pos) /* S=1 */ + | (1U << MPU_RASR_B_Pos) /* B=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #7: NULL-pointer: base=0x000'0000, size=128M=2^(26+1) */ + /* NOTE: this region extends to 0x080'0000, which is where + * the ROM is re-mapped by STM32 + */ + 0x00000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 7U), /* region #7 */ + (26U << MPU_RASR_SIZE_Pos) /* 2^(26+1)=128M region */ + | (0x0U << MPU_RASR_AP_Pos) /* PA:na/UA:na */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + }; + + __DSB(); + MPU->CTRL = 0U; /* disable the MPU */ + for (uint_fast8_t n = 0U; n < Q_DIM(mpu_setup); ++n) { + MPU->RBAR = mpu_setup[n].rbar; + MPU->RASR = mpu_setup[n].rasr; + } + MPU->CTRL = MPU_CTRL_PRIVDEFENA_Msk /* enable background region */ + | MPU_CTRL_ENABLE_Msk; /* enable the MPU */ + __ISB(); + __DSB(); +} +/*..........................................................................*/ void BSP_init(void) { + /* setup the MPU... */ + STM32L053R8_MPU_setup(); + /* NOTE: SystemInit() has been already called from the startup code * but SystemCoreClock needs to be updated */ @@ -238,15 +359,10 @@ void QF_onStartup(void) { /* set up the SysTick timer to fire at BSP_TICKS_PER_SEC rate */ SysTick_Config(SystemCoreClock / BSP_TICKS_PER_SEC); - /* set priorities of ALL ISRs used in the system, see NOTE00 - * - * !!!!!!!!!!!!!!!!!!!!!!!!!!!! CAUTION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - * Assign a priority to EVERY ISR explicitly by calling NVIC_SetPriority(). - * DO NOT LEAVE THE ISR PRIORITIES AT THE DEFAULT VALUE! - */ - NVIC_SetPriority(SysTick_IRQn, QF_AWARE_ISR_CMSIS_PRI + 1); - NVIC_SetPriority(EXTI0_1_IRQn, QF_AWARE_ISR_CMSIS_PRI + 2); - NVIC_SetPriority(USART2_IRQn, 0); /* kernel UNAWARE interrupt */ + /* set priorities of ALL ISRs used in the system */ + NVIC_SetPriority(USART2_IRQn, 0); + NVIC_SetPriority(SysTick_IRQn, QF_AWARE_ISR_CMSIS_PRI + 0U); + NVIC_SetPriority(EXTI0_1_IRQn, QF_AWARE_ISR_CMSIS_PRI + 1U); /* ... */ /* enable IRQs... */ @@ -259,15 +375,15 @@ void QF_onStartup(void) { void QF_onCleanup(void) { } /*..........................................................................*/ -#ifdef QK_ON_CONTEXT_SW +#ifdef QF_ON_CONTEXT_SW /* NOTE: the context-switch callback is called with interrupts DISABLED */ -void QK_onContextSw(QActive *prev, QActive *next) { +void QF_onContextSw(QActive *prev, QActive *next) { QS_BEGIN_NOCRIT(CONTEXT_SW, 0U) /* no critical section! */ QS_OBJ(prev); QS_OBJ(next); QS_END_NOCRIT() } -#endif /* QK_ON_CONTEXT_SW */ +#endif /* QF_ON_CONTEXT_SW */ /*..........................................................................*/ void QK_onIdle(void) { /* called with interrupts enabled */ @@ -339,7 +455,7 @@ Q_NORETURN Q_onAssert(char const * const module, int_t const loc) { /*..........................................................................*/ uint8_t QS_onStartup(void const *arg) { static uint8_t qsBuf[2*1024]; /* buffer for Quantum Spy */ - static uint8_t qsRxBuf[128]; /* buffer for QS-RX channel */ + static uint8_t qsRxBuf[256]; /* buffer for QS-RX channel */ (void)arg; /* avoid the "unused parameter" compiler warning */ @@ -418,23 +534,6 @@ void QS_onCommand(uint8_t cmdId, /*--------------------------------------------------------------------------*/ /***************************************************************************** -* NOTE00: -* The QF_AWARE_ISR_CMSIS_PRI constant from the QF port specifies the highest -* ISR priority that is disabled by the QF framework. The value is suitable -* for the NVIC_SetPriority() CMSIS function. -* -* Only ISRs prioritized at or below the QF_AWARE_ISR_CMSIS_PRI level (i.e., -* with the numerical values of priorities equal or higher than -* QF_AWARE_ISR_CMSIS_PRI) are allowed to call any QF services. These ISRs -* are "QF-aware". -* -* Conversely, any ISRs prioritized above the QF_AWARE_ISR_CMSIS_PRI priority -* level (i.e., with the numerical values of priorities less than -* QF_AWARE_ISR_CMSIS_PRI) are never disabled and are not aware of the kernel. -* Such "QF-unaware" ISRs cannot call any QF services. The only mechanism -* by which a "QF-unaware" ISR can communicate with the QF framework is by -* triggering a "QF-aware" ISR, which can post/publish events. -* * NOTE01: * Usually, one of the LEDs is used to visualize the idle loop activity. * However, the board has not enough LEDs (only one, actually), so this diff --git a/examples/arm-cm/dpp_nucleo-l053r8/qk/gnu/Makefile b/examples/arm-cm/dpp_nucleo-l053r8/qk/gnu/Makefile index d9ff2dcc..80fe504c 100644 --- a/examples/arm-cm/dpp_nucleo-l053r8/qk/gnu/Makefile +++ b/examples/arm-cm/dpp_nucleo-l053r8/qk/gnu/Makefile @@ -1,13 +1,13 @@ ############################################################################## # Product: Makefile for QP/C on NUCLEO-L053R8, QK kernel, GNU-ARM -# Last Updated for Version: 7.0.1 -# Date of the Last Update: 2022-05-23 +# Last Updated for Version: 7.2.0 +# Date of the Last Update: 2022-12-13 # # Q u a n t u m L e a P s # ------------------------ # Modern Embedded Software # -# Copyright (C) 2005-2021 Quantum Leaps, LLC. All rights reserved. +# Copyright (C) 2005 Quantum Leaps, LLC. All rights reserved. # # This program is open source software: you can redistribute it and/or # modify it under the terms of the GNU General Public License as published @@ -133,7 +133,7 @@ LIBS := # defines DEFINES := \ - -DQK_ON_CONTEXT_SW \ + -DQF_ON_CONTEXT_SW \ -DQK_USE_IRQ_NUM=30 \ -DQK_USE_IRQ_HANDLER=LCD_IRQHandler diff --git a/examples/arm-cm/dpp_nucleo-l053r8/qk/gnu_with-stack-prot/bsp_stack-prot.c b/examples/arm-cm/dpp_nucleo-l053r8/qk/gnu_with-stack-prot/bsp_stack-prot.c index 7218cd51..28a5f087 100644 --- a/examples/arm-cm/dpp_nucleo-l053r8/qk/gnu_with-stack-prot/bsp_stack-prot.c +++ b/examples/arm-cm/dpp_nucleo-l053r8/qk/gnu_with-stack-prot/bsp_stack-prot.c @@ -62,7 +62,7 @@ static uint32_t l_rnd; /* random seed */ enum AppRecords { /* application-specific trace records */ PHILO_STAT = QS_USER, - ON_CONTEXT_SW + CONTEXT_SW }; #endif @@ -158,7 +158,7 @@ void BSP_init(void) { } QS_OBJ_DICTIONARY(&l_SysTick_Handler); QS_USR_DICTIONARY(PHILO_STAT); - QS_USR_DICTIONARY(ON_CONTEXT_SW); + QS_USR_DICTIONARY(CONTEXT_SW); /* setup the QS filters... */ QS_GLB_FILTER(QS_SM_RECORDS); @@ -242,19 +242,19 @@ void QF_onStartup(void) { void QF_onCleanup(void) { } /*..........................................................................*/ -#ifdef QK_ON_CONTEXT_SW +#ifdef QF_ON_CONTEXT_SW /* NOTE: the context-switch callback is called with interrupts DISABLED */ void QK_onContextSw(QActive *prev, QActive *next) { (void)prev; if (next != (QActive *)0) { //_impure_ptr = next->thread; /* switch to next TLS */ } - QS_BEGIN_NOCRIT(ON_CONTEXT_SW, 0U) /* no critical section! */ + QS_BEGIN_NOCRIT(CONTEXT_SW, 0U) /* no critical section! */ QS_OBJ(prev); QS_OBJ(next); QS_END_NOCRIT() } -#endif /* QK_ON_CONTEXT_SW */ +#endif /* QF_ON_CONTEXT_SW */ /*..........................................................................*/ void QK_onIdle(void) { /* called with interrupts enabled */ diff --git a/examples/arm-cm/dpp_nucleo-l053r8/qv/armclang/dpp-qv.uvoptx b/examples/arm-cm/dpp_nucleo-l053r8/qv/armclang/dpp-qv.uvoptx index 240c1eaa..d3e1a4aa 100644 --- a/examples/arm-cm/dpp_nucleo-l053r8/qv/armclang/dpp-qv.uvoptx +++ b/examples/arm-cm/dpp_nucleo-l053r8/qv/armclang/dpp-qv.uvoptx @@ -10,7 +10,7 @@ *.s*; *.src; *.a* *.obj; *.o *.lib - *.txt; *.h; *.inc + *.txt; *.h; *.inc; *.md *.plm *.cpp 0 @@ -103,7 +103,7 @@ 1 0 0 - 5 + 6 @@ -125,7 +125,7 @@ 0 ST-LINKIII-KEIL_SWO - -U066CFF484951775087074312 -O8431 -SF480 -C0 -A0 -I0 -HNlocalhost -HP7184 -P2 -N00("ARM CoreSight SW-DP") -D00(0BC11477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8004 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC800 -FN1 -FF0STM32L0xx_64.FLM -FS08000000 -FL010000 -FP0($$Device:STM32L053R8Tx$CMSIS\Flash\STM32L0xx_64.FLM) + -U066CFF484951775087074312 -O8431 -SF10000 -C0 -A0 -I0 -HNlocalhost -HP7184 -P2 -N00("ARM CoreSight SW-DP (ARM Core") -D00(0BC11477) -L00(0) -TO131090 -TC10000000 -TT10000000 -TP21 -TDS8004 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC800 -FN1 -FF0STM32L0xx_64.FLM -FS08000000 -FL010000 -FP0($$Device:STM32L053R8Tx$CMSIS\Flash\STM32L0xx_64.FLM) 0 @@ -148,7 +148,24 @@ - + + + 0 + 0 + 427 + 1 +
134224692
+ 0 + 0 + 0 + 0 + 0 + 1 + ..\bsp.c + + \\dpp_qv\../bsp.c\427 +
+
1 diff --git a/examples/arm-cm/dpp_nucleo-l053r8/qv/armclang/dpp-qv.uvprojx b/examples/arm-cm/dpp_nucleo-l053r8/qv/armclang/dpp-qv.uvprojx index e6b52e11..858419fe 100644 --- a/examples/arm-cm/dpp_nucleo-l053r8/qv/armclang/dpp-qv.uvprojx +++ b/examples/arm-cm/dpp_nucleo-l053r8/qv/armclang/dpp-qv.uvprojx @@ -10,13 +10,13 @@ dpp-dbg 0x4 ARM-ADS - 6130001::V6.13.1::.\ARMCLANG + 6160000::V6.16::ARMCLANG 1 STM32L053R8Tx STMicroelectronics - Keil.STM32L0xx_DFP.2.0.0 + Keil.STM32L0xx_DFP.2.2.0 http://www.keil.com/pack/ IRAM(0x20000000,0x00002000) IROM(0x08000000,0x00010000) CPUTYPE("Cortex-M0+") CLOCK(12000000) ELITTLE @@ -185,6 +185,7 @@ 0 0 0 + 0 0 0 8 @@ -312,7 +313,7 @@ 0 - 2 + 1 0 0 1 @@ -351,7 +352,7 @@ 0 1 0 - 0 + 4 Stack_Size=2048 Heap_Size=16 @@ -615,7 +616,7 @@ 2 2 2 - 2 + 0 @@ -665,7 +666,7 @@ STM32L053R8Tx STMicroelectronics - Keil.STM32L0xx_DFP.2.0.0 + Keil.STM32L0xx_DFP.2.2.0 http://www.keil.com/pack/ IRAM(0x20000000,0x00002000) IROM(0x08000000,0x00010000) CPUTYPE("Cortex-M0+") CLOCK(12000000) ELITTLE @@ -834,6 +835,7 @@ 0 0 0 + 0 0 0 8 @@ -1000,7 +1002,7 @@ 0 1 0 - 0 + 4 Stack_Size=2048 Heap_Size=16 @@ -1264,7 +1266,7 @@ 2 2 2 - 2 + 0 @@ -1314,7 +1316,7 @@ STM32L053R8Tx STMicroelectronics - Keil.STM32L0xx_DFP.2.0.0 + Keil.STM32L0xx_DFP.2.2.0 http://www.keil.com/pack/ IRAM(0x20000000,0x00002000) IROM(0x08000000,0x00010000) CPUTYPE("Cortex-M0+") CLOCK(12000000) ELITTLE @@ -1483,6 +1485,7 @@ 0 0 0 + 0 0 0 8 @@ -1649,7 +1652,7 @@ 0 1 0 - 0 + 4 Stack_Size=2048 Heap_Size=16 diff --git a/examples/arm-cm/dpp_nucleo-l053r8/qv/bsp.c b/examples/arm-cm/dpp_nucleo-l053r8/qv/bsp.c index a4f38cbe..b0077830 100644 --- a/examples/arm-cm/dpp_nucleo-l053r8/qv/bsp.c +++ b/examples/arm-cm/dpp_nucleo-l053r8/qv/bsp.c @@ -1,7 +1,7 @@ -/***************************************************************************** +/*============================================================================ * Product: DPP example, NUCLEO-L053R8 board, cooperative QV kernel -* Last updated for version 6.9.3 -* Last updated on 2021-03-03 +* Last updated for version 7.2.0 +* Last updated on 2022-12-13 * * Q u a n t u m L e a P s * ------------------------ @@ -30,7 +30,7 @@ * Contact information: * * -*****************************************************************************/ +============================================================================*/ #include "qpc.h" #include "dpp.h" #include "bsp.h" @@ -57,7 +57,8 @@ static uint32_t l_rnd; /* random seed */ static QSpyId const l_SysTick_Handler = { 0U }; enum AppRecords { /* application-specific trace records */ - PHILO_STAT = QS_USER + PHILO_STAT = QS_USER, + CONTEXT_SW, }; #endif @@ -130,7 +131,128 @@ void USART2_IRQHandler(void) { /* used in QS-RX (kernel UNAWARE interrutp) */ #endif /* BSP functions ===========================================================*/ +/*..........................................................................*/ +/* MPU setup for STM32L053R8 MCU */ +static void STM32L053R8_MPU_setup(void) { + /* The following MPU configuration contains the general STM32 memory model + * as described in the ST AppNote AN4838 "Managing memory protection unit + * in STM32 MCUs", Figure 2. Cortex-M0+/M3/M4/M7 processor memory map. + * + * Please note that the actual STM32 MCUs provide much less Flash and SRAM + * than the maximums configured here. This means that actual MCUs have + * unmapped memory regions (e.g., beyond the actual SRAM). Attempts to + * access these regions causes the HardFault exception, which is the + * desired behavior. + */ + static struct { + uint32_t rbar; + uint32_t rasr; + } const mpu_setup[] = { + + { /* region #0: Flash: base=0x0000'0000, size=512M=2^(28+1) */ + 0x00000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 0U), /* region #0 */ + (28U << MPU_RASR_SIZE_Pos) /* 2^(18+1) region */ + | (0x6U << MPU_RASR_AP_Pos) /* PA:ro/UA:ro */ + | (1U << MPU_RASR_C_Pos) /* C=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #1: SRAM: base=0x2000'0000, size=512M=2^(28+1) */ + 0x20000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 1U), /* region #1 */ + (28U << MPU_RASR_SIZE_Pos) /* 2^(28+1) region */ + | (0x3U << MPU_RASR_AP_Pos) /* PA:rw/UA:rw */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | (1U << MPU_RASR_S_Pos) /* S=1 */ + | (1U << MPU_RASR_C_Pos) /* C=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + /* region #3: (not configured) */ + { MPU_RBAR_VALID_Msk | (MPU_RBAR_REGION_Msk & 2U), 0U }, + + { /* region #3: Peripherals: base=0x4000'0000, size=512M=2^(28+1) */ + 0x40000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 3U), /* region #3 */ + (28U << MPU_RASR_SIZE_Pos) /* 2^(28+1) region */ + | (0x3U << MPU_RASR_AP_Pos) /* PA:rw/UA:rw */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | (1U << MPU_RASR_S_Pos) /* S=1 */ + | (1U << MPU_RASR_B_Pos) /* B=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #4: Priv. Periph: base=0xE000'0000, size=512M=2^(28+1) */ + 0xE0000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 4U), /* region #4 */ + (28U << MPU_RASR_SIZE_Pos) /* 2^(28+1) region */ + | (0x3U << MPU_RASR_AP_Pos) /* PA:rw/UA:rw */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | (1U << MPU_RASR_S_Pos) /* S=1 */ + | (1U << MPU_RASR_B_Pos) /* B=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #5: Ext RAM: base=0x6000'0000, size=1G=2^(29+1) */ + 0x60000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 5U), /* region #5 */ + (29U << MPU_RASR_SIZE_Pos) /* 2^(28+1) region */ + | (0x3U << MPU_RASR_AP_Pos) /* PA:rw/UA:rw */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | (1U << MPU_RASR_S_Pos) /* S=1 */ + | (1U << MPU_RASR_B_Pos) /* B=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #6: Ext Dev: base=0xA000'0000, size=1G=2^(29+1) */ + 0xA0000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 6U), /* region #6 */ + (29U << MPU_RASR_SIZE_Pos) /* 2^(28+1) region */ + | (0x3U << MPU_RASR_AP_Pos) /* PA:rw/UA:rw */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | (1U << MPU_RASR_S_Pos) /* S=1 */ + | (1U << MPU_RASR_B_Pos) /* B=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #7: NULL-pointer: base=0x000'0000, size=128M=2^(26+1) */ + /* NOTE: this region extends to 0x080'0000, which is where + * the ROM is re-mapped by STM32 + */ + 0x00000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 7U), /* region #7 */ + (26U << MPU_RASR_SIZE_Pos) /* 2^(26+1)=128M region */ + | (0x0U << MPU_RASR_AP_Pos) /* PA:na/UA:na */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + }; + + __DSB(); + MPU->CTRL = 0U; /* disable the MPU */ + for (uint_fast8_t n = 0U; n < Q_DIM(mpu_setup); ++n) { + MPU->RBAR = mpu_setup[n].rbar; + MPU->RASR = mpu_setup[n].rasr; + } + MPU->CTRL = MPU_CTRL_PRIVDEFENA_Msk /* enable background region */ + | MPU_CTRL_ENABLE_Msk; /* enable the MPU */ + __ISB(); + __DSB(); +} +/*..........................................................................*/ void BSP_init(void) { + /* setup the MPU... */ + STM32L053R8_MPU_setup(); + /* NOTE: SystemInit() has been already called from the startup code * but SystemCoreClock needs to be updated */ @@ -164,10 +286,11 @@ void BSP_init(void) { } QS_OBJ_DICTIONARY(&l_SysTick_Handler); QS_USR_DICTIONARY(PHILO_STAT); + QS_USR_DICTIONARY(CONTEXT_SW); /* setup the QS filters... */ - QS_GLB_FILTER(QS_SM_RECORDS); - QS_GLB_FILTER(QS_UA_RECORDS); + QS_GLB_FILTER(QS_ALL_RECORDS); /* all records */ + QS_GLB_FILTER(-QS_QF_TICK); /* exclude the clock tick */ } /*..........................................................................*/ void BSP_displayPhilStat(uint8_t n, char const *stat) { @@ -230,15 +353,10 @@ void QF_onStartup(void) { /* set up the SysTick timer to fire at BSP_TICKS_PER_SEC rate */ SysTick_Config(SystemCoreClock / BSP_TICKS_PER_SEC); - /* set priorities of ALL ISRs used in the system, see NOTE00 - * - * !!!!!!!!!!!!!!!!!!!!!!!!!!!! CAUTION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - * Assign a priority to EVERY ISR explicitly by calling NVIC_SetPriority(). - * DO NOT LEAVE THE ISR PRIORITIES AT THE DEFAULT VALUE! - */ - NVIC_SetPriority(USART2_IRQn, 0U); /* kernel UNAWARE interrupt */ - NVIC_SetPriority(SysTick_IRQn, QF_AWARE_ISR_CMSIS_PRI + 1U); - NVIC_SetPriority(EXTI0_1_IRQn, QF_AWARE_ISR_CMSIS_PRI + 2U); + /* set priorities of ALL ISRs used in the system */ + NVIC_SetPriority(USART2_IRQn, 0); + NVIC_SetPriority(SysTick_IRQn, QF_AWARE_ISR_CMSIS_PRI + 0U); + NVIC_SetPriority(EXTI0_1_IRQn, QF_AWARE_ISR_CMSIS_PRI + 1U); /* ... */ /* enable IRQs... */ @@ -251,6 +369,16 @@ void QF_onStartup(void) { void QF_onCleanup(void) { } /*..........................................................................*/ +#ifdef QF_ON_CONTEXT_SW +/* NOTE: the context-switch callback is called with interrupts DISABLED */ +void QF_onContextSw(QActive *prev, QActive *next) { + QS_BEGIN_NOCRIT(CONTEXT_SW, 0U) /* no critical section! */ + QS_OBJ(prev); + QS_OBJ(next); + QS_END_NOCRIT() +} +#endif /* QF_ON_CONTEXT_SW */ +/*..........................................................................*/ void QV_onIdle(void) { /* called with interrupts disabled, see NOTE01 */ /* toggle an LED on and then off (not enough LEDs, see NOTE02) */ @@ -323,7 +451,7 @@ Q_NORETURN Q_onAssert(char const * const module, int_t const loc) { /*..........................................................................*/ uint8_t QS_onStartup(void const *arg) { - static uint8_t qsBuf[1024]; /* buffer for Quantum Spy */ + static uint8_t qsBuf[2*1024]; /* buffer for Quantum Spy */ static uint8_t qsRxBuf[256]; /* buffer for QS-RX channel */ (void)arg; /* avoid the "unused parameter" compiler warning */ @@ -378,7 +506,7 @@ void QS_onFlush(void) { QF_INT_ENABLE(); while ((USART2->ISR & (1U << 7)) == 0U) { /* while TXE not empty */ } - USART2->TDR = (b & 0xFFU); /* put into the DR register */ + USART2->TDR = (b & 0xFFU); /* put into the DR register */ QF_INT_DISABLE(); } QF_INT_ENABLE(); @@ -403,23 +531,6 @@ void QS_onCommand(uint8_t cmdId, /*--------------------------------------------------------------------------*/ /***************************************************************************** -* NOTE00: -* The QF_AWARE_ISR_CMSIS_PRI constant from the QF port specifies the highest -* ISR priority that is disabled by the QF framework. The value is suitable -* for the NVIC_SetPriority() CMSIS function. -* -* Only ISRs prioritized at or below the QF_AWARE_ISR_CMSIS_PRI level (i.e., -* with the numerical values of priorities equal or higher than -* QF_AWARE_ISR_CMSIS_PRI) are allowed to call any QF services. These ISRs -* are "QF-aware". -* -* Conversely, any ISRs prioritized above the QF_AWARE_ISR_CMSIS_PRI priority -* level (i.e., with the numerical values of priorities less than -* QF_AWARE_ISR_CMSIS_PRI) are never disabled and are not aware of the kernel. -* Such "QF-unaware" ISRs cannot call any QF services. The only mechanism -* by which a "QF-unaware" ISR can communicate with the QF framework is by -* triggering a "QF-aware" ISR, which can post/publish events. -* * NOTE01: * The QV_onIdle() callback is called with interrupts disabled, because the * determination of the idle condition might change by any interrupt posting diff --git a/examples/arm-cm/dpp_nucleo-l053r8/qv/gnu/Makefile b/examples/arm-cm/dpp_nucleo-l053r8/qv/gnu/Makefile index 51956a16..092d4af4 100644 --- a/examples/arm-cm/dpp_nucleo-l053r8/qv/gnu/Makefile +++ b/examples/arm-cm/dpp_nucleo-l053r8/qv/gnu/Makefile @@ -1,7 +1,7 @@ ############################################################################## # Product: Makefile for QP/C on NUCLEO-L053R8, QV kernel, GNU-ARM -# Last Updated for Version: 7.0.1 -# Date of the Last Update: 2022-05-23 +# Last Updated for Version: 7.2.0 +# Date of the Last Update: 2022-12-13 # # Q u a n t u m L e a P s # ------------------------ @@ -133,7 +133,7 @@ LIB_DIRS := LIBS := # defines -DEFINES := +DEFINES := -DQV_ON_CONTEXT_SW # ARM CPU, ARCH, FPU, and Float-ABI types... # ARM_CPU: [cortex-m0 | cortex-m0plus | cortex-m1 | cortex-m3 | cortex-m4] diff --git a/examples/arm-cm/dpp_nucleo-l053r8/qv/iar/dpp-qv.ewp b/examples/arm-cm/dpp_nucleo-l053r8/qv/iar/dpp-qv.ewp index 2a1cc44e..79ebe13a 100644 --- a/examples/arm-cm/dpp_nucleo-l053r8/qv/iar/dpp-qv.ewp +++ b/examples/arm-cm/dpp_nucleo-l053r8/qv/iar/dpp-qv.ewp @@ -11,9 +11,13 @@ General 3 - 31 + 33 1 1 + - - - - - + + ICCARM 2 - 35 + 37 1 1 - - - + AARM 2 - 10 + 11 1 1 + @@ -672,13 +656,9 @@ 0 + inputOutputBased - - BICOMP - 0 - - BUILDACTION 1 @@ -691,17 +671,13 @@ ILINK 0 - 23 + 25 1 1 - + + + + + @@ -1050,11 +1046,6 @@ - - BILINK - 0 - - Coder 0 @@ -1071,9 +1062,13 @@ General 3 - 31 + 33 1 0 + - - - - - + + ICCARM 2 - 35 + 37 1 0 - - - + AARM 2 - 10 + 11 1 0 + @@ -1732,13 +1707,9 @@ 0 + inputOutputBased - - BICOMP - 0 - - BUILDACTION 1 @@ -1751,17 +1722,13 @@ ILINK 0 - 23 + 25 1 0 - + + + + + @@ -2110,11 +2097,6 @@ - - BILINK - 0 - - Coder 0 @@ -2131,9 +2113,13 @@ General 3 - 31 + 33 1 1 + - - - - - + + ICCARM 2 - 35 + 37 1 1 - - - + AARM 2 - 10 + 11 1 1 + @@ -2792,13 +2758,9 @@ 0 + inputOutputBased - - BICOMP - 0 - - BUILDACTION 1 @@ -2811,17 +2773,13 @@ ILINK 0 - 23 + 25 1 1 - + + + + + @@ -3170,17 +3148,15 @@ - - BILINK - 0 - - Coder 0 + + Release + Application diff --git a/examples/arm-cm/dpp_nucleo-l053r8/qxk/armclang/dpp-qxk.uvprojx b/examples/arm-cm/dpp_nucleo-l053r8/qxk/armclang/dpp-qxk.uvprojx index 0d658fb0..f48ec96c 100644 --- a/examples/arm-cm/dpp_nucleo-l053r8/qxk/armclang/dpp-qxk.uvprojx +++ b/examples/arm-cm/dpp_nucleo-l053r8/qxk/armclang/dpp-qxk.uvprojx @@ -337,7 +337,7 @@ 0 - QXK_ON_CONTEXT_SW + QF_ON_CONTEXT_SW ..\..;..\..\..\..\..\include;..\..\..\..\..\ports\arm-cm\qxk\armclang;..\..\..\..\..\3rd_party\CMSIS\Include;..\..\..\..\..\3rd_party\nucleo-l053r8 @@ -1738,7 +1738,7 @@ 0 - Q_SPY,QXK_ON_CONTEXT_SW + Q_SPY,QF_ON_CONTEXT_SW ..\..;..\..\..\..\..\include;..\..\..\..\..\ports\arm-cm\qxk\armclang;..\..\..\..\..\3rd_party\CMSIS\Include;..\..\..\..\..\3rd_party\nucleo-l053r8 diff --git a/examples/arm-cm/dpp_nucleo-l053r8/qxk/bsp.c b/examples/arm-cm/dpp_nucleo-l053r8/qxk/bsp.c index ad3b44af..33cf3e8f 100644 --- a/examples/arm-cm/dpp_nucleo-l053r8/qxk/bsp.c +++ b/examples/arm-cm/dpp_nucleo-l053r8/qxk/bsp.c @@ -261,15 +261,15 @@ void QF_onStartup(void) { void QF_onCleanup(void) { } /*..........................................................................*/ -#ifdef QXK_ON_CONTEXT_SW +#ifdef QF_ON_CONTEXT_SW /* NOTE: the context-switch callback is called with interrupts DISABLED */ -void QXK_onContextSw(QActive *prev, QActive *next) { +void QF_onContextSw(QActive *prev, QActive *next) { QS_BEGIN_NOCRIT(CONTEXT_SW, 0U) /* no critical section! */ QS_OBJ(prev); QS_OBJ(next); QS_END_NOCRIT() } -#endif /* QXK_ON_CONTEXT_SW */ +#endif /* QF_ON_CONTEXT_SW */ /*..........................................................................*/ void QXK_onIdle(void) { /* called with interrupts enabled */ diff --git a/examples/arm-cm/dpp_nucleo-l053r8/qxk/gnu/Makefile b/examples/arm-cm/dpp_nucleo-l053r8/qxk/gnu/Makefile index 481d36e8..2ca57712 100644 --- a/examples/arm-cm/dpp_nucleo-l053r8/qxk/gnu/Makefile +++ b/examples/arm-cm/dpp_nucleo-l053r8/qxk/gnu/Makefile @@ -1,7 +1,7 @@ ############################################################################## # Product: Makefile for QP/C, DPP on NUCLEO-L053R8, QXK kernel, GNU-ARM -# Last Updated for Version: 7.0.1 -# Date of the Last Update: 2022-05-23 +# Last Updated for Version: 7.2.0 +# Date of the Last Update: 2022-12-13 # # Q u a n t u m L e a P s # ------------------------ @@ -138,7 +138,7 @@ LIBS := # defines DEFINES := \ - -DQXK_ON_CONTEXT_SW \ + -DQF_ON_CONTEXT_SW \ -DQXK_USE_IRQ_NUM=30 \ -DQXK_USE_IRQ_HANDLER=LCD_IRQHandler diff --git a/examples/arm-cm/dpp_nucleo-l053r8/qxk/iar/dpp-qxk.ewp b/examples/arm-cm/dpp_nucleo-l053r8/qxk/iar/dpp-qxk.ewp index b791e23b..c6e27ffa 100644 --- a/examples/arm-cm/dpp_nucleo-l053r8/qxk/iar/dpp-qxk.ewp +++ b/examples/arm-cm/dpp_nucleo-l053r8/qxk/iar/dpp-qxk.ewp @@ -2318,7 +2318,7 @@
diff --git a/examples/arm-cm/dpp_nucleo-l552ze/qk/bsp.c b/examples/arm-cm/dpp_nucleo-l552ze/qk/bsp.c index 648df8ee..bc2089a0 100644 --- a/examples/arm-cm/dpp_nucleo-l552ze/qk/bsp.c +++ b/examples/arm-cm/dpp_nucleo-l552ze/qk/bsp.c @@ -304,9 +304,9 @@ void QF_onCleanup(void) { } /*..........................................................................*/ -#ifdef QK_ON_CONTEXT_SW +#ifdef QF_ON_CONTEXT_SW /* NOTE: the context-switch callback is called with interrupts DISABLED */ -void QK_onContextSw(QActive *prev, QActive *next) { +void QF_onContextSw(QActive *prev, QActive *next) { (void)prev; if (next != (QActive *)0) { //_impure_ptr = next->thread; /* switch to next TLS */ @@ -316,7 +316,7 @@ void QK_onContextSw(QActive *prev, QActive *next) { QS_OBJ(next); QS_END_NOCRIT() } -#endif /* QK_ON_CONTEXT_SW */ +#endif /* QF_ON_CONTEXT_SW */ /*..........................................................................*/ void QK_onIdle(void) { /* toggle the User LED on and then off, see NOTE2 */ diff --git a/examples/arm-cm/dpp_nucleo-l552ze/qxk/bsp.c b/examples/arm-cm/dpp_nucleo-l552ze/qxk/bsp.c index 79d37f7c..41950aea 100644 --- a/examples/arm-cm/dpp_nucleo-l552ze/qxk/bsp.c +++ b/examples/arm-cm/dpp_nucleo-l552ze/qxk/bsp.c @@ -309,9 +309,9 @@ void QF_onCleanup(void) { } /*..........................................................................*/ -#ifdef QXK_ON_CONTEXT_SW +#ifdef QF_ON_CONTEXT_SW /* NOTE: the context-switch callback is called with interrupts DISABLED */ -void QXK_onContextSw(QActive *prev, QActive *next) { +void QF_onContextSw(QActive *prev, QActive *next) { (void)prev; if (next != (QActive *)0) { //_impure_ptr = next->thread; /* switch to next TLS */ @@ -321,7 +321,7 @@ void QXK_onContextSw(QActive *prev, QActive *next) { QS_OBJ(next); QS_END_NOCRIT() } -#endif /* QXK_ON_CONTEXT_SW */ +#endif /* QF_ON_CONTEXT_SW */ /*..........................................................................*/ void QXK_onIdle(void) { /* toggle the User LED on and then off, see NOTE2 */ diff --git a/examples/arm-cm/dpp_nucleo-l552ze/table.c b/examples/arm-cm/dpp_nucleo-l552ze/table.c index 95847d47..edfc073a 100644 --- a/examples/arm-cm/dpp_nucleo-l552ze/table.c +++ b/examples/arm-cm/dpp_nucleo-l552ze/table.c @@ -3,7 +3,7 @@ * Model: dpp.qm * File: ${.::table.c} * -* This code has been generated by QM 5.2.2 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later @@ -64,8 +64,8 @@ static QState Table_paused(Table * const me, QEvt const * const e); /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/examples/arm-cm/dpp_stm32f4-discovery/dpp.h b/examples/arm-cm/dpp_stm32f4-discovery/dpp.h index 83694d8f..da094c2c 100644 --- a/examples/arm-cm/dpp_stm32f4-discovery/dpp.h +++ b/examples/arm-cm/dpp_stm32f4-discovery/dpp.h @@ -3,7 +3,7 @@ * Model: dpp.qm * File: ${.::dpp.h} * -* This code has been generated by QM 5.2.2 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later diff --git a/examples/arm-cm/dpp_stm32f4-discovery/dpp.qm b/examples/arm-cm/dpp_stm32f4-discovery/dpp.qm index 22312a29..b78ede00 100644 --- a/examples/arm-cm/dpp_stm32f4-discovery/dpp.qm +++ b/examples/arm-cm/dpp_stm32f4-discovery/dpp.qm @@ -1,5 +1,5 @@ - + Dining Philosopher Problem example @@ -145,18 +145,12 @@ Q_ASSERT(Q_EVT_CAST(TableEvt)->philoNum != PHILO_ID(me)); - + - uint8_t n; -(void)par; /* unused parameter */ + (void)par; /* unused parameter */ QS_OBJ_DICTIONARY(&l_table); -QS_FUN_DICTIONARY(&QHsm_top); -QS_FUN_DICTIONARY(&Table_initial); -QS_FUN_DICTIONARY(&Table_active); -QS_FUN_DICTIONARY(&Table_serving); -QS_FUN_DICTIONARY(&Table_paused); QS_SIG_DICTIONARY(DONE_SIG, (void *)0); /* global signals */ QS_SIG_DICTIONARY(EAT_SIG, (void *)0); @@ -171,7 +165,7 @@ QActive_subscribe(&me->super, PAUSE_SIG); QActive_subscribe(&me->super, SERVE_SIG); QActive_subscribe(&me->super, TEST_SIG); -for (n = 0U; n < N_PHILO; ++n) { +for (uint8_t n = 0U; n < N_PHILO; ++n) { me->fork[n] = FREE; me->isHungry[n] = 0U; BSP_displayPhilStat(n, "thinking"); diff --git a/examples/arm-cm/dpp_stm32f4-discovery/philo.c b/examples/arm-cm/dpp_stm32f4-discovery/philo.c index 05aef16c..7614912a 100644 --- a/examples/arm-cm/dpp_stm32f4-discovery/philo.c +++ b/examples/arm-cm/dpp_stm32f4-discovery/philo.c @@ -3,7 +3,7 @@ * Model: dpp.qm * File: ${.::philo.c} * -* This code has been generated by QM 5.2.2 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later @@ -76,8 +76,8 @@ QActive * const AO_Philo[N_PHILO] = { /* "opaque" pointers to Philo AO */ /* Philo definition --------------------------------------------------------*/ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/examples/arm-cm/dpp_stm32f4-discovery/qk/bsp.c b/examples/arm-cm/dpp_stm32f4-discovery/qk/bsp.c index 9a3a8584..4f56c643 100644 --- a/examples/arm-cm/dpp_stm32f4-discovery/qk/bsp.c +++ b/examples/arm-cm/dpp_stm32f4-discovery/qk/bsp.c @@ -151,30 +151,7 @@ void BSP_init(void) { */ SystemCoreClockUpdate(); - /* configure the FPU usage by choosing one of the options... */ -#if 1 - /* OPTION 1: - * Use the automatic FPU state preservation and the FPU lazy stacking. - * - * NOTE: - * Use the following setting when FPU is used in more than one task or - * in any ISRs. This setting is the safest and recommended, but requires - * extra stack space and CPU cycles. - */ - FPU->FPCCR |= (1U << FPU_FPCCR_ASPEN_Pos) | (1U << FPU_FPCCR_LSPEN_Pos); -#else - /* OPTION 2: - * Do NOT to use the automatic FPU state preservation and - * do NOT to use the FPU lazy stacking. - * - * NOTE: - * Use the following setting when FPU is used in ONE task only and not - * in any ISR. This setting is very efficient, but if more than one task - * (or ISR) start using the FPU, this can lead to corruption of the - * FPU registers. This option should be used with CAUTION. - */ - FPU->FPCCR &= ~((1U << FPU_FPCCR_ASPEN_Pos) | (1U << FPU_FPCCR_LSPEN_Pos)); -#endif + /* NOTE The VFP (hardware Floating Point) unit is configured by QK-port */ /* Initialize thr port for the LEDs */ RCC_AHB1PeriphClockCmd(LED_GPIO_CLK , ENABLE); diff --git a/examples/arm-cm/dpp_stm32f4-discovery/qv/bsp.c b/examples/arm-cm/dpp_stm32f4-discovery/qv/bsp.c index edbdfc4a..5a28144c 100644 --- a/examples/arm-cm/dpp_stm32f4-discovery/qv/bsp.c +++ b/examples/arm-cm/dpp_stm32f4-discovery/qv/bsp.c @@ -148,30 +148,7 @@ void BSP_init(void) { */ SystemCoreClockUpdate(); - /* configure the FPU usage by choosing one of the options... */ -#if 1 - /* OPTION 1: - * Use the automatic FPU state preservation and the FPU lazy stacking. - * - * NOTE: - * Use the following setting when FPU is used in more than one task or - * in any ISRs. This setting is the safest and recommended, but requires - * extra stack space and CPU cycles. - */ - FPU->FPCCR |= (1U << FPU_FPCCR_ASPEN_Pos) | (1U << FPU_FPCCR_LSPEN_Pos); -#else - /* OPTION 2: - * Do NOT to use the automatic FPU state preservation and - * do NOT to use the FPU lazy stacking. - * - * NOTE: - * Use the following setting when FPU is used in ONE task only and not - * in any ISR. This setting is very efficient, but if more than one task - * (or ISR) start using the FPU, this can lead to corruption of the - * FPU registers. This option should be used with CAUTION. - */ - FPU->FPCCR &= ~((1U << FPU_FPCCR_ASPEN_Pos) | (1U << FPU_FPCCR_LSPEN_Pos)); -#endif + /* NOTE The VFP (hardware Floating Point) unit is configured by QV-port */ /* Initialize thr port for the LEDs */ RCC_AHB1PeriphClockCmd(LED_GPIO_CLK , ENABLE); diff --git a/examples/arm-cm/dpp_stm32f4-discovery/qxk/bsp.c b/examples/arm-cm/dpp_stm32f4-discovery/qxk/bsp.c index 5075ac59..70d11b95 100644 --- a/examples/arm-cm/dpp_stm32f4-discovery/qxk/bsp.c +++ b/examples/arm-cm/dpp_stm32f4-discovery/qxk/bsp.c @@ -151,30 +151,7 @@ void BSP_init(void) { */ SystemCoreClockUpdate(); - /* configure the FPU usage by choosing one of the options... */ -#if 1 - /* OPTION 1: - * Use the automatic FPU state preservation and the FPU lazy stacking. - * - * NOTE: - * Use the following setting when FPU is used in more than one task or - * in any ISRs. This setting is the safest and recommended, but requires - * extra stack space and CPU cycles. - */ - FPU->FPCCR |= (1U << FPU_FPCCR_ASPEN_Pos) | (1U << FPU_FPCCR_LSPEN_Pos); -#else - /* OPTION 2: - * Do NOT to use the automatic FPU state preservation and - * do NOT to use the FPU lazy stacking. - * - * NOTE: - * Use the following setting when FPU is used in ONE task only and not - * in any ISR. This setting is very efficient, but if more than one task - * (or ISR) start using the FPU, this can lead to corruption of the - * FPU registers. This option should be used with CAUTION. - */ - FPU->FPCCR &= ~((1U << FPU_FPCCR_ASPEN_Pos) | (1U << FPU_FPCCR_LSPEN_Pos)); -#endif + /* NOTE The VFP (Floating Point Unit) unit is configured by QXK-port */ /* Initialize thr port for the LEDs */ RCC_AHB1PeriphClockCmd(LED_GPIO_CLK , ENABLE); diff --git a/examples/arm-cm/dpp_stm32f4-discovery/table.c b/examples/arm-cm/dpp_stm32f4-discovery/table.c index a77305c8..d14c29d4 100644 --- a/examples/arm-cm/dpp_stm32f4-discovery/table.c +++ b/examples/arm-cm/dpp_stm32f4-discovery/table.c @@ -3,7 +3,7 @@ * Model: dpp.qm * File: ${.::table.c} * -* This code has been generated by QM 5.2.2 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later @@ -68,8 +68,8 @@ QActive * const AO_Table = &l_table.super; /* "opaque" AO pointer */ /*..........................................................................*/ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ @@ -95,15 +95,9 @@ void Table_ctor(void) { /*${AOs::Table::SM} ........................................................*/ static QState Table_initial(Table * const me, void const * const par) { /*${AOs::Table::SM::initial} */ - uint8_t n; (void)par; /* unused parameter */ QS_OBJ_DICTIONARY(&l_table); - QS_FUN_DICTIONARY(&QHsm_top); - QS_FUN_DICTIONARY(&Table_initial); - QS_FUN_DICTIONARY(&Table_active); - QS_FUN_DICTIONARY(&Table_serving); - QS_FUN_DICTIONARY(&Table_paused); QS_SIG_DICTIONARY(DONE_SIG, (void *)0); /* global signals */ QS_SIG_DICTIONARY(EAT_SIG, (void *)0); @@ -118,11 +112,16 @@ static QState Table_initial(Table * const me, void const * const par) { QActive_subscribe(&me->super, SERVE_SIG); QActive_subscribe(&me->super, TEST_SIG); - for (n = 0U; n < N_PHILO; ++n) { + for (uint8_t n = 0U; n < N_PHILO; ++n) { me->fork[n] = FREE; me->isHungry[n] = 0U; BSP_displayPhilStat(n, "thinking"); } + + QS_FUN_DICTIONARY(&Table_active); + QS_FUN_DICTIONARY(&Table_serving); + QS_FUN_DICTIONARY(&Table_paused); + return Q_TRAN(&Table_serving); } diff --git a/examples/arm-cm/game_efm32-slstk3401a/game.h b/examples/arm-cm/game_efm32-slstk3401a/game.h index 78b7a66c..ed86a814 100644 --- a/examples/arm-cm/game_efm32-slstk3401a/game.h +++ b/examples/arm-cm/game_efm32-slstk3401a/game.h @@ -3,7 +3,7 @@ * Model: game.qm * File: ${.::game.h} * -* This code has been generated by QM 5.2.1 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later diff --git a/examples/arm-cm/game_efm32-slstk3401a/game.qm b/examples/arm-cm/game_efm32-slstk3401a/game.qm index 665c0738..11aeff2e 100644 --- a/examples/arm-cm/game_efm32-slstk3401a/game.qm +++ b/examples/arm-cm/game_efm32-slstk3401a/game.qm @@ -1,5 +1,5 @@ - + "Fly 'n' Shoot" game model from Chapters 1 & 9 of PSiCC2 diff --git a/examples/arm-cm/game_efm32-slstk3401a/mine1.c b/examples/arm-cm/game_efm32-slstk3401a/mine1.c index 79d64c5d..7473c732 100644 --- a/examples/arm-cm/game_efm32-slstk3401a/mine1.c +++ b/examples/arm-cm/game_efm32-slstk3401a/mine1.c @@ -3,7 +3,7 @@ * Model: game.qm * File: ${.::mine1.c} * -* This code has been generated by QM 5.2.1 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later @@ -68,8 +68,8 @@ static QState Mine1_exploding(Mine1 * const me, QEvt const * const e); /* Mine1 class definition --------------------------------------------------*/ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/examples/arm-cm/game_efm32-slstk3401a/mine2.c b/examples/arm-cm/game_efm32-slstk3401a/mine2.c index 7b3c6c9c..a6eddf11 100644 --- a/examples/arm-cm/game_efm32-slstk3401a/mine2.c +++ b/examples/arm-cm/game_efm32-slstk3401a/mine2.c @@ -3,7 +3,7 @@ * Model: game.qm * File: ${.::mine2.c} * -* This code has been generated by QM 5.2.1 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later @@ -68,8 +68,8 @@ static QState Mine2_exploding(Mine2 * const me, QEvt const * const e); /* Mine2 class definition --------------------------------------------------*/ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/examples/arm-cm/game_efm32-slstk3401a/missile.c b/examples/arm-cm/game_efm32-slstk3401a/missile.c index 514c7729..4165158a 100644 --- a/examples/arm-cm/game_efm32-slstk3401a/missile.c +++ b/examples/arm-cm/game_efm32-slstk3401a/missile.c @@ -3,7 +3,7 @@ * Model: game.qm * File: ${.::missile.c} * -* This code has been generated by QM 5.2.1 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later @@ -64,8 +64,8 @@ static QState Missile_exploding(Missile * const me, QEvt const * const e); /* Public-scope objects ----------------------------------------------------*/ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/examples/arm-cm/game_efm32-slstk3401a/qk/bsp.c b/examples/arm-cm/game_efm32-slstk3401a/qk/bsp.c index 671c52cc..9193469d 100644 --- a/examples/arm-cm/game_efm32-slstk3401a/qk/bsp.c +++ b/examples/arm-cm/game_efm32-slstk3401a/qk/bsp.c @@ -176,30 +176,7 @@ void BSP_init(void) { */ SystemCoreClockUpdate(); - /* configure the FPU usage by choosing one of the options... */ -#if 1 - /* OPTION 1: - * Use the automatic FPU state preservation and the FPU lazy stacking. - * - * NOTE: - * Use the following setting when FPU is used in more than one task or - * in any ISRs. This setting is the safest and recommended, but requires - * extra stack space and CPU cycles. - */ - FPU->FPCCR |= (1U << FPU_FPCCR_ASPEN_Pos) | (1U << FPU_FPCCR_LSPEN_Pos); -#else - /* OPTION 2: - * Do NOT to use the automatic FPU state preservation and - * do NOT to use the FPU lazy stacking. - * - * NOTE: - * Use the following setting when FPU is used in ONE task only and not - * in any ISR. This setting is very efficient, but if more than one task - * (or ISR) start using the FPU, this can lead to corruption of the - * FPU registers. This option should be used with CAUTION. - */ - FPU->FPCCR &= ~((1U << FPU_FPCCR_ASPEN_Pos) | (1U << FPU_FPCCR_LSPEN_Pos)); -#endif + /* NOTE The VFP (Floating Point Unit) unit is configured by QK-port */ /* enable clock for to the peripherals used by this application... */ CMU_ClockEnable(cmuClock_HFPER, true); diff --git a/examples/arm-cm/game_efm32-slstk3401a/qv/bsp.c b/examples/arm-cm/game_efm32-slstk3401a/qv/bsp.c index 847bb3a9..444d65e8 100644 --- a/examples/arm-cm/game_efm32-slstk3401a/qv/bsp.c +++ b/examples/arm-cm/game_efm32-slstk3401a/qv/bsp.c @@ -167,14 +167,7 @@ void BSP_init(void) { */ SystemCoreClockUpdate(); - - /* Do NOT to use the automatic FPU state preservation and - * do NOT to use the FPU lazy stacking. - * - * NOTE: - * Use the following setting when FPU is NOT used in any ISR. - */ - FPU->FPCCR &= ~((1U << FPU_FPCCR_ASPEN_Pos) | (1U << FPU_FPCCR_LSPEN_Pos)); + /* NOTE The VFP (Floating Point Unit) unit is configured by QV-port */ /* enable clock for to the peripherals used by this application... */ CMU_ClockEnable(cmuClock_HFPER, true); diff --git a/examples/arm-cm/game_efm32-slstk3401a/ship.c b/examples/arm-cm/game_efm32-slstk3401a/ship.c index d0ccb3d5..4744af4b 100644 --- a/examples/arm-cm/game_efm32-slstk3401a/ship.c +++ b/examples/arm-cm/game_efm32-slstk3401a/ship.c @@ -3,7 +3,7 @@ * Model: game.qm * File: ${.::ship.c} * -* This code has been generated by QM 5.2.1 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later @@ -69,8 +69,8 @@ static QState Ship_exploding(Ship * const me, QEvt const * const e); /* Public-scope objects ----------------------------------------------------*/ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/examples/arm-cm/game_efm32-slstk3401a/tunnel.c b/examples/arm-cm/game_efm32-slstk3401a/tunnel.c index d84fd64e..50aa527d 100644 --- a/examples/arm-cm/game_efm32-slstk3401a/tunnel.c +++ b/examples/arm-cm/game_efm32-slstk3401a/tunnel.c @@ -3,7 +3,7 @@ * Model: game.qm * File: ${.::tunnel.c} * -* This code has been generated by QM 5.2.1 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later @@ -84,8 +84,8 @@ static QState Tunnel_final(Tunnel * const me, QEvt const * const e); /* Public-scope objects ----------------------------------------------------*/ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/examples/arm-cm/low-power_ek-tm4c123gxl/blinky0.c b/examples/arm-cm/low-power_ek-tm4c123gxl/blinky0.c index 4800c321..517729c9 100644 --- a/examples/arm-cm/low-power_ek-tm4c123gxl/blinky0.c +++ b/examples/arm-cm/low-power_ek-tm4c123gxl/blinky0.c @@ -3,7 +3,7 @@ * Model: low-power.qm * File: ${.::blinky0.c} * -* This code has been generated by QM 5.2.2 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later @@ -61,8 +61,8 @@ static QState Blinky0_inactive(Blinky0 * const me, QEvt const * const e); /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/examples/arm-cm/low-power_ek-tm4c123gxl/blinky1.c b/examples/arm-cm/low-power_ek-tm4c123gxl/blinky1.c index 9ed15b15..c4446f06 100644 --- a/examples/arm-cm/low-power_ek-tm4c123gxl/blinky1.c +++ b/examples/arm-cm/low-power_ek-tm4c123gxl/blinky1.c @@ -3,7 +3,7 @@ * Model: low-power.qm * File: ${.::blinky1.c} * -* This code has been generated by QM 5.2.2 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later @@ -59,8 +59,8 @@ static QState Blinky1_on(Blinky1 * const me, QEvt const * const e); /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/examples/arm-cm/low-power_ek-tm4c123gxl/low-power.qm b/examples/arm-cm/low-power_ek-tm4c123gxl/low-power.qm index 59179c86..25b6554a 100644 --- a/examples/arm-cm/low-power_ek-tm4c123gxl/low-power.qm +++ b/examples/arm-cm/low-power_ek-tm4c123gxl/low-power.qm @@ -1,5 +1,5 @@ - + Low-Power example with multiple clock rates diff --git a/examples/arm-cm/low-power_ek-tm4c123gxl/low_power.h b/examples/arm-cm/low-power_ek-tm4c123gxl/low_power.h index af11ca44..7c416874 100644 --- a/examples/arm-cm/low-power_ek-tm4c123gxl/low_power.h +++ b/examples/arm-cm/low-power_ek-tm4c123gxl/low_power.h @@ -3,7 +3,7 @@ * Model: low-power.qm * File: ${.::low_power.h} * -* This code has been generated by QM 5.2.2 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later diff --git a/examples/arm-cm/low-power_ek-tm4c123gxl/qk/bsp.c b/examples/arm-cm/low-power_ek-tm4c123gxl/qk/bsp.c index 23923af4..b426c297 100644 --- a/examples/arm-cm/low-power_ek-tm4c123gxl/qk/bsp.c +++ b/examples/arm-cm/low-power_ek-tm4c123gxl/qk/bsp.c @@ -103,10 +103,7 @@ void BSP_init(void) { SYSCTL_XTAL_16MHZ); SystemCoreClock = XTAL_HZ; - /* FPU ( Floating Point Unit) configuration for QK - * Use the automatic FPU state preservation and the FPU lazy stacking. - */ - FPU->FPCCR |= (1U << FPU_FPCCR_ASPEN_Pos) | (1U << FPU_FPCCR_LSPEN_Pos); + /* NOTE The VFP (Floating Point Unit) unit is configured by QK-port */ /* configure Timer0, but don't enable the interrupt just yet */ SYSCTL->RCGCTIMER |= (1U << 0); /* enable Run mode for Timer0 */ diff --git a/examples/arm-cm/low-power_ek-tm4c123gxl/qv/bsp.c b/examples/arm-cm/low-power_ek-tm4c123gxl/qv/bsp.c index d7215024..3b93f082 100644 --- a/examples/arm-cm/low-power_ek-tm4c123gxl/qv/bsp.c +++ b/examples/arm-cm/low-power_ek-tm4c123gxl/qv/bsp.c @@ -99,31 +99,7 @@ void BSP_init(void) { SYSCTL_XTAL_16MHZ); SystemCoreClock = XTAL_HZ; - /* configure the FPU usage by choosing one of the options... */ -#if 1 - /* OPTION 1: - * Use the automatic FPU state preservation and the FPU lazy stacking. - * - * NOTE: - * Use the following setting when FPU is used in more than one task or - * in any ISRs. This setting is the safest and recommended, but requires - * extra stack space and CPU cycles. - */ - FPU->FPCCR |= (1U << FPU_FPCCR_ASPEN_Pos) | (1U << FPU_FPCCR_LSPEN_Pos); -#else - /* OPTION 2: - * Do NOT to use the automatic FPU state preservation and - * do NOT to use the FPU lazy stacking. - * - * NOTE: - * Use the following setting when FPU is used in ONE task only and not - * in any ISR. This setting is very efficient, but if more than one task - * (or ISR) start using the FPU, this can lead to corruption of the - * FPU registers. This option should be used with CAUTION. - */ - FPU->FPCCR &= ~((1U << FPU_FPCCR_ASPEN_Pos) - | (1U << FPU_FPCCR_LSPEN_Pos)); -#endif + /* NOTE The VFP (Floating Point Unit) unit is configured by QV-port */ /* configure Timer0, but don't enable the interrupt just yet */ SYSCTL->RCGCTIMER |= (1U << 0); /* enable Run mode for Timer0 */ diff --git a/examples/arm-cm/low-power_ek-tm4c123gxl/qxk/bsp.c b/examples/arm-cm/low-power_ek-tm4c123gxl/qxk/bsp.c index f54046a6..d26e233c 100644 --- a/examples/arm-cm/low-power_ek-tm4c123gxl/qxk/bsp.c +++ b/examples/arm-cm/low-power_ek-tm4c123gxl/qxk/bsp.c @@ -104,10 +104,7 @@ void BSP_init(void) { SYSCTL_XTAL_16MHZ); SystemCoreClock = XTAL_HZ; - /* FPU ( Floating Point Unit) configuration for QXK - * Use the automatic FPU state preservation and the FPU lazy stacking. - */ - FPU->FPCCR |= (1U << FPU_FPCCR_ASPEN_Pos) | (1U << FPU_FPCCR_LSPEN_Pos); + /* NOTE The VFP (Floating Point Unit) unit is configured by QXK-port */ /* configure Timer0, but don't enable the interrupt just yet */ SYSCTL->RCGCTIMER |= (1U << 0); /* enable Run mode for Timer0 */ diff --git a/examples/arm-cr/dpp_launchxl2-tms57012/dpp.h b/examples/arm-cr/dpp_launchxl2-tms57012/dpp.h index 83694d8f..da094c2c 100644 --- a/examples/arm-cr/dpp_launchxl2-tms57012/dpp.h +++ b/examples/arm-cr/dpp_launchxl2-tms57012/dpp.h @@ -3,7 +3,7 @@ * Model: dpp.qm * File: ${.::dpp.h} * -* This code has been generated by QM 5.2.2 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later diff --git a/examples/arm-cr/dpp_launchxl2-tms57012/dpp.qm b/examples/arm-cr/dpp_launchxl2-tms57012/dpp.qm index 908bccd8..f1256b39 100644 --- a/examples/arm-cr/dpp_launchxl2-tms57012/dpp.qm +++ b/examples/arm-cr/dpp_launchxl2-tms57012/dpp.qm @@ -1,5 +1,5 @@ - + Dining Philosopher Problem example diff --git a/examples/arm-cr/dpp_launchxl2-tms57012/philo.c b/examples/arm-cr/dpp_launchxl2-tms57012/philo.c index f79384e4..a5be8e68 100644 --- a/examples/arm-cr/dpp_launchxl2-tms57012/philo.c +++ b/examples/arm-cr/dpp_launchxl2-tms57012/philo.c @@ -3,7 +3,7 @@ * Model: dpp.qm * File: ${.::philo.c} * -* This code has been generated by QM 5.2.2 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later @@ -66,8 +66,8 @@ static QState Philo_eating(Philo * const me, QEvt const * const e); /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/examples/arm-cr/dpp_launchxl2-tms57012/table.c b/examples/arm-cr/dpp_launchxl2-tms57012/table.c index 95847d47..edfc073a 100644 --- a/examples/arm-cr/dpp_launchxl2-tms57012/table.c +++ b/examples/arm-cr/dpp_launchxl2-tms57012/table.c @@ -3,7 +3,7 @@ * Model: dpp.qm * File: ${.::table.c} * -* This code has been generated by QM 5.2.2 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later @@ -64,8 +64,8 @@ static QState Table_paused(Table * const me, QEvt const * const e); /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/examples/embos/arm-cm/dpp_nucleo-h743zi/bsp.c b/examples/embos/arm-cm/dpp_nucleo-h743zi/bsp.c index c68fa141..e111ccc4 100644 --- a/examples/embos/arm-cm/dpp_nucleo-h743zi/bsp.c +++ b/examples/embos/arm-cm/dpp_nucleo-h743zi/bsp.c @@ -217,10 +217,7 @@ void BSP_init(void) { __HAL_FLASH_ART_ENABLE(); #endif /* ART_ACCLERATOR_ENABLE */ - /* Explictily Disable the automatic FPU state preservation as well as - * the FPU lazy stacking - */ - FPU->FPCCR &= ~((1U << FPU_FPCCR_ASPEN_Pos) | (1U << FPU_FPCCR_LSPEN_Pos)); + /* NOTE The VFP (Floating Point Unit) unit is configured by EROS */ /* Configure the LEDs */ BSP_LED_Init(LED1); diff --git a/examples/embos/arm-cm/dpp_nucleo-h743zi/dpp.h b/examples/embos/arm-cm/dpp_nucleo-h743zi/dpp.h index 83694d8f..da094c2c 100644 --- a/examples/embos/arm-cm/dpp_nucleo-h743zi/dpp.h +++ b/examples/embos/arm-cm/dpp_nucleo-h743zi/dpp.h @@ -3,7 +3,7 @@ * Model: dpp.qm * File: ${.::dpp.h} * -* This code has been generated by QM 5.2.2 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later diff --git a/examples/embos/arm-cm/dpp_nucleo-h743zi/dpp.qm b/examples/embos/arm-cm/dpp_nucleo-h743zi/dpp.qm index 22312a29..b78ede00 100644 --- a/examples/embos/arm-cm/dpp_nucleo-h743zi/dpp.qm +++ b/examples/embos/arm-cm/dpp_nucleo-h743zi/dpp.qm @@ -1,5 +1,5 @@ - + Dining Philosopher Problem example @@ -145,18 +145,12 @@ Q_ASSERT(Q_EVT_CAST(TableEvt)->philoNum != PHILO_ID(me)); - + - uint8_t n; -(void)par; /* unused parameter */ + (void)par; /* unused parameter */ QS_OBJ_DICTIONARY(&l_table); -QS_FUN_DICTIONARY(&QHsm_top); -QS_FUN_DICTIONARY(&Table_initial); -QS_FUN_DICTIONARY(&Table_active); -QS_FUN_DICTIONARY(&Table_serving); -QS_FUN_DICTIONARY(&Table_paused); QS_SIG_DICTIONARY(DONE_SIG, (void *)0); /* global signals */ QS_SIG_DICTIONARY(EAT_SIG, (void *)0); @@ -171,7 +165,7 @@ QActive_subscribe(&me->super, PAUSE_SIG); QActive_subscribe(&me->super, SERVE_SIG); QActive_subscribe(&me->super, TEST_SIG); -for (n = 0U; n < N_PHILO; ++n) { +for (uint8_t n = 0U; n < N_PHILO; ++n) { me->fork[n] = FREE; me->isHungry[n] = 0U; BSP_displayPhilStat(n, "thinking"); diff --git a/examples/embos/arm-cm/dpp_nucleo-h743zi/gnu/Makefile b/examples/embos/arm-cm/dpp_nucleo-h743zi/gnu/Makefile index 9d153705..b71fb1ad 100644 --- a/examples/embos/arm-cm/dpp_nucleo-h743zi/gnu/Makefile +++ b/examples/embos/arm-cm/dpp_nucleo-h743zi/gnu/Makefile @@ -1,13 +1,13 @@ ############################################################################## # Product: Makefile for QP/C on NUCLEO-H743ZI, embOS RTOS, GNU-ARM -# Last Updated for Version: 7.0.1 -# Date of the Last Update: 2022-05-23 +# Last Updated for Version: 7.2.0 +# Date of the Last Update: 2022-12-13 # # Q u a n t u m L e a P s # ------------------------ # Modern Embedded Software # -# Copyright (C) 2005-2021 Quantum Leaps, LLC. All rights reserved. +# Copyright (C) 2005 Quantum Leaps, LLC. All rights reserved. # # This program is open source software: you can redistribute it and/or # modify it under the terms of the GNU General Public License as published @@ -152,7 +152,7 @@ LIBS := -losT7VLR # defines DEFINES := -DSTM32H743xx -DUSE_HAL_DRIVER -DUSE_STM32H7XX_NUCLEO_144 \ - -DQK_ON_CONTEXT_SW + -DQF_ON_CONTEXT_SW # ARM CPU, ARCH, FPU, and Float-ABI types... # ARM_CPU: [cortex-m0 | cortex-m0plus | cortex-m1 | cortex-m3 | cortex-m4] diff --git a/examples/embos/arm-cm/dpp_nucleo-h743zi/iar/dpp.ewp b/examples/embos/arm-cm/dpp_nucleo-h743zi/iar/dpp.ewp index 1defef89..9c168c23 100644 --- a/examples/embos/arm-cm/dpp_nucleo-h743zi/iar/dpp.ewp +++ b/examples/embos/arm-cm/dpp_nucleo-h743zi/iar/dpp.ewp @@ -2332,7 +2332,7 @@ - + - uint8_t n; -(void)par; /* unused parameter */ + (void)par; /* unused parameter */ QS_OBJ_DICTIONARY(&l_table); -QS_FUN_DICTIONARY(&QHsm_top); -QS_FUN_DICTIONARY(&Table_initial); -QS_FUN_DICTIONARY(&Table_active); -QS_FUN_DICTIONARY(&Table_serving); -QS_FUN_DICTIONARY(&Table_paused); QS_SIG_DICTIONARY(DONE_SIG, (void *)0); /* global signals */ QS_SIG_DICTIONARY(EAT_SIG, (void *)0); @@ -172,7 +166,7 @@ QActive_subscribe(&me->super, PAUSE_SIG); QActive_subscribe(&me->super, SERVE_SIG); QActive_subscribe(&me->super, TEST_SIG); -for (n = 0U; n < N_PHILO; ++n) { +for (uint8_t n = 0U; n < N_PHILO; ++n) { me->fork[n] = FREE; me->isHungry[n] = 0U; ESP_LOGI(TAG, "Philo%d thinking", n); diff --git a/examples/esp-idf/dpp-esp32devkitc/main/philo.c b/examples/esp-idf/dpp-esp32devkitc/main/philo.c index 997f6872..396c4cf1 100644 --- a/examples/esp-idf/dpp-esp32devkitc/main/philo.c +++ b/examples/esp-idf/dpp-esp32devkitc/main/philo.c @@ -3,7 +3,7 @@ * Model: dpp.qm * File: ${.::philo.c} * -* This code has been generated by QM 5.2.1 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later @@ -76,8 +76,8 @@ QActive * const AO_Philo[N_PHILO] = { /* "opaque" pointers to Philo AO */ /* Philo definition --------------------------------------------------------*/ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/examples/esp-idf/dpp-esp32devkitc/main/table.c b/examples/esp-idf/dpp-esp32devkitc/main/table.c index 7534a99b..9a0c3d19 100644 --- a/examples/esp-idf/dpp-esp32devkitc/main/table.c +++ b/examples/esp-idf/dpp-esp32devkitc/main/table.c @@ -3,7 +3,7 @@ * Model: dpp.qm * File: ${.::table.c} * -* This code has been generated by QM 5.2.1 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later @@ -69,8 +69,8 @@ QActive * const AO_Table = &l_table.super; /* "opaque" AO pointer */ /*..........................................................................*/ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ @@ -96,15 +96,9 @@ void Table_ctor(void) { /*${AOs::Table::SM} ........................................................*/ static QState Table_initial(Table * const me, void const * const par) { /*${AOs::Table::SM::initial} */ - uint8_t n; (void)par; /* unused parameter */ QS_OBJ_DICTIONARY(&l_table); - QS_FUN_DICTIONARY(&QHsm_top); - QS_FUN_DICTIONARY(&Table_initial); - QS_FUN_DICTIONARY(&Table_active); - QS_FUN_DICTIONARY(&Table_serving); - QS_FUN_DICTIONARY(&Table_paused); QS_SIG_DICTIONARY(DONE_SIG, (void *)0); /* global signals */ QS_SIG_DICTIONARY(EAT_SIG, (void *)0); @@ -119,11 +113,16 @@ static QState Table_initial(Table * const me, void const * const par) { QActive_subscribe(&me->super, SERVE_SIG); QActive_subscribe(&me->super, TEST_SIG); - for (n = 0U; n < N_PHILO; ++n) { + for (uint8_t n = 0U; n < N_PHILO; ++n) { me->fork[n] = FREE; me->isHungry[n] = 0U; ESP_LOGI(TAG, "Philo%d thinking", n); } + + QS_FUN_DICTIONARY(&Table_active); + QS_FUN_DICTIONARY(&Table_serving); + QS_FUN_DICTIONARY(&Table_paused); + return Q_TRAN(&Table_serving); } diff --git a/examples/freertos/arm-cm/dpp_ek-tm4c123gxl/armclang/dpp.uvoptx b/examples/freertos/arm-cm/dpp_ek-tm4c123gxl/armclang/dpp.uvoptx index 588bd5aa..ab67cde4 100644 --- a/examples/freertos/arm-cm/dpp_ek-tm4c123gxl/armclang/dpp.uvoptx +++ b/examples/freertos/arm-cm/dpp_ek-tm4c123gxl/armclang/dpp.uvoptx @@ -143,7 +143,56 @@ -U0E2006F4 -O4622 -S4 -FO61 - + + + 0 + 0 + 321 + 1 +
1050
+ 0 + 0 + 0 + 0 + 0 + 1 + ..\..\..\..\..\3rd_party\ek-tm4c123gxl\arm\startup_TM4C123GH6PM.s + + \\dpp\../../../../../3rd_party/ek-tm4c123gxl/arm/startup_TM4C123GH6PM.s\321 +
+ + 1 + 0 + 333 + 1 +
1056
+ 0 + 0 + 0 + 0 + 0 + 1 + ..\..\..\..\..\3rd_party\ek-tm4c123gxl\arm\startup_TM4C123GH6PM.s + + \\dpp\../../../../../3rd_party/ek-tm4c123gxl/arm/startup_TM4C123GH6PM.s\333 +
+ + 2 + 0 + 267 + 1 +
8136
+ 0 + 0 + 0 + 0 + 0 + 1 + ..\..\..\..\..\3rd_party\FreeRTOS\Source\portable\GCC\ARM_CM4F\port.c + + \\dpp\../../../../../3rd_party/FreeRTOS/Source/portable/GCC/ARM_CM4F/port.c\267 +
+
0 diff --git a/examples/freertos/arm-cm/dpp_ek-tm4c123gxl/bsp.c b/examples/freertos/arm-cm/dpp_ek-tm4c123gxl/bsp.c index b0e778ed..43514d76 100644 --- a/examples/freertos/arm-cm/dpp_ek-tm4c123gxl/bsp.c +++ b/examples/freertos/arm-cm/dpp_ek-tm4c123gxl/bsp.c @@ -1,7 +1,7 @@ /***************************************************************************** * Product: DPP example, EK-TM4C123GXL board, FreeRTOS kernel -* Last updated for version 7.1.3 -* Last updated on 2022-10-18 +* Last updated for version 7.2.0 +* Last updated on 2022-12-17 * * Q u a n t u m L e a P s * ------------------------ @@ -145,7 +145,7 @@ void vApplicationTickHook(void) { uint32_t depressed; uint32_t previous; } buttons = { 0U, 0U }; - uint32_t current = ~GPIOF->DATA_Bits[BTN_SW1 | BTN_SW2]; /* read SW1&SW2 */ + uint32_t current = ~GPIOF_AHB->DATA_Bits[BTN_SW1 | BTN_SW2]; /* read SW1&SW2 */ uint32_t tmp = buttons.depressed; /* save debounced depressed buttons */ buttons.depressed |= (buttons.previous & current); /* set depressed */ buttons.depressed &= (buttons.previous | current); /* clear released */ @@ -176,8 +176,8 @@ void vApplicationTickHook(void) { void vApplicationIdleHook(void) { /* toggle the User LED on and then off, see NOTE01 */ QF_INT_DISABLE(); - GPIOF->DATA_Bits[LED_BLUE] = 0xFFU; /* turn the Blue LED on */ - GPIOF->DATA_Bits[LED_BLUE] = 0U; /* turn the Blue LED off */ + GPIOF_AHB->DATA_Bits[LED_BLUE] = 0xFFU; /* turn the Blue LED on */ + GPIOF_AHB->DATA_Bits[LED_BLUE] = 0U; /* turn the Blue LED off */ QF_INT_ENABLE(); /* Some floating point code is to exercise the VFP... */ @@ -244,9 +244,125 @@ void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, *pulIdleTaskStackSize = Q_DIM(uxIdleTaskStack); } -/* BSP functions ===========================================================*/ +//* BSP functions ===========================================================*/ +/* MPU setup for TM4C123GXL MCU */ +static void TM4C123GXL_MPU_setup(void) { + /* The following MPU configuration contains the general TM4C memory map. + * + * Please note that the actual TM4C MCUs provide much less Flash and SRAM + * than the maximums configured here. This means that actual MCUs have + * unmapped memory regions (e.g., beyond the actual SRAM). Attempts to + * access these regions causes the HardFault exception, which is the + * desired behavior. + */ + static struct { + uint32_t rbar; + uint32_t rasr; + } const mpu_setup[] = { + { /* region #0: Flash: base=0x0000'0000, size=512M=2^(28+1) */ + 0x00000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 0U), /* region #0 */ + (28U << MPU_RASR_SIZE_Pos) /* 2^(18+1) region */ + | (0x6U << MPU_RASR_AP_Pos) /* PA:ro/UA:ro */ + | (1U << MPU_RASR_C_Pos) /* C=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #1: SRAM: base=0x2000'0000, size=512M=2^(28+1) */ + 0x20000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 1U), /* region #1 */ + (28U << MPU_RASR_SIZE_Pos) /* 2^(28+1) region */ + | (0x3U << MPU_RASR_AP_Pos) /* PA:rw/UA:rw */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | (1U << MPU_RASR_S_Pos) /* S=1 */ + | (1U << MPU_RASR_C_Pos) /* C=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + /* region #3: (not configured) */ + { MPU_RBAR_VALID_Msk | (MPU_RBAR_REGION_Msk & 2U), 0U }, + + { /* region #3: Peripherals: base=0x4000'0000, size=512M=2^(28+1) */ + 0x40000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 3U), /* region #3 */ + (28U << MPU_RASR_SIZE_Pos) /* 2^(28+1) region */ + | (0x3U << MPU_RASR_AP_Pos) /* PA:rw/UA:rw */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | (1U << MPU_RASR_S_Pos) /* S=1 */ + | (1U << MPU_RASR_B_Pos) /* B=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #4: Priv. Periph: base=0xE000'0000, size=512M=2^(28+1) */ + 0xE0000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 4U), /* region #4 */ + (28U << MPU_RASR_SIZE_Pos) /* 2^(28+1) region */ + | (0x3U << MPU_RASR_AP_Pos) /* PA:rw/UA:rw */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | (1U << MPU_RASR_S_Pos) /* S=1 */ + | (1U << MPU_RASR_B_Pos) /* B=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #5: Ext RAM: base=0x6000'0000, size=1G=2^(29+1) */ + 0x60000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 5U), /* region #5 */ + (29U << MPU_RASR_SIZE_Pos) /* 2^(28+1) region */ + | (0x3U << MPU_RASR_AP_Pos) /* PA:rw/UA:rw */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | (1U << MPU_RASR_S_Pos) /* S=1 */ + | (1U << MPU_RASR_B_Pos) /* B=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #6: Ext Dev: base=0xA000'0000, size=1G=2^(29+1) */ + 0xA0000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 6U), /* region #6 */ + (29U << MPU_RASR_SIZE_Pos) /* 2^(28+1) region */ + | (0x3U << MPU_RASR_AP_Pos) /* PA:rw/UA:rw */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | (1U << MPU_RASR_S_Pos) /* S=1 */ + | (1U << MPU_RASR_B_Pos) /* B=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #7: NULL-pointer: base=0x000'0000, size=256B */ + 0x00000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 7U), /* region #7 */ + (7U << MPU_RASR_SIZE_Pos) /* 2^(7+1)=256B region */ + | (0x0U << MPU_RASR_AP_Pos) /* PA:na/UA:na */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + }; + + /* enable the MemManage_Handler for MPU exception */ + SCB->SHCSR |= SCB_SHCSR_MEMFAULTENA_Msk; + + __DSB(); + MPU->CTRL = 0U; /* disable the MPU */ + for (uint_fast8_t n = 0U; n < Q_DIM(mpu_setup); ++n) { + MPU->RBAR = mpu_setup[n].rbar; + MPU->RASR = mpu_setup[n].rasr; + } + MPU->CTRL = MPU_CTRL_ENABLE_Msk; /* enable the MPU */ + __ISB(); + __DSB(); +} + +/*..........................................................................*/ void BSP_init(void) { - /* NOTE: SystemInit() has been already called from the startup code + /* setup the MPU... */ + TM4C123GXL_MPU_setup(); + + /* NOTE: SystemInit() already called from the startup code * but SystemCoreClock needs to be updated */ SystemCoreClockUpdate(); @@ -254,19 +370,29 @@ void BSP_init(void) { /* NOTE: The VFP (hardware Floating Point) unit is configured by FreeRTOS */ /* enable clock for to the peripherals used by this application... */ - SYSCTL->RCGCGPIO |= (1U << 5); /* enable Run mode for GPIOF */ + SYSCTL->RCGCGPIO |= (1U << 5); /* enable Run mode for GPIOF */ + SYSCTL->GPIOHBCTL |= (1U << 5); /* enable AHB for GPIOF */ + __ISB(); + __DSB(); - /* configure the LEDs and push buttons */ - GPIOF->DIR |= (LED_RED | LED_GREEN | LED_BLUE); /* set as output */ - GPIOF->DEN |= (LED_RED | LED_GREEN | LED_BLUE); /* digital enable */ - GPIOF->DATA_Bits[LED_RED] = 0U; /* turn the LED off */ - GPIOF->DATA_Bits[LED_GREEN] = 0U; /* turn the LED off */ - GPIOF->DATA_Bits[LED_BLUE] = 0U; /* turn the LED off */ + /* configure LEDs (digital output) */ + GPIOF_AHB->DIR |= (LED_RED | LED_BLUE | LED_GREEN); + GPIOF_AHB->DEN |= (LED_RED | LED_BLUE | LED_GREEN); + GPIOF_AHB->DATA_Bits[LED_RED | LED_BLUE | LED_GREEN] = 0U; - /* configure the User Switches */ - GPIOF->DIR &= ~(BTN_SW1 | BTN_SW2); /* set direction: input */ - ROM_GPIOPadConfigSet(GPIOF_BASE, (BTN_SW1 | BTN_SW2), - GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU); + /* configure switches... */ + + /* unlock access to the SW2 pin because it is PROTECTED */ + GPIOF_AHB->LOCK = 0x4C4F434BU; /* unlock GPIOCR register for SW2 */ + /* commit the write (cast const away) */ + *(uint32_t volatile *)&GPIOF_AHB->CR = 0x01U; + + GPIOF_AHB->DIR &= ~(BTN_SW1 | BTN_SW2); /* input */ + GPIOF_AHB->DEN |= (BTN_SW1 | BTN_SW2); /* digital enable */ + GPIOF_AHB->PUR |= (BTN_SW1 | BTN_SW2); /* pull-up resistor enable */ + + *(uint32_t volatile *)&GPIOF_AHB->CR = 0x00U; + GPIOF_AHB->LOCK = 0x0; /* lock GPIOCR register for SW2 */ BSP_randomSeed(1234U); @@ -286,7 +412,7 @@ void BSP_init(void) { } /*..........................................................................*/ void BSP_displayPhilStat(uint8_t n, char const *stat) { - GPIOF->DATA_Bits[LED_GREEN] = ((stat[0] == 'e') ? LED_GREEN : 0U); + GPIOF_AHB->DATA_Bits[LED_GREEN] = ((stat[0] == 'e') ? LED_GREEN : 0U); QS_BEGIN_ID(PHILO_STAT, AO_Philo[n]->prio) /* app-specific record */ QS_U8(1, n); /* Philosopher number */ @@ -295,7 +421,7 @@ void BSP_displayPhilStat(uint8_t n, char const *stat) { } /*..........................................................................*/ void BSP_displayPaused(uint8_t paused) { - GPIOF->DATA_Bits[LED_BLUE] = ((paused != 0U) ? LED_BLUE : 0U); + GPIOF_AHB->DATA_Bits[LED_BLUE] = ((paused != 0U) ? LED_BLUE : 0U); QS_BEGIN_ID(PAUSED_STAT, 0U) /* app-specific record */ QS_U8(1, paused); /* Paused status */ @@ -366,7 +492,7 @@ Q_NORETURN Q_onAssert(char const * const module, int_t const loc) { #ifndef NDEBUG /* light up all LEDs */ - GPIOF->DATA_Bits[LED_GREEN | LED_RED | LED_BLUE] = 0xFFU; + GPIOF_AHB->DATA_Bits[LED_GREEN | LED_RED | LED_BLUE] = 0xFFU; /* for debugging, hang on in an endless loop... */ for (;;) { } diff --git a/examples/freertos/arm-cm/dpp_ek-tm4c123gxl/dpp.h b/examples/freertos/arm-cm/dpp_ek-tm4c123gxl/dpp.h index 83694d8f..da094c2c 100644 --- a/examples/freertos/arm-cm/dpp_ek-tm4c123gxl/dpp.h +++ b/examples/freertos/arm-cm/dpp_ek-tm4c123gxl/dpp.h @@ -3,7 +3,7 @@ * Model: dpp.qm * File: ${.::dpp.h} * -* This code has been generated by QM 5.2.2 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later diff --git a/examples/freertos/arm-cm/dpp_ek-tm4c123gxl/dpp.qm b/examples/freertos/arm-cm/dpp_ek-tm4c123gxl/dpp.qm index 22312a29..b78ede00 100644 --- a/examples/freertos/arm-cm/dpp_ek-tm4c123gxl/dpp.qm +++ b/examples/freertos/arm-cm/dpp_ek-tm4c123gxl/dpp.qm @@ -1,5 +1,5 @@ - + Dining Philosopher Problem example @@ -145,18 +145,12 @@ Q_ASSERT(Q_EVT_CAST(TableEvt)->philoNum != PHILO_ID(me));
- + - uint8_t n; -(void)par; /* unused parameter */ + (void)par; /* unused parameter */ QS_OBJ_DICTIONARY(&l_table); -QS_FUN_DICTIONARY(&QHsm_top); -QS_FUN_DICTIONARY(&Table_initial); -QS_FUN_DICTIONARY(&Table_active); -QS_FUN_DICTIONARY(&Table_serving); -QS_FUN_DICTIONARY(&Table_paused); QS_SIG_DICTIONARY(DONE_SIG, (void *)0); /* global signals */ QS_SIG_DICTIONARY(EAT_SIG, (void *)0); @@ -171,7 +165,7 @@ QActive_subscribe(&me->super, PAUSE_SIG); QActive_subscribe(&me->super, SERVE_SIG); QActive_subscribe(&me->super, TEST_SIG); -for (n = 0U; n < N_PHILO; ++n) { +for (uint8_t n = 0U; n < N_PHILO; ++n) { me->fork[n] = FREE; me->isHungry[n] = 0U; BSP_displayPhilStat(n, "thinking"); diff --git a/examples/freertos/arm-cm/dpp_ek-tm4c123gxl/philo.c b/examples/freertos/arm-cm/dpp_ek-tm4c123gxl/philo.c index 05aef16c..7614912a 100644 --- a/examples/freertos/arm-cm/dpp_ek-tm4c123gxl/philo.c +++ b/examples/freertos/arm-cm/dpp_ek-tm4c123gxl/philo.c @@ -3,7 +3,7 @@ * Model: dpp.qm * File: ${.::philo.c} * -* This code has been generated by QM 5.2.2 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later @@ -76,8 +76,8 @@ QActive * const AO_Philo[N_PHILO] = { /* "opaque" pointers to Philo AO */ /* Philo definition --------------------------------------------------------*/ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/examples/freertos/arm-cm/dpp_ek-tm4c123gxl/table.c b/examples/freertos/arm-cm/dpp_ek-tm4c123gxl/table.c index a77305c8..d14c29d4 100644 --- a/examples/freertos/arm-cm/dpp_ek-tm4c123gxl/table.c +++ b/examples/freertos/arm-cm/dpp_ek-tm4c123gxl/table.c @@ -3,7 +3,7 @@ * Model: dpp.qm * File: ${.::table.c} * -* This code has been generated by QM 5.2.2 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later @@ -68,8 +68,8 @@ QActive * const AO_Table = &l_table.super; /* "opaque" AO pointer */ /*..........................................................................*/ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ @@ -95,15 +95,9 @@ void Table_ctor(void) { /*${AOs::Table::SM} ........................................................*/ static QState Table_initial(Table * const me, void const * const par) { /*${AOs::Table::SM::initial} */ - uint8_t n; (void)par; /* unused parameter */ QS_OBJ_DICTIONARY(&l_table); - QS_FUN_DICTIONARY(&QHsm_top); - QS_FUN_DICTIONARY(&Table_initial); - QS_FUN_DICTIONARY(&Table_active); - QS_FUN_DICTIONARY(&Table_serving); - QS_FUN_DICTIONARY(&Table_paused); QS_SIG_DICTIONARY(DONE_SIG, (void *)0); /* global signals */ QS_SIG_DICTIONARY(EAT_SIG, (void *)0); @@ -118,11 +112,16 @@ static QState Table_initial(Table * const me, void const * const par) { QActive_subscribe(&me->super, SERVE_SIG); QActive_subscribe(&me->super, TEST_SIG); - for (n = 0U; n < N_PHILO; ++n) { + for (uint8_t n = 0U; n < N_PHILO; ++n) { me->fork[n] = FREE; me->isHungry[n] = 0U; BSP_displayPhilStat(n, "thinking"); } + + QS_FUN_DICTIONARY(&Table_active); + QS_FUN_DICTIONARY(&Table_serving); + QS_FUN_DICTIONARY(&Table_paused); + return Q_TRAN(&Table_serving); } diff --git a/examples/freertos/arm-cm/dpp_nucleo-h743zi/armclang/dpp.uvprojx b/examples/freertos/arm-cm/dpp_nucleo-h743zi/armclang/dpp.uvprojx index 68873824..56af5276 100644 --- a/examples/freertos/arm-cm/dpp_nucleo-h743zi/armclang/dpp.uvprojx +++ b/examples/freertos/arm-cm/dpp_nucleo-h743zi/armclang/dpp.uvprojx @@ -1747,7 +1747,7 @@ 0 -Wno-padded - Q_SPY,QXK_ON_CONTEXT_SW,STM32H743xx,USE_HAL_DRIVER,USE_STM32H7XX_NUCLEO_144 + Q_SPY,QF_ON_CONTEXT_SW,STM32H743xx,USE_HAL_DRIVER,USE_STM32H7XX_NUCLEO_144 ..;..\..\..\..\..\include;..\..\..\..\..\ports\freertos;..\..\..\..\..\3rd_party\FreeRTOS\Source\include;..\..\..\..\..\3rd_party\FreeRTOS\Source\portable\GCC\ARM_CM7\r0p1;..\..\..\..\..\3rd_party\CMSIS\Include;..\..\..\..\..\3rd_party\STM32CubeH7\Drivers\CMSIS\Device\ST/STM32H7xx\Include;..\..\..\..\..\3rd_party\STM32CubeH7\Drivers\BSP\STM32H7xx_Nucleo_144;..\..\..\..\..\3rd_party\STM32CubeH7\Drivers\STM32H7xx_HAL_Driver\Inc diff --git a/examples/freertos/arm-cm/dpp_nucleo-h743zi/dpp.h b/examples/freertos/arm-cm/dpp_nucleo-h743zi/dpp.h index 83694d8f..da094c2c 100644 --- a/examples/freertos/arm-cm/dpp_nucleo-h743zi/dpp.h +++ b/examples/freertos/arm-cm/dpp_nucleo-h743zi/dpp.h @@ -3,7 +3,7 @@ * Model: dpp.qm * File: ${.::dpp.h} * -* This code has been generated by QM 5.2.2 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later diff --git a/examples/freertos/arm-cm/dpp_nucleo-h743zi/dpp.qm b/examples/freertos/arm-cm/dpp_nucleo-h743zi/dpp.qm index 22312a29..988dcbfa 100644 --- a/examples/freertos/arm-cm/dpp_nucleo-h743zi/dpp.qm +++ b/examples/freertos/arm-cm/dpp_nucleo-h743zi/dpp.qm @@ -1,5 +1,5 @@ - + Dining Philosopher Problem example @@ -148,15 +148,9 @@ Q_ASSERT(Q_EVT_CAST(TableEvt)->philoNum != PHILO_ID(me)); - uint8_t n; -(void)par; /* unused parameter */ + (void)par; /* unused parameter */ QS_OBJ_DICTIONARY(&l_table); -QS_FUN_DICTIONARY(&QHsm_top); -QS_FUN_DICTIONARY(&Table_initial); -QS_FUN_DICTIONARY(&Table_active); -QS_FUN_DICTIONARY(&Table_serving); -QS_FUN_DICTIONARY(&Table_paused); QS_SIG_DICTIONARY(DONE_SIG, (void *)0); /* global signals */ QS_SIG_DICTIONARY(EAT_SIG, (void *)0); @@ -171,7 +165,7 @@ QActive_subscribe(&me->super, PAUSE_SIG); QActive_subscribe(&me->super, SERVE_SIG); QActive_subscribe(&me->super, TEST_SIG); -for (n = 0U; n < N_PHILO; ++n) { +for (uint8_t n = 0U; n < N_PHILO; ++n) { me->fork[n] = FREE; me->isHungry[n] = 0U; BSP_displayPhilStat(n, "thinking"); diff --git a/examples/freertos/arm-cm/dpp_nucleo-h743zi/philo.c b/examples/freertos/arm-cm/dpp_nucleo-h743zi/philo.c index 05aef16c..7614912a 100644 --- a/examples/freertos/arm-cm/dpp_nucleo-h743zi/philo.c +++ b/examples/freertos/arm-cm/dpp_nucleo-h743zi/philo.c @@ -3,7 +3,7 @@ * Model: dpp.qm * File: ${.::philo.c} * -* This code has been generated by QM 5.2.2 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later @@ -76,8 +76,8 @@ QActive * const AO_Philo[N_PHILO] = { /* "opaque" pointers to Philo AO */ /* Philo definition --------------------------------------------------------*/ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/examples/freertos/arm-cm/dpp_nucleo-h743zi/table.c b/examples/freertos/arm-cm/dpp_nucleo-h743zi/table.c index a77305c8..b2345c2a 100644 --- a/examples/freertos/arm-cm/dpp_nucleo-h743zi/table.c +++ b/examples/freertos/arm-cm/dpp_nucleo-h743zi/table.c @@ -3,7 +3,7 @@ * Model: dpp.qm * File: ${.::table.c} * -* This code has been generated by QM 5.2.2 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later @@ -68,8 +68,8 @@ QActive * const AO_Table = &l_table.super; /* "opaque" AO pointer */ /*..........................................................................*/ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ @@ -95,15 +95,9 @@ void Table_ctor(void) { /*${AOs::Table::SM} ........................................................*/ static QState Table_initial(Table * const me, void const * const par) { /*${AOs::Table::SM::initial} */ - uint8_t n; (void)par; /* unused parameter */ QS_OBJ_DICTIONARY(&l_table); - QS_FUN_DICTIONARY(&QHsm_top); - QS_FUN_DICTIONARY(&Table_initial); - QS_FUN_DICTIONARY(&Table_active); - QS_FUN_DICTIONARY(&Table_serving); - QS_FUN_DICTIONARY(&Table_paused); QS_SIG_DICTIONARY(DONE_SIG, (void *)0); /* global signals */ QS_SIG_DICTIONARY(EAT_SIG, (void *)0); @@ -118,7 +112,7 @@ static QState Table_initial(Table * const me, void const * const par) { QActive_subscribe(&me->super, SERVE_SIG); QActive_subscribe(&me->super, TEST_SIG); - for (n = 0U; n < N_PHILO; ++n) { + for (uint8_t n = 0U; n < N_PHILO; ++n) { me->fork[n] = FREE; me->isHungry[n] = 0U; BSP_displayPhilStat(n, "thinking"); diff --git a/examples/lwip/arm-cm/lwip_ek-lm3s6965/lwipmgr.c b/examples/lwip/arm-cm/lwip_ek-lm3s6965/lwipmgr.c index 1f3613a4..f528aab2 100644 --- a/examples/lwip/arm-cm/lwip_ek-lm3s6965/lwipmgr.c +++ b/examples/lwip/arm-cm/lwip_ek-lm3s6965/lwipmgr.c @@ -1,7 +1,7 @@ /***************************************************************************** * Product: lwIP-Manager Active Object -* Last updated for version 7.0.1 -* Last updated on 2022-06-06 +* Last updated for version 7.2.0 +* Last updated on 2022-12-22 * * Q u a n t u m L e a P s * ------------------------ @@ -167,7 +167,6 @@ QState LwIPMgr_initial(LwIPMgr *me, QEvt const *e) { QS_OBJ_DICTIONARY(&l_lwIPMgr); QS_OBJ_DICTIONARY(&l_lwIPMgr.te_LWIP_SLOW_TICK); - QS_FUN_DICTIONARY(&QHsm_top); QS_FUN_DICTIONARY(&LwIPMgr_initial); QS_FUN_DICTIONARY(&LwIPMgr_running); diff --git a/examples/lwip/arm-cm/lwip_ek-lm3s6965/table.c b/examples/lwip/arm-cm/lwip_ek-lm3s6965/table.c index 1833d9c3..0b2d757e 100644 --- a/examples/lwip/arm-cm/lwip_ek-lm3s6965/table.c +++ b/examples/lwip/arm-cm/lwip_ek-lm3s6965/table.c @@ -1,7 +1,7 @@ /***************************************************************************** * Product: DPP example with lwIP and direct screen output -* Last updated for version 6.9.3 -* Last updated on 2021-03-03 +* Last updated for version 7.2.0 +* Last updated on 2022-12-22 * * Q u a n t u m L e a P s * ------------------------ @@ -116,7 +116,6 @@ QState Table_initial(Table *me, QEvt const *e) { QActive_subscribe((QActive *)me, DISPLAY_UDP_SIG); QS_OBJ_DICTIONARY(&l_table); - QS_FUN_DICTIONARY(&QHsm_top); QS_FUN_DICTIONARY(&Table_initial); QS_FUN_DICTIONARY(&Table_serving); diff --git a/examples/msp430/blinky_msp-exp430f5529lp/blinky.c b/examples/msp430/blinky_msp-exp430f5529lp/blinky.c index b570928b..96c48e60 100644 --- a/examples/msp430/blinky_msp-exp430f5529lp/blinky.c +++ b/examples/msp430/blinky_msp-exp430f5529lp/blinky.c @@ -1,7 +1,7 @@ /***************************************************************************** * Product: Simple Blinky example -* Last Updated for Version: 5.6.4 -* Date of the Last Update: 2016-06-05 +* Last Updated for Version: 7.2.0 +* Date of the Last Update: 2022-12-22 * * Q u a n t u m L e a P s * --------------------------- @@ -67,7 +67,6 @@ QState Blinky_initial(Blinky * const me, QEvt const * const e) { QS_OBJ_DICTIONARY(&l_blinky); QS_OBJ_DICTIONARY(&l_blinky.timeEvt); - QS_FUN_DICTIONARY(&QHsm_top); QS_FUN_DICTIONARY(&Blinky_initial); QS_FUN_DICTIONARY(&Blinky_off); QS_FUN_DICTIONARY(&Blinky_on); diff --git a/examples/msp430/dpp_msp-exp430f5529lp/dpp.h b/examples/msp430/dpp_msp-exp430f5529lp/dpp.h index afc340ee..accb54d9 100644 --- a/examples/msp430/dpp_msp-exp430f5529lp/dpp.h +++ b/examples/msp430/dpp_msp-exp430f5529lp/dpp.h @@ -3,7 +3,7 @@ * Model: dpp.qm * File: ${.::dpp.h} * -* This code has been generated by QM 5.2.1 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later diff --git a/examples/msp430/dpp_msp-exp430f5529lp/dpp.qm b/examples/msp430/dpp_msp-exp430f5529lp/dpp.qm index 0183c4e1..cb754c25 100644 --- a/examples/msp430/dpp_msp-exp430f5529lp/dpp.qm +++ b/examples/msp430/dpp_msp-exp430f5529lp/dpp.qm @@ -1,5 +1,5 @@ - + Dining Philosopher Problem example @@ -136,18 +136,12 @@ Q_ASSERT(Q_EVT_CAST(TableEvt)->philoNum != PHILO_ID(me)); - + - uint8_t n; -(void)par; /* unused parameter */ + (void)par; /* unused parameter */ QS_OBJ_DICTIONARY(&l_table); -QS_FUN_DICTIONARY(&QHsm_top); -QS_FUN_DICTIONARY(&Table_initial); -QS_FUN_DICTIONARY(&Table_active); -QS_FUN_DICTIONARY(&Table_serving); -QS_FUN_DICTIONARY(&Table_paused); QS_SIG_DICTIONARY(DONE_SIG, (void *)0); /* global signals */ QS_SIG_DICTIONARY(EAT_SIG, (void *)0); @@ -162,7 +156,7 @@ QActive_subscribe(&me->super, PAUSE_SIG); QActive_subscribe(&me->super, SERVE_SIG); QActive_subscribe(&me->super, TERMINATE_SIG); -for (n = 0U; n < N_PHILO; ++n) { +for (uint8_t n = 0U; n < N_PHILO; ++n) { me->fork[n] = FREE; me->isHungry[n] = 0U; BSP_displayPhilStat(n, "thinking"); diff --git a/examples/msp430/dpp_msp-exp430f5529lp/philo.c b/examples/msp430/dpp_msp-exp430f5529lp/philo.c index 6b3f54c4..fa689f8b 100644 --- a/examples/msp430/dpp_msp-exp430f5529lp/philo.c +++ b/examples/msp430/dpp_msp-exp430f5529lp/philo.c @@ -3,7 +3,7 @@ * Model: dpp.qm * File: ${.::philo.c} * -* This code has been generated by QM 5.2.1 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later @@ -76,8 +76,8 @@ QActive * const AO_Philo[N_PHILO] = { /* "opaque" pointers to Philo AO */ /* Philo definition --------------------------------------------------------*/ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/examples/msp430/dpp_msp-exp430f5529lp/table.c b/examples/msp430/dpp_msp-exp430f5529lp/table.c index c16a8a79..e51ee932 100644 --- a/examples/msp430/dpp_msp-exp430f5529lp/table.c +++ b/examples/msp430/dpp_msp-exp430f5529lp/table.c @@ -3,7 +3,7 @@ * Model: dpp.qm * File: ${.::table.c} * -* This code has been generated by QM 5.2.1 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later @@ -68,8 +68,8 @@ QActive * const AO_Table = &l_table.super; /* "opaque" AO pointer */ /*..........................................................................*/ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ @@ -95,15 +95,9 @@ void Table_ctor(void) { /*${AOs::Table::SM} ........................................................*/ static QState Table_initial(Table * const me, void const * const par) { /*${AOs::Table::SM::initial} */ - uint8_t n; (void)par; /* unused parameter */ QS_OBJ_DICTIONARY(&l_table); - QS_FUN_DICTIONARY(&QHsm_top); - QS_FUN_DICTIONARY(&Table_initial); - QS_FUN_DICTIONARY(&Table_active); - QS_FUN_DICTIONARY(&Table_serving); - QS_FUN_DICTIONARY(&Table_paused); QS_SIG_DICTIONARY(DONE_SIG, (void *)0); /* global signals */ QS_SIG_DICTIONARY(EAT_SIG, (void *)0); @@ -118,11 +112,16 @@ static QState Table_initial(Table * const me, void const * const par) { QActive_subscribe(&me->super, SERVE_SIG); QActive_subscribe(&me->super, TERMINATE_SIG); - for (n = 0U; n < N_PHILO; ++n) { + for (uint8_t n = 0U; n < N_PHILO; ++n) { me->fork[n] = FREE; me->isHungry[n] = 0U; BSP_displayPhilStat(n, "thinking"); } + + QS_FUN_DICTIONARY(&Table_active); + QS_FUN_DICTIONARY(&Table_serving); + QS_FUN_DICTIONARY(&Table_paused); + return Q_TRAN(&Table_serving); } diff --git a/examples/pic32/blinky_microstick2-pic32/blinky.c b/examples/pic32/blinky_microstick2-pic32/blinky.c index b570928b..96c48e60 100644 --- a/examples/pic32/blinky_microstick2-pic32/blinky.c +++ b/examples/pic32/blinky_microstick2-pic32/blinky.c @@ -1,7 +1,7 @@ /***************************************************************************** * Product: Simple Blinky example -* Last Updated for Version: 5.6.4 -* Date of the Last Update: 2016-06-05 +* Last Updated for Version: 7.2.0 +* Date of the Last Update: 2022-12-22 * * Q u a n t u m L e a P s * --------------------------- @@ -67,7 +67,6 @@ QState Blinky_initial(Blinky * const me, QEvt const * const e) { QS_OBJ_DICTIONARY(&l_blinky); QS_OBJ_DICTIONARY(&l_blinky.timeEvt); - QS_FUN_DICTIONARY(&QHsm_top); QS_FUN_DICTIONARY(&Blinky_initial); QS_FUN_DICTIONARY(&Blinky_off); QS_FUN_DICTIONARY(&Blinky_on); diff --git a/examples/pic32/dpp_microstick2-pic32/dpp.h b/examples/pic32/dpp_microstick2-pic32/dpp.h index afc340ee..accb54d9 100644 --- a/examples/pic32/dpp_microstick2-pic32/dpp.h +++ b/examples/pic32/dpp_microstick2-pic32/dpp.h @@ -3,7 +3,7 @@ * Model: dpp.qm * File: ${.::dpp.h} * -* This code has been generated by QM 5.2.1 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later diff --git a/examples/pic32/dpp_microstick2-pic32/dpp.qm b/examples/pic32/dpp_microstick2-pic32/dpp.qm index 0183c4e1..67fd0f80 100644 --- a/examples/pic32/dpp_microstick2-pic32/dpp.qm +++ b/examples/pic32/dpp_microstick2-pic32/dpp.qm @@ -1,5 +1,5 @@ - + Dining Philosopher Problem example @@ -139,15 +139,9 @@ Q_ASSERT(Q_EVT_CAST(TableEvt)->philoNum != PHILO_ID(me)); - uint8_t n; -(void)par; /* unused parameter */ + (void)par; /* unused parameter */ QS_OBJ_DICTIONARY(&l_table); -QS_FUN_DICTIONARY(&QHsm_top); -QS_FUN_DICTIONARY(&Table_initial); -QS_FUN_DICTIONARY(&Table_active); -QS_FUN_DICTIONARY(&Table_serving); -QS_FUN_DICTIONARY(&Table_paused); QS_SIG_DICTIONARY(DONE_SIG, (void *)0); /* global signals */ QS_SIG_DICTIONARY(EAT_SIG, (void *)0); @@ -162,7 +156,7 @@ QActive_subscribe(&me->super, PAUSE_SIG); QActive_subscribe(&me->super, SERVE_SIG); QActive_subscribe(&me->super, TERMINATE_SIG); -for (n = 0U; n < N_PHILO; ++n) { +for (uint8_t n = 0U; n < N_PHILO; ++n) { me->fork[n] = FREE; me->isHungry[n] = 0U; BSP_displayPhilStat(n, "thinking"); diff --git a/examples/pic32/dpp_microstick2-pic32/philo.c b/examples/pic32/dpp_microstick2-pic32/philo.c index 6b3f54c4..fa689f8b 100644 --- a/examples/pic32/dpp_microstick2-pic32/philo.c +++ b/examples/pic32/dpp_microstick2-pic32/philo.c @@ -3,7 +3,7 @@ * Model: dpp.qm * File: ${.::philo.c} * -* This code has been generated by QM 5.2.1 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later @@ -76,8 +76,8 @@ QActive * const AO_Philo[N_PHILO] = { /* "opaque" pointers to Philo AO */ /* Philo definition --------------------------------------------------------*/ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/examples/pic32/dpp_microstick2-pic32/table.c b/examples/pic32/dpp_microstick2-pic32/table.c index c16a8a79..6a452abe 100644 --- a/examples/pic32/dpp_microstick2-pic32/table.c +++ b/examples/pic32/dpp_microstick2-pic32/table.c @@ -3,7 +3,7 @@ * Model: dpp.qm * File: ${.::table.c} * -* This code has been generated by QM 5.2.1 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later @@ -68,8 +68,8 @@ QActive * const AO_Table = &l_table.super; /* "opaque" AO pointer */ /*..........................................................................*/ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ @@ -95,15 +95,9 @@ void Table_ctor(void) { /*${AOs::Table::SM} ........................................................*/ static QState Table_initial(Table * const me, void const * const par) { /*${AOs::Table::SM::initial} */ - uint8_t n; (void)par; /* unused parameter */ QS_OBJ_DICTIONARY(&l_table); - QS_FUN_DICTIONARY(&QHsm_top); - QS_FUN_DICTIONARY(&Table_initial); - QS_FUN_DICTIONARY(&Table_active); - QS_FUN_DICTIONARY(&Table_serving); - QS_FUN_DICTIONARY(&Table_paused); QS_SIG_DICTIONARY(DONE_SIG, (void *)0); /* global signals */ QS_SIG_DICTIONARY(EAT_SIG, (void *)0); @@ -118,7 +112,7 @@ static QState Table_initial(Table * const me, void const * const par) { QActive_subscribe(&me->super, SERVE_SIG); QActive_subscribe(&me->super, TERMINATE_SIG); - for (n = 0U; n < N_PHILO; ++n) { + for (uint8_t n = 0U; n < N_PHILO; ++n) { me->fork[n] = FREE; me->isHungry[n] = 0U; BSP_displayPhilStat(n, "thinking"); diff --git a/examples/qutest/blinky/blinky.qm b/examples/qutest/blinky/blinky.qm index 24048652..892ddedb 100644 --- a/examples/qutest/blinky/blinky.qm +++ b/examples/qutest/blinky/blinky.qm @@ -1,5 +1,5 @@ - + Blinky example diff --git a/examples/qutest/blinky/src/blinky.c b/examples/qutest/blinky/src/blinky.c index afe44954..bff0a277 100644 --- a/examples/qutest/blinky/src/blinky.c +++ b/examples/qutest/blinky/src/blinky.c @@ -3,7 +3,7 @@ * Model: blinky.qm * File: ${src::blinky.c} * -* This code has been generated by QM 5.2.1 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later @@ -56,8 +56,8 @@ static Blinky l_blinky; /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/examples/qutest/blinky/src/blinky.h b/examples/qutest/blinky/src/blinky.h index d528e3e6..cc0c961f 100644 --- a/examples/qutest/blinky/src/blinky.h +++ b/examples/qutest/blinky/src/blinky.h @@ -3,7 +3,7 @@ * Model: blinky.qm * File: ${src::blinky.h} * -* This code has been generated by QM 5.2.1 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later diff --git a/examples/qutest/blinky/src/bsp.c b/examples/qutest/blinky/src/bsp.c index 6af2c39f..cab0ff39 100644 --- a/examples/qutest/blinky/src/bsp.c +++ b/examples/qutest/blinky/src/bsp.c @@ -1,7 +1,7 @@ /***************************************************************************** * Product: "Blinky" example, Win32 API -* Last updated for version 6.2.0 -* Last updated on 2018-05-21 +* Last Updated for Version: 7.2.0 +* Date of the Last Update: 2022-12-22 * * Q u a n t u m L e a P s * --------------------------- @@ -43,7 +43,6 @@ enum { /*..........................................................................*/ void BSP_init() { - QS_FUN_DICTIONARY(&QHsm_top); QS_USR_DICTIONARY(LED); } /*..........................................................................*/ diff --git a/examples/qutest/blinky/test/Makefile b/examples/qutest/blinky/test/Makefile index 610a349b..8f433533 100644 --- a/examples/qutest/blinky/test/Makefile +++ b/examples/qutest/blinky/test/Makefile @@ -1,7 +1,7 @@ ############################################################################## # Product: Makefile for QUTEST-QP/C for Windows and POSIX *HOSTS* -# Last updated for version 7.1.3 -# Last updated on 2022-11-13 +# Last updated for version 7.2.0 +# Last updated on 2022-12-14 # # Q u a n t u m L e a P s # ------------------------ @@ -57,11 +57,11 @@ PROJECT := test_blinky # list of all source directories used by this project VPATH := . \ - ../src +../src # list of all include directories needed by this project INCLUDES := -I. \ - -I../src +-I../src # location of the QP/C framework (if not provided in an env. variable) ifeq ($(QPC),) @@ -79,8 +79,8 @@ endif # C source files... C_SRCS := \ - bsp.c \ - blinky.c \ +bsp.c \ +blinky.c \ test_blinky.c # C++ source files... @@ -96,8 +96,8 @@ DEFINES := # add QP/C framework: # C_SRCS += \ - qep_hsm.c \ - qep_msm.c \ +qep_hsm.c \ +qep_msm.c \ qf_act.c \ qf_actq.c \ qf_defer.c \ @@ -155,22 +155,20 @@ ifeq ("$(wildcard $(QUTEST))","") QUTEST := python3 $(QTOOLS)/qutest/qutest.py endif -TESTS := *.py - #----------------------------------------------------------------------------- # basic utilities (depends on the OS this Makefile runs on): # ifeq ($(OS),Windows_NT) - MKDIR := mkdir - RM := rm +MKDIR := mkdir +RM := rm TARGET_EXT := .exe else ifeq ($(OSTYPE),cygwin) - MKDIR := mkdir -p - RM := rm -f +MKDIR := mkdir -p +RM := rm -f TARGET_EXT := .exe else - MKDIR := mkdir -p - RM := rm -f +MKDIR := mkdir -p +RM := rm -f TARGET_EXT := endif @@ -180,19 +178,19 @@ endif BIN_DIR := build CFLAGS := -c -g -O -fno-pie -std=c11 -pedantic -Wall -Wextra -W \ - $(INCLUDES) $(DEFINES) -DQ_SPY -DQ_UTEST -DQ_HOST +$(INCLUDES) $(DEFINES) -DQ_SPY -DQ_UTEST -DQ_HOST CPPFLAGS := -c -g -O -fno-pie -std=c++11 -pedantic -Wall -Wextra \ - -fno-rtti -fno-exceptions \ - $(INCLUDES) $(DEFINES) -DQ_SPY -DQ_UTEST -DQ_HOST +-fno-rtti -fno-exceptions \ +$(INCLUDES) $(DEFINES) -DQ_SPY -DQ_UTEST -DQ_HOST ifndef GCC_OLD - LINKFLAGS := -no-pie +LINKFLAGS := -no-pie endif ifdef GCOV - CFLAGS += -fprofile-arcs -ftest-coverage - CPPFLAGS += -fprofile-arcs -ftest-coverage +CFLAGS += -fprofile-arcs -ftest-coverage +CPPFLAGS += -fprofile-arcs -ftest-coverage LINKFLAGS += -lgcov --coverage endif @@ -224,7 +222,7 @@ $(TARGET_EXE) : $(C_OBJS_EXT) $(CPP_OBJS_EXT) $(LINK) $(LINKFLAGS) $(LIB_DIRS) -o $@ $^ $(BIN_DIR)/qstamp.o $(LIBS) run : $(TARGET_EXE) - $(QUTEST) $(TESTS) $(TARGET_EXE) $(HOST) + $(QUTEST) -e$(TARGET_EXE) -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) $(BIN_DIR)/%.d : %.cpp $(CPP) -MM -MT $(@:.d=.o) $(CPPFLAGS) $< > $@ @@ -251,7 +249,7 @@ endif endif debug : - $(QUTEST) $(TESTS) DEBUG $(HOST) + $(QUTEST) -edebug -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) clean : -$(RM) $(BIN_DIR)/*.* diff --git a/examples/qutest/blinky/test/make_efm32 b/examples/qutest/blinky/test/make_efm32 index 2259baf7..18664afb 100644 --- a/examples/qutest/blinky/test/make_efm32 +++ b/examples/qutest/blinky/test/make_efm32 @@ -1,7 +1,7 @@ ############################################################################## # Product: Makefile for QP/C on EMF32, QUTEST, GNU-ARM -# Last Updated for Version: 7.1.0 -# Date of the Last Update: 2022-08-20 +# Last Updated for Version: 7.2.0 +# Date of the Last Update: 2022-12-21 # # Q u a n t u m L e a P s # ------------------------ @@ -193,8 +193,6 @@ ifeq ("$(wildcard $(QUTEST))","") QUTEST := python3 $(QTOOLS)/qutest/qutest.py endif -TESTS := *.py - #----------------------------------------------------------------------------- # build options # @@ -262,7 +260,7 @@ flash : $(FLASH) $(TARGET_BIN) run : $(TARGET_BIN) - $(QUTEST) $(TESTS) $(TARGET_EXE) $(HOST) + $(QUTEST) -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ diff --git a/examples/qutest/blinky/test/make_nucleo-h743zi b/examples/qutest/blinky/test/make_nucleo-h743zi new file mode 100644 index 00000000..ca6039b4 --- /dev/null +++ b/examples/qutest/blinky/test/make_nucleo-h743zi @@ -0,0 +1,332 @@ +############################################################################## +# Product: Makefile for QP/C on NUCLEO-H743ZI board, QUTEST, GNU-ARM +# Last Updated for Version: 7.2.0 +# Date of the Last Update: 2022-12-21 +# +# Q u a n t u m L e a P s +# ------------------------ +# Modern Embedded Software +# +# Copyright (C) 2005 Quantum Leaps, LLC. All rights reserved. +# +# This program is open source software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License as published +# 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 make_nucleo-l053r8 USB=e: # make, uplaod to USB drive, run the tests +# make -f make_nucleo-l053r8 USB=f: TESTS=philo*.py # make and run the selected tests +# make -f make_nucleo-l053r8 HOST=localhost:7705 # connect to host:port +# make -f make_nucleo-l053r8 norun # only make but not run the tests +# make -f make_nucleo-l053r8 clean # cleanup the build +# +# 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 +# + +#----------------------------------------------------------------------------- +# project name, target name, target directory: +# +PROJECT := test_blinky +TARGET := nucleo-h743zi +TARGET_DIR := ..\..\..\..\3rd_party\STM32CubeH7\qutest + +#----------------------------------------------------------------------------- +# project directories: +# + +# location of the QP/C framework (if not provided in an env. variable) +ifeq ($(QPC),) +QPC := ../../../.. +endif + +# QP port used in this project +QP_PORT_DIR := $(QPC)/ports/arm-cm/qutest + +# 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 := . \ + ../src \ + $(TARGET_DIR) \ + $(QPC)/src/qf \ + $(QPC)/src/qs \ + $(QP_PORT_DIR) \ + $(QPC)/3rd_party/STM32CubeH7/nucleo-h743zi/gnu \ + $(QPC)/3rd_party/STM32CubeH7/Drivers/BSP\STM32H7xx_Nucleo_144 \ + $(QPC)/3rd_party/STM32CubeH7/Drivers/STM32H7xx_HAL_Driver/Src \ + $(QPC)/3rd_party/STM32CubeH7/Drivers/CMSIS/Device/ST/STM32H7xx/Source/Templates + +# list of all include directories needed by this project +INCLUDES = -I. \ + -I../src \ + -I$(TARGET_DIR) \ + -I$(QPC)/include \ + -I$(QP_PORT_DIR) \ + -I$(QPC)/3rd_party/CMSIS/Include \ + -I$(QPC)/3rd_party/STM32CubeH7/Drivers/CMSIS/Device/ST/STM32H7xx/Include \ + -I$(QPC)/3rd_party/STM32CubeH7/Drivers/BSP/STM32H7xx_Nucleo_144 \ + -I$(QPC)/3rd_party/STM32CubeH7/Drivers/STM32H7xx_HAL_Driver/Inc + +#----------------------------------------------------------------------------- +# project files: +# + +# assembler source files +ASM_SRCS := + +# C source files +C_SRCS := \ + bsp.c \ + blinky.c \ + test_blinky.c \ + startup_stm32h743xx.c \ + system_stm32h7xx.c \ + stm32h7xx_nucleo_144.c \ + stm32h7xx_hal.c \ + stm32h7xx_hal_cortex.c \ + stm32h7xx_hal_gpio.c \ + stm32h7xx_hal_pwr_ex.c \ + stm32h7xx_hal_rcc.c \ + stm32h7xx_hal_rcc_ex.c \ + stm32h7xx_hal_msp.c \ + stm32h7xx_hal_uart.c + +# C++ source files +CPP_SRCS := + +OUTPUT := $(PROJECT) +LD_SCRIPT := $(TARGET_DIR)/qutest.ld + +QP_SRCS := \ + qep_hsm.c \ + qep_msm.c \ + qf_act.c \ + qf_actq.c \ + qf_defer.c \ + qf_dyn.c \ + qf_mem.c \ + qf_ps.c \ + qf_qact.c \ + qf_qeq.c \ + qf_qmact.c \ + qf_time.c \ + qs.c \ + qs_64bit.c \ + qs_rx.c \ + qs_fp.c \ + qutest.c \ + qutest_port.c + +QP_ASMS := + +LIB_DIRS := +LIBS := + +# defines +DEFINES := -DQP_API_VERSION=9999 \ + -DSTM32H743xx -DUSE_HAL_DRIVER -DUSE_STM32H7XX_NUCLEO_144 \ + -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-m7 +ARM_FPU := -mfpu=fpv5-d16 +FLOAT_ABI := -mfloat-abi=softfp + +#----------------------------------------------------------------------------- +# 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-gcc +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 soruces... +C_SRCS += $(QP_SRCS) +ASM_SRCS += $(QP_ASMS) + +BIN_DIR := build_$(TARGET) + +ASFLAGS = -g $(ARM_CPU) $(ARM_FPU) $(ASM_CPU) $(ASM_FPU) + +CFLAGS = -c -g $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ + -ffunction-sections -fdata-sections \ + -O $(INCLUDES) $(DEFINES) -DQ_SPY -DQ_UTEST + +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 + + +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 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) + $(CC) $(CFLAGS) $(QPC)/include/qstamp.c -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 $@ + +.PHONY : clean show + +# include dependency files only if our goal depends on their existence +ifneq ($(MAKECMDGOALS),clean) + ifneq ($(MAKECMDGOALS),show) +-include $(C_DEPS_EXT) $(CPP_DEPS_EXT) + endif +endif + +clean : + -$(RM) $(BIN_DIR)/*.o \ + $(BIN_DIR)/*.d \ + $(BIN_DIR)/*.bin \ + $(BIN_DIR)/*.elf \ + $(BIN_DIR)/*.map + +show : + @echo PROJECT = $(PROJECT) + @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/examples/qutest/blinky/test/make_nucleo-l053r8 b/examples/qutest/blinky/test/make_nucleo-l053r8 index 2587ed08..94b7e4af 100644 --- a/examples/qutest/blinky/test/make_nucleo-l053r8 +++ b/examples/qutest/blinky/test/make_nucleo-l053r8 @@ -1,7 +1,7 @@ ############################################################################## # Product: Makefile for QP/C on NUCLEO-L053R8 board, QUTEST, GNU-ARM -# Last Updated for Version: 7.1.0 -# Date of the Last Update: 2022-08-20 +# Last Updated for Version: 7.2.0 +# Date of the Last Update: 2022-12-21 # # Q u a n t u m L e a P s # ------------------------ @@ -167,11 +167,11 @@ LINK := $(GNU_ARM)/bin/arm-none-eabi-gcc BIN := $(GNU_ARM)/bin/arm-none-eabi-objcopy #----------------------------------------------------------------------------- -# NOTE: The following symbol USB assumes that the NUCLEO board +# NOTE: The symbol USB must be provided for the NUCLEO board # has enumerated as USB drive f: # ifeq ($(USB),) -USB := f: +$(error USB drive not provided for the NUCLEO board.) endif ############################################################################## @@ -192,8 +192,6 @@ ifeq ("$(wildcard $(QUTEST))","") QUTEST := python3 $(QTOOLS)/qutest/qutest.py endif -TESTS := *.py - #----------------------------------------------------------------------------- # build options # @@ -262,7 +260,7 @@ flash : $(CP) $(TARGET_BIN) $(USB) run : $(TARGET_BIN) - $(QUTEST) $(TESTS) $(TARGET_EXE) $(HOST) + $(QUTEST) -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ diff --git a/examples/qutest/blinky/test/make_tm4c123 b/examples/qutest/blinky/test/make_tm4c123 index c01f71b2..68e99e4a 100644 --- a/examples/qutest/blinky/test/make_tm4c123 +++ b/examples/qutest/blinky/test/make_tm4c123 @@ -1,7 +1,7 @@ ############################################################################## # Product: Makefile for QP/C on TM4C123, QUTEST, GNU-ARM -# Last Updated for Version: 7.1.0 -# Date of the Last Update: 2022-08-20 +# Last Updated for Version: 7.2.0 +# Date of the Last Update: 2022-12-21 # # Q u a n t u m L e a P s # ------------------------ @@ -108,7 +108,7 @@ C_SRCS := \ CPP_SRCS := OUTPUT := $(PROJECT) -LD_SCRIPT := $(TARGET_DIR)\qutest.ld +LD_SCRIPT := $(TARGET_DIR)/qutest.ld QP_SRCS := \ qep_hsm.c \ @@ -191,8 +191,6 @@ ifeq ("$(wildcard $(QUTEST))","") QUTEST := python3 $(QTOOLS)/qutest/qutest.py endif -TESTS := *.py - #----------------------------------------------------------------------------- # build options # @@ -265,7 +263,7 @@ flash : @echo Reset the board MANUALLY! run : $(TARGET_BIN) - $(QUTEST) $(TESTS) $(TARGET_EXE) $(HOST) + $(QUTEST) -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ @@ -282,15 +280,23 @@ $(BIN_DIR)/%.o : %.c $(BIN_DIR)/%.o : %.cpp $(CPP) $(CPPFLAGS) $< -o $@ -.PHONY : clean show - -# include dependency files only if our goal depends on their existence +# 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 \ @@ -300,6 +306,7 @@ clean : show : @echo PROJECT = $(PROJECT) + @echo MAKECMDGOALS = $(MAKECMDGOALS) @echo TESTS = $(TESTS) @echo TARGET_ELF = $(TARGET_ELF) @echo CONF = $(CONF) @@ -318,5 +325,6 @@ show : @echo QTOOLS = $(QTOOLS) @echo HOST = $(HOST) @echo QUTEST = $(QUTEST) + @echo FLASH = $(FLASH) @echo TESTS = $(TESTS) diff --git a/examples/qutest/blinky/test/test_blinky.c b/examples/qutest/blinky/test/test_blinky.c index 216e3bf2..ef64c8e7 100644 --- a/examples/qutest/blinky/test/test_blinky.c +++ b/examples/qutest/blinky/test/test_blinky.c @@ -39,8 +39,6 @@ Q_DEFINE_THIS_FILE /*..........................................................................*/ int main(int argc, char *argv[]) { - static QF_MPOOL_EL(QEvt) smlPoolSto[10]; /* storage for small pool*/ - static QEvt const *blinkyQSto[10]; /* event queue storage for Blinky */ QF_init(); /* initialize the framework */ @@ -58,10 +56,12 @@ int main(int argc, char *argv[]) { /* publish-subscribe not used, no call to QF_psInit() */ /* initialize event pools... */ + static QF_MPOOL_EL(QEvt) smlPoolSto[10]; /* storage for small pool*/ QF_poolInit(smlPoolSto, sizeof(smlPoolSto), sizeof(smlPoolSto[0])); /* start the active objects... */ Blinky_ctor(); + static QEvt const *blinkyQSto[10]; /* event queue storage for Blinky */ QACTIVE_START(AO_Blinky, 2U, /* QF-priority/preemption-threshold */ blinkyQSto, Q_DIM(blinkyQSto), @@ -80,19 +80,10 @@ void QS_onTestTeardown(void) { void QS_onCommand(uint8_t cmdId, uint32_t param1, uint32_t param2, uint32_t param3) { - switch (cmdId) { - case 0U: { - break; - } - default: - break; - } - - /* unused parameters... */ - (void)param1; - (void)param2; - (void)param3; - + Q_UNUSED_PAR(cmdId); + Q_UNUSED_PAR(param1); + Q_UNUSED_PAR(param2); + Q_UNUSED_PAR(param3); } /*..........................................................................*/ @@ -110,9 +101,8 @@ void QS_onTestEvt(QEvt *e) { void QS_onTestPost(void const *sender, QActive *recipient, QEvt const *e, bool status) { - /* unused parameters... */ - (void)sender; - (void)recipient; - (void)e; - (void)status; + Q_UNUSED_PAR(sender); + Q_UNUSED_PAR(recipient); + Q_UNUSED_PAR(e); + Q_UNUSED_PAR(status); } diff --git a/examples/qutest/dpp-comp/dpp-comp.qm b/examples/qutest/dpp-comp/dpp-comp.qm index 22fc1713..cb5cdd4b 100644 --- a/examples/qutest/dpp-comp/dpp-comp.qm +++ b/examples/qutest/dpp-comp/dpp-comp.qm @@ -1,5 +1,5 @@ - + Dining Philosopher Problem example with the "Orthogonal Component" state pattern (see https://state-machine.com/doc/Pattern_Orthogonal.pdf) The model demonstrates the following features: diff --git a/examples/qutest/dpp-comp/src/bsp.c b/examples/qutest/dpp-comp/src/bsp.c index aaae130b..c085f2c8 100644 --- a/examples/qutest/dpp-comp/src/bsp.c +++ b/examples/qutest/dpp-comp/src/bsp.c @@ -1,7 +1,7 @@ /***************************************************************************** * Product: DPP example, BSP for QUTest -* Last updated for: @ref qpc_7_0_0 -* Date of the Last Update: 2022-02-17 +* Last Updated for Version: 7.2.0 +* Date of the Last Update: 2022-12-22 * * Q u a n t u m L e a P s * ------------------------ @@ -51,7 +51,6 @@ void BSP_init(int argc, char **argv) { QS_FUN_DICTIONARY(&BSP_displayPhilStat); QS_FUN_DICTIONARY(&BSP_random); QS_FUN_DICTIONARY(&BSP_randomSeed); - QS_FUN_DICTIONARY(&QHsm_top); /* global signals */ QS_SIG_DICTIONARY(DONE_SIG, (void *)0); diff --git a/examples/qutest/dpp-comp/src/dpp.h b/examples/qutest/dpp-comp/src/dpp.h index 1e3217b4..80718cba 100644 --- a/examples/qutest/dpp-comp/src/dpp.h +++ b/examples/qutest/dpp-comp/src/dpp.h @@ -3,7 +3,7 @@ * Model: dpp-comp.qm * File: ${src::dpp.h} * -* This code has been generated by QM 5.2.1 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later diff --git a/examples/qutest/dpp-comp/src/philo.c b/examples/qutest/dpp-comp/src/philo.c index 08f906cb..5bbf3e92 100644 --- a/examples/qutest/dpp-comp/src/philo.c +++ b/examples/qutest/dpp-comp/src/philo.c @@ -3,7 +3,7 @@ * Model: dpp-comp.qm * File: ${src::philo.c} * -* This code has been generated by QM 5.2.1 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later @@ -64,8 +64,8 @@ static QState Philo_eating(Philo * const me, QEvt const * const e); /* definition of the whole "Comp" package */ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/examples/qutest/dpp-comp/src/table.c b/examples/qutest/dpp-comp/src/table.c index cfc58940..037af213 100644 --- a/examples/qutest/dpp-comp/src/table.c +++ b/examples/qutest/dpp-comp/src/table.c @@ -3,7 +3,7 @@ * Model: dpp-comp.qm * File: ${src::table.c} * -* This code has been generated by QM 5.2.1 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later @@ -64,8 +64,8 @@ static QState Table_paused(Table * const me, QEvt const * const e); /* definition of the whole "Cont" package */ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/examples/qutest/dpp-comp/test_dpp/Makefile b/examples/qutest/dpp-comp/test_dpp/Makefile index b13432fc..c697ac80 100644 --- a/examples/qutest/dpp-comp/test_dpp/Makefile +++ b/examples/qutest/dpp-comp/test_dpp/Makefile @@ -1,7 +1,7 @@ ############################################################################## # Product: Makefile for QUTEST-QP/C for Windows and POSIX *HOSTS* -# Last updated for version 7.1.3 -# Last updated on 2022-11-13 +# Last Updated for Version: 7.2.0 +# Date of the Last Update: 2022-12-21 # # Q u a n t u m L e a P s # ------------------------ @@ -157,8 +157,6 @@ ifeq ("$(wildcard $(QUTEST))","") QUTEST := python3 $(QTOOLS)/qutest/qutest.py endif -TESTS := *.py - #----------------------------------------------------------------------------- # basic utilities (depends on the OS this Makefile runs on): # @@ -226,7 +224,7 @@ $(TARGET_EXE) : $(C_OBJS_EXT) $(CPP_OBJS_EXT) $(LINK) $(LINKFLAGS) $(LIB_DIRS) -o $@ $^ $(BIN_DIR)/qstamp.o $(LIBS) run : $(TARGET_EXE) - $(QUTEST) $(TESTS) $(TARGET_EXE) $(HOST) + $(QUTEST) -e$(TARGET_EXE) -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) $(BIN_DIR)/%.d : %.cpp $(CPP) -MM -MT $(@:.d=.o) $(CPPFLAGS) $< > $@ @@ -253,7 +251,7 @@ endif endif debug : - $(QUTEST) $(TESTS) DEBUG $(HOST) + $(QUTEST) -edebug -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) clean : -$(RM) $(BIN_DIR)/*.* diff --git a/examples/qutest/dpp-comp/test_dpp/make_efm32 b/examples/qutest/dpp-comp/test_dpp/make_efm32 index d32785fc..036194a1 100644 --- a/examples/qutest/dpp-comp/test_dpp/make_efm32 +++ b/examples/qutest/dpp-comp/test_dpp/make_efm32 @@ -1,7 +1,7 @@ ############################################################################## # Product: Makefile for QP/C on EMF32, QUTEST, GNU-ARM -# Last Updated for Version: 7.1.0 -# Date of the Last Update: 2022-08-20 +# Last Updated for Version: 7.2.0 +# Date of the Last Update: 2022-12-21 # # Q u a n t u m L e a P s # ------------------------ @@ -195,8 +195,6 @@ ifeq ("$(wildcard $(QUTEST))","") QUTEST := python3 $(QTOOLS)/qutest/qutest.py endif -TESTS := *.py - #----------------------------------------------------------------------------- # build options # @@ -264,7 +262,7 @@ flash : $(FLASH) $(TARGET_BIN) run : $(TARGET_BIN) - $(QUTEST) $(TESTS) $(TARGET_EXE) $(HOST) + $(QUTEST) -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ diff --git a/examples/qutest/dpp-comp/test_dpp/make_nucleo-l053r8 b/examples/qutest/dpp-comp/test_dpp/make_nucleo-l053r8 index 2df9a1e5..d616f928 100644 --- a/examples/qutest/dpp-comp/test_dpp/make_nucleo-l053r8 +++ b/examples/qutest/dpp-comp/test_dpp/make_nucleo-l053r8 @@ -1,7 +1,7 @@ ############################################################################## # Product: Makefile for QP/C on NUCLEO-L053R8 board, QUTEST, GNU-ARM -# Last Updated for Version: 7.1.0 -# Date of the Last Update: 2022-08-20 +# Last Updated for Version: 7.2.0 +# Date of the Last Update: 2022-12-21 # # Q u a n t u m L e a P s # ------------------------ @@ -169,11 +169,11 @@ LINK := $(GNU_ARM)/bin/arm-none-eabi-gcc BIN := $(GNU_ARM)/bin/arm-none-eabi-objcopy #----------------------------------------------------------------------------- -# NOTE: The following symbol USB assumes that the NUCLEO board +# NOTE: The symbol USB must be provided for the NUCLEO board # has enumerated as USB drive f: # ifeq ($(USB),) -USB := f: +$(error USB drive not provided for the NUCLEO board.) endif ############################################################################## @@ -194,8 +194,6 @@ ifeq ("$(wildcard $(QUTEST))","") QUTEST := python3 $(QTOOLS)/qutest/qutest.py endif -TESTS := *.py - #----------------------------------------------------------------------------- # build options # @@ -264,7 +262,7 @@ flash : $(CP) $(TARGET_BIN) $(USB) run : $(TARGET_BIN) - $(QUTEST) $(TESTS) $(TARGET_EXE) $(HOST) + $(QUTEST) -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ diff --git a/examples/qutest/dpp-comp/test_dpp/make_posix b/examples/qutest/dpp-comp/test_dpp/make_posix index 862c6220..5731bfab 100644 --- a/examples/qutest/dpp-comp/test_dpp/make_posix +++ b/examples/qutest/dpp-comp/test_dpp/make_posix @@ -219,7 +219,7 @@ ifneq ($(MAKECMDGOALS),clean) endif test : - $(QUTEST) $(TESTS) $(TARGET_EXE) $(HOST) + $(QUTEST) -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) clean : -$(RM) $(BIN_DIR)/*.o \ $(BIN_DIR)/*.d \ diff --git a/examples/qutest/dpp-comp/test_dpp/make_tm4c123 b/examples/qutest/dpp-comp/test_dpp/make_tm4c123 index c441a099..2840c76b 100644 --- a/examples/qutest/dpp-comp/test_dpp/make_tm4c123 +++ b/examples/qutest/dpp-comp/test_dpp/make_tm4c123 @@ -1,7 +1,7 @@ ############################################################################## # Product: Makefile for QP/C on TM4C123, QUTEST, GNU-ARM -# Last Updated for Version: 7.1.0 -# Date of the Last Update: 2022-08-20 +# Last Updated for Version: 7.2.0 +# Date of the Last Update: 2022-12-21 # # Q u a n t u m L e a P s # ------------------------ @@ -193,8 +193,6 @@ ifeq ("$(wildcard $(QUTEST))","") QUTEST := python3 $(QTOOLS)/qutest/qutest.py endif -TESTS := *.py - #----------------------------------------------------------------------------- # build options # @@ -267,7 +265,7 @@ flash : @echo Reset the board MANUALLY! run : $(TARGET_BIN) - $(QUTEST) $(TESTS) $(TARGET_EXE) $(HOST) + $(QUTEST) -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ diff --git a/examples/qutest/dpp-comp/test_philo/Makefile b/examples/qutest/dpp-comp/test_philo/Makefile index 9ed494fb..828b7def 100644 --- a/examples/qutest/dpp-comp/test_philo/Makefile +++ b/examples/qutest/dpp-comp/test_philo/Makefile @@ -1,7 +1,7 @@ ############################################################################## # Product: Makefile for QUTEST-QP/C for Windows and POSIX *HOSTS* -# Last updated for version 7.1.3 -# Last updated on 2022-11-13 +# Last Updated for Version: 7.2.0 +# Date of the Last Update: 2022-12-21 # # Q u a n t u m L e a P s # ------------------------ @@ -155,8 +155,6 @@ ifeq ("$(wildcard $(QUTEST))","") QUTEST := python3 $(QTOOLS)/qutest/qutest.py endif -TESTS := *.py - #----------------------------------------------------------------------------- # basic utilities (depends on the OS this Makefile runs on): # @@ -224,7 +222,7 @@ $(TARGET_EXE) : $(C_OBJS_EXT) $(CPP_OBJS_EXT) $(LINK) $(LINKFLAGS) $(LIB_DIRS) -o $@ $^ $(BIN_DIR)/qstamp.o $(LIBS) run : $(TARGET_EXE) - $(QUTEST) $(TESTS) $(TARGET_EXE) $(HOST) + $(QUTEST) -e$(TARGET_EXE) -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) $(BIN_DIR)/%.d : %.cpp $(CPP) -MM -MT $(@:.d=.o) $(CPPFLAGS) $< > $@ @@ -251,7 +249,7 @@ endif endif debug : - $(QUTEST) $(TESTS) DEBUG $(HOST) + $(QUTEST) -edebug -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) clean : -$(RM) $(BIN_DIR)/*.* diff --git a/examples/qutest/dpp-comp/test_table/Makefile b/examples/qutest/dpp-comp/test_table/Makefile index 50a74fe3..f0e4c6db 100644 --- a/examples/qutest/dpp-comp/test_table/Makefile +++ b/examples/qutest/dpp-comp/test_table/Makefile @@ -1,7 +1,7 @@ ############################################################################## # Product: Makefile for QUTEST-QP/C for Windows and POSIX *HOSTS* -# Last updated for version 7.1.3 -# Last updated on 2022-11-13 +# Last Updated for Version: 7.2.0 +# Date of the Last Update: 2022-12-21 # # Q u a n t u m L e a P s # ------------------------ @@ -155,8 +155,6 @@ ifeq ("$(wildcard $(QUTEST))","") QUTEST := python3 $(QTOOLS)/qutest/qutest.py endif -TESTS := *.py - #----------------------------------------------------------------------------- # basic utilities (depends on the OS this Makefile runs on): # @@ -224,7 +222,7 @@ $(TARGET_EXE) : $(C_OBJS_EXT) $(CPP_OBJS_EXT) $(LINK) $(LINKFLAGS) $(LIB_DIRS) -o $@ $^ $(BIN_DIR)/qstamp.o $(LIBS) run : $(TARGET_EXE) - $(QUTEST) $(TESTS) $(TARGET_EXE) $(HOST) + $(QUTEST) -e$(TARGET_EXE) -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) $(BIN_DIR)/%.d : %.cpp $(CPP) -MM -MT $(@:.d=.o) $(CPPFLAGS) $< > $@ @@ -251,7 +249,7 @@ endif endif debug : - $(QUTEST) $(TESTS) DEBUG $(HOST) + $(QUTEST) -edebug -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) clean : -$(RM) $(BIN_DIR)/*.* diff --git a/examples/qutest/dpp-comp/test_table/make_tm4c123 b/examples/qutest/dpp-comp/test_table/make_tm4c123 index 9b540d58..dc4ff3d3 100644 --- a/examples/qutest/dpp-comp/test_table/make_tm4c123 +++ b/examples/qutest/dpp-comp/test_table/make_tm4c123 @@ -1,7 +1,7 @@ ############################################################################## # Product: Makefile for QP/C on TM4C123, QUTEST, GNU-ARM -# Last Updated for Version: 7.1.0 -# Date of the Last Update: 2022-08-20 +# Last Updated for Version: 7.2.0 +# Date of the Last Update: 2022-12-21 # # Q u a n t u m L e a P s # ------------------------ @@ -191,8 +191,6 @@ ifeq ("$(wildcard $(QUTEST))","") QUTEST := python3 $(QTOOLS)/qutest/qutest.py endif -TESTS := *.py - #----------------------------------------------------------------------------- # build options # @@ -265,7 +263,7 @@ flash : @echo Reset the board MANUALLY! run : $(TARGET_BIN) - $(QUTEST) $(TESTS) $(TARGET_EXE) $(HOST) + $(QUTEST) -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ diff --git a/examples/qutest/dpp/dpp.qm b/examples/qutest/dpp/dpp.qm index d5b75560..218618a3 100644 --- a/examples/qutest/dpp/dpp.qm +++ b/examples/qutest/dpp/dpp.qm @@ -1,5 +1,5 @@ - + Dining Philosopher Problem example diff --git a/examples/qutest/dpp/src/bsp.c b/examples/qutest/dpp/src/bsp.c index aaae130b..c085f2c8 100644 --- a/examples/qutest/dpp/src/bsp.c +++ b/examples/qutest/dpp/src/bsp.c @@ -1,7 +1,7 @@ /***************************************************************************** * Product: DPP example, BSP for QUTest -* Last updated for: @ref qpc_7_0_0 -* Date of the Last Update: 2022-02-17 +* Last Updated for Version: 7.2.0 +* Date of the Last Update: 2022-12-22 * * Q u a n t u m L e a P s * ------------------------ @@ -51,7 +51,6 @@ void BSP_init(int argc, char **argv) { QS_FUN_DICTIONARY(&BSP_displayPhilStat); QS_FUN_DICTIONARY(&BSP_random); QS_FUN_DICTIONARY(&BSP_randomSeed); - QS_FUN_DICTIONARY(&QHsm_top); /* global signals */ QS_SIG_DICTIONARY(DONE_SIG, (void *)0); diff --git a/examples/qutest/dpp/src/dpp.h b/examples/qutest/dpp/src/dpp.h index 720c9dc4..3bac33b5 100644 --- a/examples/qutest/dpp/src/dpp.h +++ b/examples/qutest/dpp/src/dpp.h @@ -3,7 +3,7 @@ * Model: dpp.qm * File: ${src::dpp.h} * -* This code has been generated by QM 5.2.2 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later diff --git a/examples/qutest/dpp/src/philo.c b/examples/qutest/dpp/src/philo.c index bc8b0ce9..0e370c08 100644 --- a/examples/qutest/dpp/src/philo.c +++ b/examples/qutest/dpp/src/philo.c @@ -3,7 +3,7 @@ * Model: dpp.qm * File: ${src::philo.c} * -* This code has been generated by QM 5.2.2 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later @@ -68,8 +68,8 @@ static QState Philo_eating(Philo * const me, QEvt const * const e); /* Shared objects ----------------------------------------------------------*/ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/examples/qutest/dpp/src/table.c b/examples/qutest/dpp/src/table.c index 98364a89..47a78d92 100644 --- a/examples/qutest/dpp/src/table.c +++ b/examples/qutest/dpp/src/table.c @@ -3,7 +3,7 @@ * Model: dpp.qm * File: ${src::table.c} * -* This code has been generated by QM 5.2.2 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later @@ -65,8 +65,8 @@ static QState Table_paused(Table * const me, QEvt const * const e); /* Shared objects ----------------------------------------------------------*/ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/examples/qutest/dpp/test_dpp/Makefile b/examples/qutest/dpp/test_dpp/Makefile index b13432fc..c697ac80 100644 --- a/examples/qutest/dpp/test_dpp/Makefile +++ b/examples/qutest/dpp/test_dpp/Makefile @@ -1,7 +1,7 @@ ############################################################################## # Product: Makefile for QUTEST-QP/C for Windows and POSIX *HOSTS* -# Last updated for version 7.1.3 -# Last updated on 2022-11-13 +# Last Updated for Version: 7.2.0 +# Date of the Last Update: 2022-12-21 # # Q u a n t u m L e a P s # ------------------------ @@ -157,8 +157,6 @@ ifeq ("$(wildcard $(QUTEST))","") QUTEST := python3 $(QTOOLS)/qutest/qutest.py endif -TESTS := *.py - #----------------------------------------------------------------------------- # basic utilities (depends on the OS this Makefile runs on): # @@ -226,7 +224,7 @@ $(TARGET_EXE) : $(C_OBJS_EXT) $(CPP_OBJS_EXT) $(LINK) $(LINKFLAGS) $(LIB_DIRS) -o $@ $^ $(BIN_DIR)/qstamp.o $(LIBS) run : $(TARGET_EXE) - $(QUTEST) $(TESTS) $(TARGET_EXE) $(HOST) + $(QUTEST) -e$(TARGET_EXE) -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) $(BIN_DIR)/%.d : %.cpp $(CPP) -MM -MT $(@:.d=.o) $(CPPFLAGS) $< > $@ @@ -253,7 +251,7 @@ endif endif debug : - $(QUTEST) $(TESTS) DEBUG $(HOST) + $(QUTEST) -edebug -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) clean : -$(RM) $(BIN_DIR)/*.* diff --git a/examples/qutest/dpp/test_dpp/make_efm32 b/examples/qutest/dpp/test_dpp/make_efm32 index e64fa07c..9b487d1a 100644 --- a/examples/qutest/dpp/test_dpp/make_efm32 +++ b/examples/qutest/dpp/test_dpp/make_efm32 @@ -1,7 +1,7 @@ ############################################################################## # Product: Makefile for QP/C on EMF32, QUTEST, GNU-ARM -# Last Updated for Version: 7.1.0 -# Date of the Last Update: 2022-08-20 +# Last Updated for Version: 7.2.0 +# Date of the Last Update: 2022-12-21 # # Q u a n t u m L e a P s # ------------------------ @@ -195,8 +195,6 @@ ifeq ("$(wildcard $(QUTEST))","") QUTEST := python3 $(QTOOLS)/qutest/qutest.py endif -TESTS := *.py - #----------------------------------------------------------------------------- # build options # @@ -264,7 +262,7 @@ flash : $(FLASH) $(TARGET_BIN) run : $(TARGET_BIN) - $(QUTEST) $(TESTS) $(TARGET_EXE) $(HOST) + $(QUTEST) -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ diff --git a/examples/qutest/dpp/test_dpp/make_nucleo-l053r8 b/examples/qutest/dpp/test_dpp/make_nucleo-l053r8 index 2df9a1e5..d616f928 100644 --- a/examples/qutest/dpp/test_dpp/make_nucleo-l053r8 +++ b/examples/qutest/dpp/test_dpp/make_nucleo-l053r8 @@ -1,7 +1,7 @@ ############################################################################## # Product: Makefile for QP/C on NUCLEO-L053R8 board, QUTEST, GNU-ARM -# Last Updated for Version: 7.1.0 -# Date of the Last Update: 2022-08-20 +# Last Updated for Version: 7.2.0 +# Date of the Last Update: 2022-12-21 # # Q u a n t u m L e a P s # ------------------------ @@ -169,11 +169,11 @@ LINK := $(GNU_ARM)/bin/arm-none-eabi-gcc BIN := $(GNU_ARM)/bin/arm-none-eabi-objcopy #----------------------------------------------------------------------------- -# NOTE: The following symbol USB assumes that the NUCLEO board +# NOTE: The symbol USB must be provided for the NUCLEO board # has enumerated as USB drive f: # ifeq ($(USB),) -USB := f: +$(error USB drive not provided for the NUCLEO board.) endif ############################################################################## @@ -194,8 +194,6 @@ ifeq ("$(wildcard $(QUTEST))","") QUTEST := python3 $(QTOOLS)/qutest/qutest.py endif -TESTS := *.py - #----------------------------------------------------------------------------- # build options # @@ -264,7 +262,7 @@ flash : $(CP) $(TARGET_BIN) $(USB) run : $(TARGET_BIN) - $(QUTEST) $(TESTS) $(TARGET_EXE) $(HOST) + $(QUTEST) -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ diff --git a/examples/qutest/dpp/test_dpp/make_posix b/examples/qutest/dpp/test_dpp/make_posix index 862c6220..5731bfab 100644 --- a/examples/qutest/dpp/test_dpp/make_posix +++ b/examples/qutest/dpp/test_dpp/make_posix @@ -219,7 +219,7 @@ ifneq ($(MAKECMDGOALS),clean) endif test : - $(QUTEST) $(TESTS) $(TARGET_EXE) $(HOST) + $(QUTEST) -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) clean : -$(RM) $(BIN_DIR)/*.o \ $(BIN_DIR)/*.d \ diff --git a/examples/qutest/dpp/test_dpp/make_tm4c123 b/examples/qutest/dpp/test_dpp/make_tm4c123 index c441a099..2840c76b 100644 --- a/examples/qutest/dpp/test_dpp/make_tm4c123 +++ b/examples/qutest/dpp/test_dpp/make_tm4c123 @@ -1,7 +1,7 @@ ############################################################################## # Product: Makefile for QP/C on TM4C123, QUTEST, GNU-ARM -# Last Updated for Version: 7.1.0 -# Date of the Last Update: 2022-08-20 +# Last Updated for Version: 7.2.0 +# Date of the Last Update: 2022-12-21 # # Q u a n t u m L e a P s # ------------------------ @@ -193,8 +193,6 @@ ifeq ("$(wildcard $(QUTEST))","") QUTEST := python3 $(QTOOLS)/qutest/qutest.py endif -TESTS := *.py - #----------------------------------------------------------------------------- # build options # @@ -267,7 +265,7 @@ flash : @echo Reset the board MANUALLY! run : $(TARGET_BIN) - $(QUTEST) $(TESTS) $(TARGET_EXE) $(HOST) + $(QUTEST) -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ diff --git a/examples/qutest/dpp/test_philo/Makefile b/examples/qutest/dpp/test_philo/Makefile index 9ed494fb..828b7def 100644 --- a/examples/qutest/dpp/test_philo/Makefile +++ b/examples/qutest/dpp/test_philo/Makefile @@ -1,7 +1,7 @@ ############################################################################## # Product: Makefile for QUTEST-QP/C for Windows and POSIX *HOSTS* -# Last updated for version 7.1.3 -# Last updated on 2022-11-13 +# Last Updated for Version: 7.2.0 +# Date of the Last Update: 2022-12-21 # # Q u a n t u m L e a P s # ------------------------ @@ -155,8 +155,6 @@ ifeq ("$(wildcard $(QUTEST))","") QUTEST := python3 $(QTOOLS)/qutest/qutest.py endif -TESTS := *.py - #----------------------------------------------------------------------------- # basic utilities (depends on the OS this Makefile runs on): # @@ -224,7 +222,7 @@ $(TARGET_EXE) : $(C_OBJS_EXT) $(CPP_OBJS_EXT) $(LINK) $(LINKFLAGS) $(LIB_DIRS) -o $@ $^ $(BIN_DIR)/qstamp.o $(LIBS) run : $(TARGET_EXE) - $(QUTEST) $(TESTS) $(TARGET_EXE) $(HOST) + $(QUTEST) -e$(TARGET_EXE) -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) $(BIN_DIR)/%.d : %.cpp $(CPP) -MM -MT $(@:.d=.o) $(CPPFLAGS) $< > $@ @@ -251,7 +249,7 @@ endif endif debug : - $(QUTEST) $(TESTS) DEBUG $(HOST) + $(QUTEST) -edebug -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) clean : -$(RM) $(BIN_DIR)/*.* diff --git a/examples/qutest/dpp/test_table/Makefile b/examples/qutest/dpp/test_table/Makefile index 50a74fe3..f0e4c6db 100644 --- a/examples/qutest/dpp/test_table/Makefile +++ b/examples/qutest/dpp/test_table/Makefile @@ -1,7 +1,7 @@ ############################################################################## # Product: Makefile for QUTEST-QP/C for Windows and POSIX *HOSTS* -# Last updated for version 7.1.3 -# Last updated on 2022-11-13 +# Last Updated for Version: 7.2.0 +# Date of the Last Update: 2022-12-21 # # Q u a n t u m L e a P s # ------------------------ @@ -155,8 +155,6 @@ ifeq ("$(wildcard $(QUTEST))","") QUTEST := python3 $(QTOOLS)/qutest/qutest.py endif -TESTS := *.py - #----------------------------------------------------------------------------- # basic utilities (depends on the OS this Makefile runs on): # @@ -224,7 +222,7 @@ $(TARGET_EXE) : $(C_OBJS_EXT) $(CPP_OBJS_EXT) $(LINK) $(LINKFLAGS) $(LIB_DIRS) -o $@ $^ $(BIN_DIR)/qstamp.o $(LIBS) run : $(TARGET_EXE) - $(QUTEST) $(TESTS) $(TARGET_EXE) $(HOST) + $(QUTEST) -e$(TARGET_EXE) -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) $(BIN_DIR)/%.d : %.cpp $(CPP) -MM -MT $(@:.d=.o) $(CPPFLAGS) $< > $@ @@ -251,7 +249,7 @@ endif endif debug : - $(QUTEST) $(TESTS) DEBUG $(HOST) + $(QUTEST) -edebug -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) clean : -$(RM) $(BIN_DIR)/*.* diff --git a/examples/qutest/dpp/test_table/make_efm32 b/examples/qutest/dpp/test_table/make_efm32 index 006478e0..7fe95c6e 100644 --- a/examples/qutest/dpp/test_table/make_efm32 +++ b/examples/qutest/dpp/test_table/make_efm32 @@ -1,7 +1,7 @@ ############################################################################## # Product: Makefile for QP/C on EMF32, QUTEST, GNU-ARM -# Last Updated for Version: 7.1.0 -# Date of the Last Update: 2022-08-20 +# Last Updated for Version: 7.2.0 +# Date of the Last Update: 2022-12-21 # # Q u a n t u m L e a P s # ------------------------ @@ -193,8 +193,6 @@ ifeq ("$(wildcard $(QUTEST))","") QUTEST := python3 $(QTOOLS)/qutest/qutest.py endif -TESTS := *.py - #----------------------------------------------------------------------------- # build options # @@ -262,7 +260,7 @@ flash : $(FLASH) $(TARGET_BIN) run : $(TARGET_BIN) - $(QUTEST) $(TESTS) $(TARGET_EXE) $(HOST) + $(QUTEST) -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ diff --git a/examples/qutest/dpp/test_table/make_tm4c123 b/examples/qutest/dpp/test_table/make_tm4c123 index 9b540d58..dc4ff3d3 100644 --- a/examples/qutest/dpp/test_table/make_tm4c123 +++ b/examples/qutest/dpp/test_table/make_tm4c123 @@ -1,7 +1,7 @@ ############################################################################## # Product: Makefile for QP/C on TM4C123, QUTEST, GNU-ARM -# Last Updated for Version: 7.1.0 -# Date of the Last Update: 2022-08-20 +# Last Updated for Version: 7.2.0 +# Date of the Last Update: 2022-12-21 # # Q u a n t u m L e a P s # ------------------------ @@ -191,8 +191,6 @@ ifeq ("$(wildcard $(QUTEST))","") QUTEST := python3 $(QTOOLS)/qutest/qutest.py endif -TESTS := *.py - #----------------------------------------------------------------------------- # build options # @@ -265,7 +263,7 @@ flash : @echo Reset the board MANUALLY! run : $(TARGET_BIN) - $(QUTEST) $(TESTS) $(TARGET_EXE) $(HOST) + $(QUTEST) -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ diff --git a/examples/qutest/dpp/test_table/test_table.c b/examples/qutest/dpp/test_table/test_table.c index 0ce6acad..199bcce7 100644 --- a/examples/qutest/dpp/test_table/test_table.c +++ b/examples/qutest/dpp/test_table/test_table.c @@ -59,7 +59,6 @@ int main(int argc, char *argv[]) { QF_init(); /* initialize the framework and the underlying RT kernel */ BSP_init(argc, argv); /* initialize the Board Support Package */ - QS_OBJ_DICTIONARY(&Philo_inst[0]); QS_OBJ_DICTIONARY(&Philo_inst[1]); QS_OBJ_DICTIONARY(&Philo_inst[2]); diff --git a/examples/qutest/evt_par/src/my_ao.c b/examples/qutest/evt_par/src/my_ao.c index fadb82bb..e2cd2f0b 100644 --- a/examples/qutest/evt_par/src/my_ao.c +++ b/examples/qutest/evt_par/src/my_ao.c @@ -30,7 +30,6 @@ void MyAO_ctor(void) { static QState MyAO_initial(MyAO * const me, QEvt const * const e) { (void)e; /* unused parameter */ - QS_FUN_DICTIONARY(&QHsm_top); QS_FUN_DICTIONARY(&MyAO_initial); QS_FUN_DICTIONARY(&MyAO_active); diff --git a/examples/qutest/evt_par/test/Makefile b/examples/qutest/evt_par/test/Makefile index 00f1fe1c..0f9ddc06 100644 --- a/examples/qutest/evt_par/test/Makefile +++ b/examples/qutest/evt_par/test/Makefile @@ -1,7 +1,7 @@ ############################################################################## # Product: Makefile for QUTEST-QP/C for Windows and POSIX *HOSTS* -# Last updated for version 7.1.3 -# Last updated on 2022-11-13 +# Last Updated for Version: 7.2.0 +# Date of the Last Update: 2022-12-21 # # Q u a n t u m L e a P s # ------------------------ @@ -154,8 +154,6 @@ ifeq ("$(wildcard $(QUTEST))","") QUTEST := python3 $(QTOOLS)/qutest/qutest.py endif -TESTS := *.py - #----------------------------------------------------------------------------- # basic utilities (depends on the OS this Makefile runs on): # @@ -223,7 +221,7 @@ $(TARGET_EXE) : $(C_OBJS_EXT) $(CPP_OBJS_EXT) $(LINK) $(LINKFLAGS) $(LIB_DIRS) -o $@ $^ $(BIN_DIR)/qstamp.o $(LIBS) run : $(TARGET_EXE) - $(QUTEST) $(TESTS) $(TARGET_EXE) $(HOST) + $(QUTEST) -e$(TARGET_EXE) -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) $(BIN_DIR)/%.d : %.cpp $(CPP) -MM -MT $(@:.d=.o) $(CPPFLAGS) $< > $@ @@ -250,7 +248,7 @@ endif endif debug : - $(QUTEST) $(TESTS) DEBUG $(HOST) + $(QUTEST) -edebug -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) clean : -$(RM) $(BIN_DIR)/*.* diff --git a/examples/qutest/evt_par/test/make_tm4c123 b/examples/qutest/evt_par/test/make_tm4c123 index bead5783..e5774af3 100644 --- a/examples/qutest/evt_par/test/make_tm4c123 +++ b/examples/qutest/evt_par/test/make_tm4c123 @@ -1,7 +1,7 @@ ############################################################################## # Product: Makefile for QP/C on TM4C123, QUTEST, GNU-ARM -# Last Updated for Version: 7.1.0 -# Date of the Last Update: 2022-08-20 +# Last Updated for Version: 7.2.0 +# Date of the Last Update: 2022-12-21 # # Q u a n t u m L e a P s # ------------------------ @@ -190,8 +190,6 @@ ifeq ("$(wildcard $(QUTEST))","") QUTEST := python3 $(QTOOLS)/qutest/qutest.py endif -TESTS := *.py - #----------------------------------------------------------------------------- # build options # @@ -264,7 +262,7 @@ flash : @echo Reset the board MANUALLY! run : $(TARGET_BIN) - $(QUTEST) $(TESTS) $(TARGET_EXE) $(HOST) + $(QUTEST) -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ diff --git a/examples/qutest/qhsmtst/qhsmtst.qm b/examples/qutest/qhsmtst/qhsmtst.qm index 0b798230..cc0bc557 100644 --- a/examples/qutest/qhsmtst/qhsmtst.qm +++ b/examples/qutest/qhsmtst/qhsmtst.qm @@ -1,5 +1,5 @@ - + QHsmTst is a contrived state machine from Chapter 2 of the PSiCC2 book for testing all possible transition topologies with up to 4-levels of state nesting. diff --git a/examples/qutest/qhsmtst/src/qhsmtst.c b/examples/qutest/qhsmtst/src/qhsmtst.c index 67866b74..5e20d3a0 100644 --- a/examples/qutest/qhsmtst/src/qhsmtst.c +++ b/examples/qutest/qhsmtst/src/qhsmtst.c @@ -3,7 +3,7 @@ * Model: qhsmtst.qm * File: ${src::qhsmtst.c} * -* This code has been generated by QM 5.2.1 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later @@ -59,8 +59,8 @@ QHsm * const the_hsm = (QHsm *)&l_hsmtst; /* the opaque pointer */ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/examples/qutest/qhsmtst/src/qhsmtst.h b/examples/qutest/qhsmtst/src/qhsmtst.h index 3caa9b73..e18b1542 100644 --- a/examples/qutest/qhsmtst/src/qhsmtst.h +++ b/examples/qutest/qhsmtst/src/qhsmtst.h @@ -3,7 +3,7 @@ * Model: qhsmtst.qm * File: ${src::qhsmtst.h} * -* This code has been generated by QM 5.2.1 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later diff --git a/examples/qutest/qhsmtst/test/Makefile b/examples/qutest/qhsmtst/test/Makefile index 04c8175c..8119e1d0 100644 --- a/examples/qutest/qhsmtst/test/Makefile +++ b/examples/qutest/qhsmtst/test/Makefile @@ -1,7 +1,7 @@ ############################################################################## # Product: Makefile for QUTEST-QP/C for Windows and POSIX *HOSTS* -# Last updated for version 7.1.3 -# Last updated on 2022-11-13 +# Last Updated for Version: 7.2.0 +# Date of the Last Update: 2022-12-21 # # Q u a n t u m L e a P s # ------------------------ @@ -154,8 +154,6 @@ ifeq ("$(wildcard $(QUTEST))","") QUTEST := python3 $(QTOOLS)/qutest/qutest.py endif -TESTS := *.py - #----------------------------------------------------------------------------- # basic utilities (depends on the OS this Makefile runs on): # @@ -223,7 +221,7 @@ $(TARGET_EXE) : $(C_OBJS_EXT) $(CPP_OBJS_EXT) $(LINK) $(LINKFLAGS) $(LIB_DIRS) -o $@ $^ $(BIN_DIR)/qstamp.o $(LIBS) run : $(TARGET_EXE) - $(QUTEST) $(TESTS) $(TARGET_EXE) $(HOST) + $(QUTEST) -e$(TARGET_EXE) -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) $(BIN_DIR)/%.d : %.cpp $(CPP) -MM -MT $(@:.d=.o) $(CPPFLAGS) $< > $@ @@ -250,7 +248,7 @@ endif endif debug : - $(QUTEST) $(TESTS) DEBUG $(HOST) + $(QUTEST) -edebug -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) clean : -$(RM) $(BIN_DIR)/*.* diff --git a/examples/qutest/qhsmtst/test/make_efm32 b/examples/qutest/qhsmtst/test/make_efm32 index 5ddf82de..80832a45 100644 --- a/examples/qutest/qhsmtst/test/make_efm32 +++ b/examples/qutest/qhsmtst/test/make_efm32 @@ -1,7 +1,7 @@ ############################################################################## # Product: Makefile for QP/C on EMF32, QUTEST, GNU-ARM -# Last Updated for Version: 7.1.0 -# Date of the Last Update: 2022-08-20 +# Last Updated for Version: 7.2.0 +# Date of the Last Update: 2022-12-21 # # Q u a n t u m L e a P s # ------------------------ @@ -192,8 +192,6 @@ ifeq ("$(wildcard $(QUTEST))","") QUTEST := python3 $(QTOOLS)/qutest/qutest.py endif -TESTS := *.py - #----------------------------------------------------------------------------- # build options # @@ -261,7 +259,7 @@ flash : $(FLASH) $(TARGET_BIN) run : $(TARGET_BIN) - $(QUTEST) $(TESTS) $(TARGET_EXE) $(HOST) + $(QUTEST) -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ diff --git a/examples/qutest/qhsmtst/test/make_nucleo-l053r8 b/examples/qutest/qhsmtst/test/make_nucleo-l053r8 index 42104d3b..c4e3c945 100644 --- a/examples/qutest/qhsmtst/test/make_nucleo-l053r8 +++ b/examples/qutest/qhsmtst/test/make_nucleo-l053r8 @@ -1,7 +1,7 @@ ############################################################################## # Product: Makefile for QP/C on NUCLEO-L053R8 board, QUTEST, GNU-ARM -# Last Updated for Version: 7.1.0 -# Date of the Last Update: 2022-08-20 +# Last Updated for Version: 7.2.0 +# Date of the Last Update: 2022-12-21 # # Q u a n t u m L e a P s # ------------------------ @@ -166,11 +166,11 @@ LINK := $(GNU_ARM)/bin/arm-none-eabi-gcc BIN := $(GNU_ARM)/bin/arm-none-eabi-objcopy #----------------------------------------------------------------------------- -# NOTE: The following symbol USB assumes that the NUCLEO board +# NOTE: The symbol USB must be provided for the NUCLEO board # has enumerated as USB drive f: # ifeq ($(USB),) -USB := f: +$(error USB drive not provided for the NUCLEO board.) endif ############################################################################## @@ -191,8 +191,6 @@ ifeq ("$(wildcard $(QUTEST))","") QUTEST := python3 $(QTOOLS)/qutest/qutest.py endif -TESTS := *.py - #----------------------------------------------------------------------------- # build options # @@ -261,7 +259,7 @@ flash : $(CP) $(TARGET_BIN) $(USB) run : $(TARGET_BIN) - $(QUTEST) $(TESTS) $(TARGET_EXE) $(HOST) + $(QUTEST) -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ diff --git a/examples/qutest/qhsmtst/test/make_tm4c123 b/examples/qutest/qhsmtst/test/make_tm4c123 index 0ea5d58f..39b7b31e 100644 --- a/examples/qutest/qhsmtst/test/make_tm4c123 +++ b/examples/qutest/qhsmtst/test/make_tm4c123 @@ -1,7 +1,7 @@ ############################################################################## # Product: Makefile for QP/C on TM4C123, QUTEST, GNU-ARM -# Last Updated for Version: 7.1.0 -# Date of the Last Update: 2022-08-20 +# Last Updated for Version: 7.2.0 +# Date of the Last Update: 2022-12-21 # # Q u a n t u m L e a P s # ------------------------ @@ -190,8 +190,6 @@ ifeq ("$(wildcard $(QUTEST))","") QUTEST := python3 $(QTOOLS)/qutest/qutest.py endif -TESTS := *.py - #----------------------------------------------------------------------------- # build options # @@ -264,7 +262,7 @@ flash : @echo Reset the board MANUALLY! run : $(TARGET_BIN) - $(QUTEST) $(TESTS) $(TARGET_EXE) $(HOST) + $(QUTEST) -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ diff --git a/examples/qutest/qhsmtst/test/test_qhsm.c b/examples/qutest/qhsmtst/test/test_qhsm.c index d3d68a9a..c048aded 100644 --- a/examples/qutest/qhsmtst/test/test_qhsm.c +++ b/examples/qutest/qhsmtst/test/test_qhsm.c @@ -1,7 +1,7 @@ /***************************************************************************** * Purpose: Fixture for QUTEST -* Last Updated for Version: 6.3.5 -* Date of the Last Update: 2018-09-16 +* Last Updated for Version: 7.2.0 +* Date of the Last Update: 2022-12-22 * * Q u a n t u m L e a P s * ------------------------ @@ -53,7 +53,6 @@ int main(int argc, char *argv[]) { QF_poolInit(smlPoolSto, sizeof(smlPoolSto), sizeof(smlPoolSto[0])); /* dictionaries... */ - QS_FUN_DICTIONARY(&QHsm_top); QS_OBJ_DICTIONARY(the_hsm); QS_USR_DICTIONARY(BSP_DISPLAY); diff --git a/examples/qutest/qmsmtst/qmsmtst.qm b/examples/qutest/qmsmtst/qmsmtst.qm index 58bd51a5..995415b0 100644 --- a/examples/qutest/qmsmtst/qmsmtst.qm +++ b/examples/qutest/qmsmtst/qmsmtst.qm @@ -1,5 +1,5 @@ - + QMsmTst is a QMsm state machine test based on the contrived state machine from Chapter 2 of the PSiCC2 book for testing all possible transition topologies with up to 4-levels of state nesting. diff --git a/examples/qutest/qmsmtst/src/qmsmtst.c b/examples/qutest/qmsmtst/src/qmsmtst.c index e9735869..f87f1fc3 100644 --- a/examples/qutest/qmsmtst/src/qmsmtst.c +++ b/examples/qutest/qmsmtst/src/qmsmtst.c @@ -3,7 +3,7 @@ * Model: qmsmtst.qm * File: ${src::qmsmtst.c} * -* This code has been generated by QM 5.2.3 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later @@ -117,8 +117,8 @@ QMsm * const the_msm = (QMsm *)&l_msmtst; /* the opaque pointer */ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/examples/qutest/qmsmtst/src/qmsmtst.h b/examples/qutest/qmsmtst/src/qmsmtst.h index 190c2c45..3ee81607 100644 --- a/examples/qutest/qmsmtst/src/qmsmtst.h +++ b/examples/qutest/qmsmtst/src/qmsmtst.h @@ -3,7 +3,7 @@ * Model: qmsmtst.qm * File: ${src::qmsmtst.h} * -* This code has been generated by QM 5.2.3 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later diff --git a/examples/qutest/qmsmtst/test/Makefile b/examples/qutest/qmsmtst/test/Makefile index 11e1d9aa..b6e54645 100644 --- a/examples/qutest/qmsmtst/test/Makefile +++ b/examples/qutest/qmsmtst/test/Makefile @@ -1,7 +1,7 @@ ############################################################################## # Product: Makefile for QUTEST-QP/C for Windows and POSIX *HOSTS* -# Last updated for version 7.1.3 -# Last updated on 2022-11-13 +# Last Updated for Version: 7.2.0 +# Date of the Last Update: 2022-12-21 # # Q u a n t u m L e a P s # ------------------------ @@ -154,8 +154,6 @@ ifeq ("$(wildcard $(QUTEST))","") QUTEST := python3 $(QTOOLS)/qutest/qutest.py endif -TESTS := *.py - #----------------------------------------------------------------------------- # basic utilities (depends on the OS this Makefile runs on): # @@ -223,7 +221,7 @@ $(TARGET_EXE) : $(C_OBJS_EXT) $(CPP_OBJS_EXT) $(LINK) $(LINKFLAGS) $(LIB_DIRS) -o $@ $^ $(BIN_DIR)/qstamp.o $(LIBS) run : $(TARGET_EXE) - $(QUTEST) $(TESTS) $(TARGET_EXE) $(HOST) + $(QUTEST) -e$(TARGET_EXE) -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) $(BIN_DIR)/%.d : %.cpp $(CPP) -MM -MT $(@:.d=.o) $(CPPFLAGS) $< > $@ @@ -250,7 +248,7 @@ endif endif debug : - $(QUTEST) $(TESTS) DEBUG $(HOST) + $(QUTEST) -edebug -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) clean : -$(RM) $(BIN_DIR)/*.* diff --git a/examples/qutest/qmsmtst/test/make_efm32 b/examples/qutest/qmsmtst/test/make_efm32 index 7f14d2e6..126b0911 100644 --- a/examples/qutest/qmsmtst/test/make_efm32 +++ b/examples/qutest/qmsmtst/test/make_efm32 @@ -1,7 +1,7 @@ ############################################################################## # Product: Makefile for QP/C on EMF32, QUTEST, GNU-ARM -# Last Updated for Version: 7.1.0 -# Date of the Last Update: 2022-08-20 +# Last Updated for Version: 7.2.0 +# Date of the Last Update: 2022-12-21 # # Q u a n t u m L e a P s # ------------------------ @@ -192,8 +192,6 @@ ifeq ("$(wildcard $(QUTEST))","") QUTEST := python3 $(QTOOLS)/qutest/qutest.py endif -TESTS := *.py - #----------------------------------------------------------------------------- # build options # @@ -261,7 +259,7 @@ flash : $(FLASH) $(TARGET_BIN) run : $(TARGET_BIN) - $(QUTEST) $(TESTS) $(TARGET_EXE) $(HOST) + $(QUTEST) -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ diff --git a/examples/qutest/qmsmtst/test/make_nucleo-l053r8 b/examples/qutest/qmsmtst/test/make_nucleo-l053r8 index af289435..425788b9 100644 --- a/examples/qutest/qmsmtst/test/make_nucleo-l053r8 +++ b/examples/qutest/qmsmtst/test/make_nucleo-l053r8 @@ -1,7 +1,7 @@ ############################################################################## # Product: Makefile for QP/C on NUCLEO-L053R8 board, QUTEST, GNU-ARM -# Last Updated for Version: 7.1.0 -# Date of the Last Update: 2022-08-20 +# Last Updated for Version: 7.2.0 +# Date of the Last Update: 2022-12-21 # # Q u a n t u m L e a P s # ------------------------ @@ -166,11 +166,11 @@ LINK := $(GNU_ARM)/bin/arm-none-eabi-gcc BIN := $(GNU_ARM)/bin/arm-none-eabi-objcopy #----------------------------------------------------------------------------- -# NOTE: The following symbol USB assumes that the NUCLEO board +# NOTE: The symbol USB must be provided for the NUCLEO board # has enumerated as USB drive f: # ifeq ($(USB),) -USB := f: +$(error USB drive not provided for the NUCLEO board.) endif ############################################################################## @@ -191,8 +191,6 @@ ifeq ("$(wildcard $(QUTEST))","") QUTEST := python3 $(QTOOLS)/qutest/qutest.py endif -TESTS := *.py - #----------------------------------------------------------------------------- # build options # @@ -261,7 +259,7 @@ flash : $(CP) $(TARGET_BIN) $(USB) run : $(TARGET_BIN) - $(QUTEST) $(TESTS) $(TARGET_EXE) $(HOST) + $(QUTEST) -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ diff --git a/examples/qutest/qmsmtst/test/make_tm4c123 b/examples/qutest/qmsmtst/test/make_tm4c123 index 773a7253..cf6fc639 100644 --- a/examples/qutest/qmsmtst/test/make_tm4c123 +++ b/examples/qutest/qmsmtst/test/make_tm4c123 @@ -1,7 +1,7 @@ ############################################################################## # Product: Makefile for QP/C on TM4C123, QUTEST, GNU-ARM -# Last Updated for Version: 7.1.0 -# Date of the Last Update: 2022-08-20 +# Last Updated for Version: 7.2.0 +# Date of the Last Update: 2022-12-21 # # Q u a n t u m L e a P s # ------------------------ @@ -190,8 +190,6 @@ ifeq ("$(wildcard $(QUTEST))","") QUTEST := python3 $(QTOOLS)/qutest/qutest.py endif -TESTS := *.py - #----------------------------------------------------------------------------- # build options # @@ -264,7 +262,7 @@ flash : @echo Reset the board MANUALLY! run : $(TARGET_BIN) - $(QUTEST) $(TESTS) $(TARGET_EXE) $(HOST) + $(QUTEST) -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ diff --git a/examples/qutest/self_test/test/Makefile b/examples/qutest/self_test/test/Makefile index 4da4619f..473c6e65 100644 --- a/examples/qutest/self_test/test/Makefile +++ b/examples/qutest/self_test/test/Makefile @@ -1,7 +1,7 @@ ############################################################################## # Product: Makefile for QUTEST-QP/C for Windows and POSIX *HOSTS* -# Last updated for version 7.1.3 -# Last updated on 2022-11-13 +# Last Updated for Version: 7.2.0 +# Date of the Last Update: 2022-12-21 # # Q u a n t u m L e a P s # ------------------------ @@ -35,7 +35,7 @@ # examples of invoking this Makefile: # make # make and run the Python tests in the current directory # make TESTS=test*.py # make and run the selected tests in the curr. dir. -# make HOST=localhost:7705 # connect to host:port +# make QSPY=localhost:7705 # connect to QSPY at host:udp_port:tcp_port # make norun # only make but not run the tests # make clean # cleanup the build # make debug # only run tests in DEBUG mode @@ -153,8 +153,6 @@ ifeq ("$(wildcard $(QUTEST))","") QUTEST := python3 $(QTOOLS)/qutest/qutest.py endif -TESTS := *.py - #----------------------------------------------------------------------------- # basic utilities (depends on the OS this Makefile runs on): # @@ -222,7 +220,7 @@ $(TARGET_EXE) : $(C_OBJS_EXT) $(CPP_OBJS_EXT) $(LINK) $(LINKFLAGS) $(LIB_DIRS) -o $@ $^ $(BIN_DIR)/qstamp.o $(LIBS) run : $(TARGET_EXE) - $(QUTEST) $(TESTS) $(TARGET_EXE) $(HOST) + $(QUTEST) -e$(TARGET_EXE) -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) $(BIN_DIR)/%.d : %.cpp $(CPP) -MM -MT $(@:.d=.o) $(CPPFLAGS) $< > $@ @@ -249,7 +247,7 @@ endif endif debug : - $(QUTEST) $(TESTS) DEBUG $(HOST) + $(QUTEST) -edebug -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) clean : -$(RM) $(BIN_DIR)/*.* diff --git a/examples/qutest/self_test/test/make_efm32 b/examples/qutest/self_test/test/make_efm32 index dfe0cd5a..4f40193a 100644 --- a/examples/qutest/self_test/test/make_efm32 +++ b/examples/qutest/self_test/test/make_efm32 @@ -1,7 +1,7 @@ ############################################################################## # Product: Makefile for QP/C on EMF32, QUTEST, GNU-ARM -# Last Updated for Version: 7.1.0 -# Date of the Last Update: 2022-08-20 +# Last Updated for Version: 7.2.0 +# Date of the Last Update: 2022-12-21 # # Q u a n t u m L e a P s # ------------------------ @@ -191,8 +191,6 @@ ifeq ("$(wildcard $(QUTEST))","") QUTEST := python3 $(QTOOLS)/qutest/qutest.py endif -TESTS := *.py - #----------------------------------------------------------------------------- # build options # @@ -260,7 +258,7 @@ flash : $(FLASH) $(TARGET_BIN) run : $(TARGET_BIN) - $(QUTEST) $(TESTS) $(TARGET_EXE) $(HOST) + $(QUTEST) -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ diff --git a/examples/qutest/self_test/test/make_nucleo-l053r8 b/examples/qutest/self_test/test/make_nucleo-l053r8 index aecd5656..cf623c26 100644 --- a/examples/qutest/self_test/test/make_nucleo-l053r8 +++ b/examples/qutest/self_test/test/make_nucleo-l053r8 @@ -1,7 +1,7 @@ ############################################################################## # Product: Makefile for QP/C on NUCLEO-L053R8 board, QUTEST, GNU-ARM -# Last Updated for Version: 7.1.0 -# Date of the Last Update: 2022-08-20 +# Last Updated for Version: 7.2.0 +# Date of the Last Update: 2022-12-21 # # Q u a n t u m L e a P s # ------------------------ @@ -165,11 +165,11 @@ LINK := $(GNU_ARM)/bin/arm-none-eabi-gcc BIN := $(GNU_ARM)/bin/arm-none-eabi-objcopy #----------------------------------------------------------------------------- -# NOTE: The following symbol USB assumes that the NUCLEO board +# NOTE: The symbol USB must be provided for the NUCLEO board # has enumerated as USB drive f: # ifeq ($(USB),) -USB := f: +$(error USB drive not provided for the NUCLEO board.) endif ############################################################################## @@ -190,8 +190,6 @@ ifeq ("$(wildcard $(QUTEST))","") QUTEST := python3 $(QTOOLS)/qutest/qutest.py endif -TESTS := *.py - #----------------------------------------------------------------------------- # build options # @@ -260,7 +258,7 @@ flash : $(CP) $(TARGET_BIN) $(USB) run : $(TARGET_BIN) - $(QUTEST) $(TESTS) $(TARGET_EXE) $(HOST) + $(QUTEST) -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ diff --git a/examples/qutest/self_test/test/make_posix b/examples/qutest/self_test/test/make_posix index 7d75e740..7a3555f5 100644 --- a/examples/qutest/self_test/test/make_posix +++ b/examples/qutest/self_test/test/make_posix @@ -1,7 +1,7 @@ ############################################################################## # Product: Makefile for QUTEST; QP/C on POSIX *Target* -# Last Updated for Version: 7.0.1 -# Date of the Last Update: 2022-05-23 +# Last Updated for Version: 7.1.4 +# Date of the Last Update: 2022-12-11 # # Q u a n t u m L e a P s # ------------------------ diff --git a/examples/qutest/self_test/test/make_tm4c123 b/examples/qutest/self_test/test/make_tm4c123 index 08635de7..791ca9f7 100644 --- a/examples/qutest/self_test/test/make_tm4c123 +++ b/examples/qutest/self_test/test/make_tm4c123 @@ -1,7 +1,7 @@ ############################################################################## # Product: Makefile for QP/C on TM4C123, QUTEST, GNU-ARM -# Last Updated for Version: 7.1.0 -# Date of the Last Update: 2022-08-20 +# Last Updated for Version: 7.2.0 +# Date of the Last Update: 2022-12-21 # # Q u a n t u m L e a P s # ------------------------ @@ -189,8 +189,6 @@ ifeq ("$(wildcard $(QUTEST))","") QUTEST := python3 $(QTOOLS)/qutest/qutest.py endif -TESTS := *.py - #----------------------------------------------------------------------------- # build options # @@ -263,7 +261,7 @@ flash : @echo Reset the board MANUALLY! run : $(TARGET_BIN) - $(QUTEST) $(TESTS) $(TARGET_EXE) $(HOST) + $(QUTEST) -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ diff --git a/examples/qutest/self_test/test/qutest221223_203028.txt b/examples/qutest/self_test/test/qutest221223_203028.txt new file mode 100644 index 00000000..4c5015d4 --- /dev/null +++ b/examples/qutest/self_test/test/qutest221223_203028.txt @@ -0,0 +1,100 @@ +Run ID : 221223_203028 +Target : build/test_qutest.exe + +==================================[Group 1]================================== +test_assert.py + +This test group contains tests that intenionally FAIL, +to exercise failure modes of the QUTest system. + +[ 1]-------------------------------------------------------------------------- +Expected assertion + [ PASS ( 0.1s) ] +[ 2]-------------------------------------------------------------------------- +Unexpected assertion (should FAIL!) + @test_assert.py:22 +exp: "0000000002 COMMAND CMD_A 0" +got: "0000000002 =ASSERT= Mod=test_qutest,Loc=100" +! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ![ FAIL ( 0.2s) ] +[ 3]-------------------------------------------------------------------------- +Simple passing test + [ PASS ( 0.1s) ] +[ 4]-------------------------------------------------------------------------- +Wrong assertion expectation (should FAIL!) + @test_assert.py:32 +exp: "0000000002 =ASSERT= Mod=test_qutest,Loc=200" +got: "0000000002 =ASSERT= Mod=test_qutest,Loc=100" +! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ![ FAIL ( 1.1s) ] +[ 5]-------------------------------------------------------------------------- +Simple passing test + [ PASS ( 0.1s) ] + +==================================[Group 2]================================== +test_command.py + +This test group tests the command() command, which +invokes the QS_onCommand() callback inside the target. + +[ 6]-------------------------------------------------------------------------- +Command + +this test invokes command(1,1,1) + + [ PASS ( 0.1s) ] + +==================================[Group 3]================================== +test_fp.py +[ 7]-------------------------------------------------------------------------- +FP output + [ PASS ( 0.1s) ] + +==================================[Group 4]================================== +test_last-rec.py + +This test group exercises the las_rec() command + +[ 8]-------------------------------------------------------------------------- +Last-record +params: 123 23456 3456789 -6.022141e+23 + [ PASS ( 0.1s) ] + +==================================[Group 5]================================== +test_mem-str.py +[ 9]-------------------------------------------------------------------------- +MEM/STR + [ PASS ( 0.1s) ] +[10]-------------------------------------------------------------------------- +MEM/STR empty string + [ PASS ( 1.1s) ] + +==================================[Group 6]================================== +test_peek-poke.py +[11]-------------------------------------------------------------------------- +Peek/Poke/Fill uint8_t + [ PASS ( 0.2s) ] +[12]^------------------------------------------------------------------------- +Peek/Poke/Fill uint16_t + [ PASS ( 0.1s) ] +[13]^------------------------------------------------------------------------- +Peek/Poke/Fill uint32_t + [ PASS ( 0.1s) ] + +==================================[Group 7]================================== +test_probe.py +[14]-------------------------------------------------------------------------- +Single Test Probe + [ PASS ( 0.1s) ] +[15]^------------------------------------------------------------------------- +Multiple Test Probes + [ PASS ( 0.0s) ] + +==================================[ SUMMARY ]================================= + +Target ID : 221223_185826 (QP-Ver=720) +Log file : ./qutest221223_203028.txt +Groups : 7 +Tests : 15 +Skipped : 0 +FAILED : 2 [ 2 4 ] + +==============================[ FAIL ( 10.7s) ]=============================== diff --git a/examples/qutest/self_test/test/qutest221223_203444.txt b/examples/qutest/self_test/test/qutest221223_203444.txt new file mode 100644 index 00000000..7257ea71 --- /dev/null +++ b/examples/qutest/self_test/test/qutest221223_203444.txt @@ -0,0 +1,23 @@ +Run ID : 221223_203444 +Target : build/test_qutest.exe + +==================================[Group 1]================================== +test_last-rec.py + +This test group exercises the las_rec() command + +[ 1]-------------------------------------------------------------------------- +Last-record +params: 123 23456 3456789 -6.022141e+23 + [ PASS ( 0.1s) ] + +==================================[ SUMMARY ]================================= + +Target ID : 221223_185826 (QP-Ver=720) +Log file : ./qutest221223_203444.txt +Groups : 1 +Tests : 1 +Skipped : 0 +Failed : 0 + +==============================[ OK ( 1.2s) ]=============================== diff --git a/examples/qutest/self_test/test/qutest221223_203503.txt b/examples/qutest/self_test/test/qutest221223_203503.txt new file mode 100644 index 00000000..fea2e1b1 --- /dev/null +++ b/examples/qutest/self_test/test/qutest221223_203503.txt @@ -0,0 +1,22 @@ +Run ID : 221223_203503 +Target : build/test_qutest.exe + +==================================[Group 1]================================== +test_mem-str.py +[ 1]-------------------------------------------------------------------------- +MEM/STR + [ PASS ( 0.1s) ] +[ 2]-------------------------------------------------------------------------- +MEM/STR empty string + [ PASS ( 1.1s) ] + +==================================[ SUMMARY ]================================= + +Target ID : 221223_185826 (QP-Ver=720) +Log file : ./qutest221223_203503.txt +Groups : 1 +Tests : 2 +Skipped : 0 +Failed : 0 + +==============================[ OK ( 2.4s) ]=============================== diff --git a/examples/qutest/self_test/test/qutest221223_203512.txt b/examples/qutest/self_test/test/qutest221223_203512.txt new file mode 100644 index 00000000..5eea4a83 --- /dev/null +++ b/examples/qutest/self_test/test/qutest221223_203512.txt @@ -0,0 +1,22 @@ +Run ID : 221223_203512 +Target : build/test_qutest.exe + +==================================[Group 1]================================== +test_mem-str.py +[ 1]-------------------------------------------------------------------------- +MEM/STR + [ PASS ( 0.1s) ] +[ 2]-------------------------------------------------------------------------- +MEM/STR empty string + [ PASS ( 1.1s) ] + +==================================[ SUMMARY ]================================= + +Target ID : 221223_185826 (QP-Ver=720) +Log file : ./qutest221223_203512.txt +Groups : 1 +Tests : 2 +Skipped : 0 +Failed : 0 + +==============================[ OK ( 2.4s) ]=============================== diff --git a/examples/qutest/self_test/test/test_assert.py b/examples/qutest/self_test/test/test_assert.py index c3d2843c..220acca4 100644 --- a/examples/qutest/self_test/test/test_assert.py +++ b/examples/qutest/self_test/test/test_assert.py @@ -3,12 +3,35 @@ include("test_include.pyi") +note(''' +This test group contains tests that intenionally FAIL, +to exercise failure modes of the QUTest system. +''') + +def on_reset(): + #note("on_reset()") + expect(" QF_RUN") + # tests... -test("Assert 0") -command("COMMAND_A", 0) +test("Expected assertion") +command("CMD_A", 0) expect("@timestamp =ASSERT= Mod=test_qutest,Loc=100") -test("Assert 1") -command("COMMAND_A", 1) -expect("@timestamp COMMAND_A 1") +test("Unexpected assertion (should FAIL!)") +command("CMD_A", 0) +expect("@timestamp COMMAND CMD_A 0") +expect("@timestamp Trg-Done QS_RX_COMMAND") + +test("Simple passing test") +command("CMD_A", 1) +expect("@timestamp COMMAND CMD_A 1") +expect("@timestamp Trg-Done QS_RX_COMMAND") + +test("Wrong assertion expectation (should FAIL!)") +command("CMD_A", 0) +expect("@timestamp =ASSERT= Mod=test_qutest,Loc=200") + +test("Simple passing test") +command("CMD_A", 1) +expect("@timestamp COMMAND CMD_A 1") expect("@timestamp Trg-Done QS_RX_COMMAND") diff --git a/examples/qutest/self_test/test/test_command.py b/examples/qutest/self_test/test/test_command.py index 86b79842..cc5ad89b 100644 --- a/examples/qutest/self_test/test/test_command.py +++ b/examples/qutest/self_test/test/test_command.py @@ -1,11 +1,23 @@ # test-script for QUTest unit testing harness # see https://www.state-machine.com/qtools/qutest.html -include("test_include.pyi") +note(''' +This test group tests the command() command, which +invokes the QS_onCommand() callback inside the target. +''') + +def on_setup(): + expect("@timestamp FIXTURE_SETUP") + +def on_teardown(): + expect("@timestamp FIXTURE_TEARDOWN") # tests... test("Command") -command_x(1, 2, 3) -expect("@timestamp COMMAND_X 0") +note(''' +this test invokes command(1,1,1) +''') +command("CMD_X", 1, 2, 3) +expect("@timestamp COMMAND CMD_X 0") expect("@timestamp Trg-Done QS_RX_COMMAND") diff --git a/examples/qutest/self_test/test/test_fp.py b/examples/qutest/self_test/test/test_fp.py index 5080d406..a785fb8e 100644 --- a/examples/qutest/self_test/test/test_fp.py +++ b/examples/qutest/self_test/test/test_fp.py @@ -5,9 +5,9 @@ include("test_include.pyi") # tests... test("FP output") -command("COMMAND_Z", 0, 3, 7) -expect("@timestamp COMMAND_Z 4e-01 -6e+23") +command("CMD_Z", 0, 3, 7) +expect("@timestamp COMMAND CMD_Z 4e-01 -6e+23") expect("@timestamp Trg-Done QS_RX_COMMAND") -command("COMMAND_Z", 4, (-3 & 0xFFFFFFFF), 7) -expect("@timestamp COMMAND_Z -4.2857e-01 -6.0221e+23") +command("CMD_Z", 4, (-3 & 0xFFFFFFFF), 7) +expect("@timestamp COMMAND CMD_Z -4.2857e-01 -6.0221e+23") expect("@timestamp Trg-Done QS_RX_COMMAND") diff --git a/examples/qutest/self_test/test/test_include.pyi b/examples/qutest/self_test/test/test_include.pyi index 454be543..b075bb6a 100644 --- a/examples/qutest/self_test/test/test_include.pyi +++ b/examples/qutest/self_test/test/test_include.pyi @@ -9,7 +9,7 @@ def on_teardown(): expect("@timestamp FIXTURE_TEARDOWN") def command_x(par1=0, par2=0, par3=0): - command("COMMAND_X", par1, par2, par3) + command("CMD_X", par1, par2, par3) def curr_ap_obj(obj_name): current_obj(OBJ_AP, obj_name) diff --git a/examples/qutest/self_test/test/test_lact-rec.py b/examples/qutest/self_test/test/test_lact-rec.py deleted file mode 100644 index 92843a21..00000000 --- a/examples/qutest/self_test/test/test_lact-rec.py +++ /dev/null @@ -1,22 +0,0 @@ -# test-script for QUTest unit testing harness -# see https://www.state-machine.com/qtools/qutest.html - -include("test_include.pyi") - -def print_params(): - global p1, p2, p3 - print("params:", p1, p2, p3, p4) - -# tests... -test("Last-record") -command("COMMAND_B", 123, 23456, 3456789) -expect("@timestamp COMMAND_B *") -last = last_rec().split() -p1 = int(last[2]) -s1 = last[3] -p2 = int(last[4]) -s2 = last[5] -p3 = int(last[6]) -p4 = float(last[7]) -print_params() -expect("@timestamp Trg-Done QS_RX_COMMAND") diff --git a/examples/qutest/self_test/test/test_last-rec.py b/examples/qutest/self_test/test/test_last-rec.py new file mode 100644 index 00000000..5099ae0a --- /dev/null +++ b/examples/qutest/self_test/test/test_last-rec.py @@ -0,0 +1,26 @@ +# test-script for QUTest unit testing harness +# see https://www.state-machine.com/qtools/qutest.html + +note(''' +This test group exercises the las_rec() command +''') + +include("test_include.pyi") + +def display_params(): + global p1, p2, p3, p4 + note("params: %d %d %d %e"%(p1, p2, p3, p4)) + +# tests... +test("Last-record") +command("CMD_B", 123, 23456, 3456789) +expect("@timestamp COMMAND CMD_B *") +last = last_rec().split() +p1 = int(last[3]) +s1 = last[3] +p2 = int(last[5]) +s2 = last[5] +p3 = int(last[7]) +p4 = float(last[8]) +display_params() # locally defined function +expect("@timestamp Trg-Done QS_RX_COMMAND") diff --git a/examples/qutest/self_test/test/test_mem-str.py b/examples/qutest/self_test/test/test_mem-str.py index 58283be5..72c80e46 100644 --- a/examples/qutest/self_test/test/test_mem-str.py +++ b/examples/qutest/self_test/test/test_mem-str.py @@ -8,14 +8,14 @@ test("MEM/STR") curr_ap_obj("buffer") fill(0,1,16,0x1A) poke(33,1,b"Hello World!\0") -command("COMMAND_Y", 16) -expect("@timestamp COMMAND_Y myFun 1A 1A 1A 1A 1A 1A 1A 1A 1A 1A 1A 1A 1A 1A 1A 1A Hello World!") +command("CMD_Y", 16) +expect("@timestamp COMMAND CMD_Y myFun 1A 1A 1A 1A 1A 1A 1A 1A 1A 1A 1A 1A 1A 1A 1A 1A Hello World!") expect("@timestamp Trg-Done QS_RX_COMMAND") test("MEM/STR empty string") curr_ap_obj("buffer") fill(0,1,16,0x1A) poke(33,1,b"\0") -command("COMMAND_Y", 16) -expect("@timestamp COMMAND_Y myFun 1A 1A 1A 1A 1A 1A 1A 1A 1A 1A 1A 1A 1A 1A 1A 1A ''") +command("CMD_Y", 16) +expect("@timestamp COMMAND CMD_Y myFun 1A 1A 1A 1A 1A 1A 1A 1A 1A 1A 1A 1A 1A 1A 1A 1A ''") expect("@timestamp Trg-Done QS_RX_COMMAND") diff --git a/examples/qutest/self_test/test/test_probe.py b/examples/qutest/self_test/test/test_probe.py index c6e30895..a9cb918b 100644 --- a/examples/qutest/self_test/test/test_probe.py +++ b/examples/qutest/self_test/test/test_probe.py @@ -6,28 +6,28 @@ include("test_include.pyi") # tests... test("Single Test Probe") command_x() -expect("@timestamp COMMAND_X 0") +expect("@timestamp COMMAND CMD_X 0") expect("@timestamp Trg-Done QS_RX_COMMAND") probe("myFun", 1) command_x() expect("@timestamp TstProbe Fun=myFun,Data=1") -expect("@timestamp COMMAND_X 1") +expect("@timestamp COMMAND CMD_X 1") expect("@timestamp Trg-Done QS_RX_COMMAND") -command("COMMAND_X") -expect("@timestamp COMMAND_X 0") +command("CMD_X") +expect("@timestamp COMMAND CMD_X 0") expect("@timestamp Trg-Done QS_RX_COMMAND") test("Multiple Test Probes", NORESET) probe("myFun", 100022) probe("myFun", 200033) -command("COMMAND_X") +command("CMD_X") expect("@timestamp TstProbe Fun=myFun,Data=100022") -expect("@timestamp COMMAND_X 100022") +expect("@timestamp COMMAND CMD_X 100022") expect("@timestamp Trg-Done QS_RX_COMMAND") -command("COMMAND_X") +command("CMD_X") expect("@timestamp TstProbe Fun=myFun,Data=200033") -expect("@timestamp COMMAND_X 200033") +expect("@timestamp COMMAND CMD_X 200033") expect("@timestamp Trg-Done QS_RX_COMMAND") -command("COMMAND_X") -expect("@timestamp COMMAND_X 0") +command("CMD_X") +expect("@timestamp COMMAND CMD_X 0") expect("@timestamp Trg-Done QS_RX_COMMAND") diff --git a/examples/qutest/self_test/test/test_qutest.c b/examples/qutest/self_test/test/test_qutest.c index 5865211c..7dbfeaa5 100644 --- a/examples/qutest/self_test/test/test_qutest.c +++ b/examples/qutest/self_test/test/test_qutest.c @@ -1,7 +1,7 @@ /***************************************************************************** * Purpose: Fixture for QUTEST self-test -* Last Updated for Version: 6.9.3 -* Date of the Last Update: 2021-05-31 +* Last Updated for Version: 7.2.0 +* Date of the Last Update: 2022-12-07 * * Q u a n t u m L e a P s * ------------------------ @@ -39,15 +39,23 @@ Q_DEFINE_THIS_MODULE("test_qutest") static uint8_t buffer[100]; static uint32_t myFun(void); -enum { +enum UsrEnum { FIXTURE_SETUP = QS_USER, FIXTURE_TEARDOWN, - COMMAND_A, - COMMAND_B, - COMMAND_X, - COMMAND_Y, - COMMAND_Z, - MY_RECORD, + COMMAND, +}; + +enum CmdEnum { + CMD_A, + CMD_B, + CMD_C, + CMD_X, + CMD_Y, + CMD_Z +}; + +enum UsrSig { + MYSIG_SIG = Q_USER_SIG, }; /*--------------------------------------------------------------------------*/ @@ -64,15 +72,18 @@ int main(int argc, char *argv[]) { /* dictionaries... */ QS_OBJ_DICTIONARY(buffer); QS_FUN_DICTIONARY(&myFun); + QS_SIG_DICTIONARY(MYSIG_SIG, (void *)0); QS_USR_DICTIONARY(FIXTURE_SETUP); QS_USR_DICTIONARY(FIXTURE_TEARDOWN); - QS_USR_DICTIONARY(COMMAND_A); - QS_USR_DICTIONARY(COMMAND_B); - QS_USR_DICTIONARY(COMMAND_X); - QS_USR_DICTIONARY(COMMAND_Y); - QS_USR_DICTIONARY(COMMAND_Z); - QS_USR_DICTIONARY(MY_RECORD); + QS_USR_DICTIONARY(COMMAND); + + QS_ENUM_DICTIONARY(CMD_A, QS_CMD); + QS_ENUM_DICTIONARY(CMD_B, QS_CMD); + QS_ENUM_DICTIONARY(CMD_C, QS_CMD); + QS_ENUM_DICTIONARY(CMD_X, QS_CMD); + QS_ENUM_DICTIONARY(CMD_Y, QS_CMD); + QS_ENUM_DICTIONARY(CMD_Z, QS_CMD); return QF_run(); /* run the tests */ } @@ -93,20 +104,18 @@ void QS_onTestTeardown(void) { void QS_onCommand(uint8_t cmdId, uint32_t param1, uint32_t param2, uint32_t param3) { - (void)param1; - (void)param2; - (void)param3; - switch (cmdId) { - case COMMAND_A: { + case CMD_A: { Q_ASSERT_ID(100, param1 != 0U); - QS_BEGIN_ID(COMMAND_A, 0U) /* app-specific record */ + QS_BEGIN_ID(COMMAND, 0U) /* app-specific record */ + QS_ENUM(QS_CMD, cmdId); QS_U32(0, param1); QS_END() break; } - case COMMAND_B: { - QS_BEGIN_ID(COMMAND_B, 0U) /* app-specific record */ + case CMD_B: { + QS_BEGIN_ID(COMMAND, 0U) /* app-specific record */ + QS_ENUM(QS_CMD, cmdId); QS_U8(0, param1); QS_STR("BAR"); QS_U16(0, param2); @@ -116,26 +125,54 @@ void QS_onCommand(uint8_t cmdId, QS_END() break; } - case COMMAND_X: { + case CMD_C: { + /* all supported data elements */ + QS_BEGIN_ID(COMMAND, 0U) /* app-specific record */ + QS_ENUM(QS_CMD, cmdId); + QS_I8(10, param1); + QS_U8(10, param1); + QS_I16(10, param2); + QS_U16(10, param2); + QS_I32(10, param3); + QS_U32(10, param3); + QS_END() + QS_BEGIN_ID(COMMAND, 0U) /* app-specific record */ + QS_I64(10, param3); + QS_U64(10, param3); + QS_F32(param1, -6.02214076E23); + QS_F64(param1, -6.02214076E23); + QS_END() + QS_BEGIN_ID(COMMAND, 0U) /* app-specific record */ + QS_OBJ(buffer); + QS_FUN(&myFun); + QS_SIG(MYSIG_SIG, (void *)0); + QS_MEM(&buffer[6], 16); + QS_END() + break; + } + case CMD_X: { uint32_t x = myFun(); - QS_BEGIN_ID(COMMAND_X, 0U) /* app-specific record */ + QS_BEGIN_ID(COMMAND, 0U) /* app-specific record */ + QS_ENUM(QS_CMD, cmdId); QS_U32(0, x); /* ... */ QS_END() break; } - case COMMAND_Y: { - QS_BEGIN_ID(COMMAND_Y, 0U) /* application-specific record */ + case CMD_Y: { + QS_BEGIN_ID(COMMAND, 0U) /* application-specific record */ + QS_ENUM(QS_CMD, cmdId); QS_FUN(&myFun); QS_MEM(buffer, param1); QS_STR((char const *)&buffer[33]); QS_END() break; } - case COMMAND_Z: { + case CMD_Z: { float32_t f32 = (float32_t)((int32_t)param2/(float32_t)param3); float64_t f64 = -6.02214076E23; - QS_BEGIN_ID(COMMAND_Z, 0U) /* app-specific record */ + QS_BEGIN_ID(COMMAND, 0U) /* app-specific record */ + QS_ENUM(QS_CMD, cmdId); QS_F32(param1, f32); QS_F64(param1, f64); QS_END() @@ -159,10 +196,10 @@ void QS_onTestEvt(QEvt *e) { void QS_onTestPost(void const *sender, QActive *recipient, QEvt const *e, bool status) { - (void)sender; - (void)recipient; - (void)e; - (void)status; + Q_UNUSED_PAR(sender); + Q_UNUSED_PAR(recipient); + Q_UNUSED_PAR(e); + Q_UNUSED_PAR(status); } /*--------------------------------------------------------------------------*/ diff --git a/examples/qutest/start_seq/gizmo.qm b/examples/qutest/start_seq/gizmo.qm new file mode 100644 index 00000000..995e75d4 --- /dev/null +++ b/examples/qutest/start_seq/gizmo.qm @@ -0,0 +1,113 @@ + + + Start sequence example + + + + + + + + + the only instance of this AO (Singleton) + + + + + + Q_UNUSED_PAR(par); + + + + + + + static QEvt const startEvt = { START_SIG, 0U, 0U }; +QACTIVE_POST(&me->super, &startEvt, me); /* self-post */ + + + QS_BEGIN_ID(QS_USER1, me->super.prio) + QS_STR("START"); +QS_END() + + + BSP_getStatus() + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Gizmo *me = &Gizmo_inst; +QActive_ctor(&me->super, Q_STATE_CAST(&Gizmo_initial)); + + + + /* opaque pointer to the Gizmo AO */ + = &Gizmo_inst.super; + + + + + + + #ifndef GIZMO_H_ +#define GIZMO_H_ + +enum BlinkySignals { + DUMMY_SIG = Q_USER_SIG, + /* ... */ + MAX_PUB_SIG, /* the last published signal */ + + START_SIG, + /* ... */ + MAX_SIG /* the last signal */ +}; + +$declare ${AOs::AO_Gizmo} +$declare ${AOs::Gizmo_ctor} + +#endif /* GIZMO_H_ */ + + + + #include "qpc.h" +#include "bsp.h" +#include "gizmo.h" + +//Q_DEFINE_THIS_MODULE("gizmo") + +$declare ${AOs::Gizmo} + +$define ${AOs::AO_Gizmo} +$define ${AOs::Gizmo_ctor} +$define ${AOs::Gizmo} + + + diff --git a/examples/qutest/start_seq/src/bsp.c b/examples/qutest/start_seq/src/bsp.c new file mode 100644 index 00000000..afceb2b3 --- /dev/null +++ b/examples/qutest/start_seq/src/bsp.c @@ -0,0 +1,58 @@ +/***************************************************************************** +* Product: "Blinky" example, Win32 API +* Last Updated for Version: 7.2.0 +* Date of the Last Update: 2022-12-22 +* +* Q u a n t u m L e a P s +* --------------------------- +* innovating embedded systems +* +* Copyright (C) 2005 Quantum Leaps, LLC. All rights reserved. +* +* This program is open source software: you can redistribute it and/or +* modify it under the terms of the GNU General Public License as published +* 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: +* +* +*****************************************************************************/ +#include "qpc.h" +#include "bsp.h" +#include "gizmo.h" + +//Q_DEFINE_THIS_FILE + +static uint8_t status; + +/*..........................................................................*/ +void BSP_init() { + QS_SIG_DICTIONARY(START_SIG, (void *)0); + + QS_OBJ_DICTIONARY(AO_Gizmo); + QS_OBJ_DICTIONARY(&status); +} +/*..........................................................................*/ +void BSP_msg(char const *msg) { + QS_BEGIN_ID(QS_USER1, 0U) + QS_STR(msg); + QS_END() +} +/*..........................................................................*/ +uint8_t BSP_getStatus(void) { + return status; +} diff --git a/examples/qutest/start_seq/src/bsp.h b/examples/qutest/start_seq/src/bsp.h new file mode 100644 index 00000000..763ed52d --- /dev/null +++ b/examples/qutest/start_seq/src/bsp.h @@ -0,0 +1,43 @@ +/***************************************************************************** +* Product: DPP example +* Last Updated for Version: 7.2.0 +* Date of the Last Update: 2022-12-22 +* +* Q u a n t u m L e a P s +* --------------------------- +* innovating embedded systems +* +* Copyright (C) 2005 Quantum Leaps, LLC. All rights reserved. +* +* This program is open source software: you can redistribute it and/or +* modify it under the terms of the GNU General Public License as published +* 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: +* +* +*****************************************************************************/ +#ifndef BSP_H +#define BSP_H + +#define BSP_TICKS_PER_SEC 100U + +void BSP_init(void); +void BSP_msg(char const *msg); +uint8_t BSP_getStatus(void); + +#endif /* BSP_H */ diff --git a/examples/qutest/start_seq/src/gizmo.c b/examples/qutest/start_seq/src/gizmo.c new file mode 100644 index 00000000..2e3405a0 --- /dev/null +++ b/examples/qutest/start_seq/src/gizmo.c @@ -0,0 +1,149 @@ +/*$file${src::gizmo.c} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ +/* +* Model: gizmo.qm +* File: ${src::gizmo.c} +* +* This code has been generated by QM 5.2.4 . +* DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. +* +* SPDX-License-Identifier: GPL-3.0-or-later +* +* This generated code is open source software: you can redistribute it under +* the terms of the GNU General Public License as published by the Free +* Software Foundation. +* +* This code 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. +* +* NOTE: +* Alternatively, this generated code may be distributed 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. +* +* Contact information: +* +* +*/ +/*$endhead${src::gizmo.c} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ +#include "qpc.h" +#include "bsp.h" +#include "gizmo.h" + +//Q_DEFINE_THIS_MODULE("gizmo") + +/*$declare${AOs::Gizmo} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ + +/*${AOs::Gizmo} ............................................................*/ +typedef struct Gizmo { +/* protected: */ + QActive super; + +/* public: */ +} Gizmo; +extern Gizmo Gizmo_inst; + +/* protected: */ +static QState Gizmo_initial(Gizmo * const me, void const * const par); +static QState Gizmo_init(Gizmo * const me, QEvt const * const e); +static QState Gizmo_on_battery(Gizmo * const me, QEvt const * const e); +static QState Gizmo_on_mains(Gizmo * const me, QEvt const * const e); +/*$enddecl${AOs::Gizmo} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + +/*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ +/* Check for the minimum required QP version */ +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required +#endif +/*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + +/*$define${AOs::AO_Gizmo} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ + +/*${AOs::AO_Gizmo} .........................................................*/ +QActive * const AO_Gizmo = &Gizmo_inst.super; +/*$enddef${AOs::AO_Gizmo} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ +/*$define${AOs::Gizmo_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ + +/*${AOs::Gizmo_ctor} .......................................................*/ +void Gizmo_ctor(void) { + Gizmo *me = &Gizmo_inst; + QActive_ctor(&me->super, Q_STATE_CAST(&Gizmo_initial)); +} +/*$enddef${AOs::Gizmo_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ +/*$define${AOs::Gizmo} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ + +/*${AOs::Gizmo} ............................................................*/ +Gizmo Gizmo_inst; + +/*${AOs::Gizmo::SM} ........................................................*/ +static QState Gizmo_initial(Gizmo * const me, void const * const par) { + /*${AOs::Gizmo::SM::initial} */ + Q_UNUSED_PAR(par); + + QS_FUN_DICTIONARY(&Gizmo_init); + QS_FUN_DICTIONARY(&Gizmo_on_battery); + QS_FUN_DICTIONARY(&Gizmo_on_mains); + + return Q_TRAN(&Gizmo_init); +} + +/*${AOs::Gizmo::SM::init} ..................................................*/ +static QState Gizmo_init(Gizmo * const me, QEvt const * const e) { + QState status_; + switch (e->sig) { + /*${AOs::Gizmo::SM::init} */ + case Q_ENTRY_SIG: { + static QEvt const startEvt = { START_SIG, 0U, 0U }; + QACTIVE_POST(&me->super, &startEvt, me); /* self-post */ + status_ = Q_HANDLED(); + break; + } + /*${AOs::Gizmo::SM::init::START} */ + case START_SIG: { + QS_BEGIN_ID(QS_USER1, me->super.prio) + QS_STR("START"); + QS_END() + /*${AOs::Gizmo::SM::init::START::[BSP_getStatus()]} */ + if (BSP_getStatus()) { + status_ = Q_TRAN(&Gizmo_on_mains); + } + /*${AOs::Gizmo::SM::init::START::[else]} */ + else { + status_ = Q_TRAN(&Gizmo_on_battery); + } + break; + } + default: { + status_ = Q_SUPER(&QHsm_top); + break; + } + } + return status_; +} + +/*${AOs::Gizmo::SM::on_battery} ............................................*/ +static QState Gizmo_on_battery(Gizmo * const me, QEvt const * const e) { + QState status_; + switch (e->sig) { + default: { + status_ = Q_SUPER(&QHsm_top); + break; + } + } + return status_; +} + +/*${AOs::Gizmo::SM::on_mains} ..............................................*/ +static QState Gizmo_on_mains(Gizmo * const me, QEvt const * const e) { + QState status_; + switch (e->sig) { + default: { + status_ = Q_SUPER(&QHsm_top); + break; + } + } + return status_; +} +/*$enddef${AOs::Gizmo} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/examples/qutest/start_seq/src/gizmo.h b/examples/qutest/start_seq/src/gizmo.h new file mode 100644 index 00000000..177d569f --- /dev/null +++ b/examples/qutest/start_seq/src/gizmo.h @@ -0,0 +1,56 @@ +/*$file${src::gizmo.h} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ +/* +* Model: gizmo.qm +* File: ${src::gizmo.h} +* +* This code has been generated by QM 5.2.4 . +* DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. +* +* SPDX-License-Identifier: GPL-3.0-or-later +* +* This generated code is open source software: you can redistribute it under +* the terms of the GNU General Public License as published by the Free +* Software Foundation. +* +* This code 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. +* +* NOTE: +* Alternatively, this generated code may be distributed 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. +* +* Contact information: +* +* +*/ +/*$endhead${src::gizmo.h} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ +#ifndef GIZMO_H_ +#define GIZMO_H_ + +enum BlinkySignals { + DUMMY_SIG = Q_USER_SIG, + /* ... */ + MAX_PUB_SIG, /* the last published signal */ + + START_SIG, + /* ... */ + MAX_SIG /* the last signal */ +}; + +/*$declare${AOs::AO_Gizmo} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ + +/*${AOs::AO_Gizmo} .........................................................*/ +/* opaque pointer to the Gizmo AO */ +extern QActive * const AO_Gizmo; +/*$enddecl${AOs::AO_Gizmo} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ +/*$declare${AOs::Gizmo_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ + +/*${AOs::Gizmo_ctor} .......................................................*/ +void Gizmo_ctor(void); +/*$enddecl${AOs::Gizmo_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + +#endif /* GIZMO_H_ */ diff --git a/examples/qutest/start_seq/test/Makefile b/examples/qutest/start_seq/test/Makefile new file mode 100644 index 00000000..23b15c7e --- /dev/null +++ b/examples/qutest/start_seq/test/Makefile @@ -0,0 +1,275 @@ +############################################################################## +# Product: Makefile for QUTEST-QP/C for Windows and POSIX *HOSTS* +# Last updated for version 7.2.0 +# Last updated on 2022-12-22 +# +# Q u a n t u m L e a P s +# ------------------------ +# Modern Embedded Software +# +# Copyright (C) 2005 Quantum Leaps, LLC. All rights reserved. +# +# This program is open source software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License as published +# 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 # make and run the Python tests in the current directory +# make TESTS=test*.py # make and run the selected tests in the curr. dir. +# make HOST=localhost:7705 # connect to host:port +# make norun # only make but not run the tests +# make clean # cleanup the build +# make 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 +# + +#----------------------------------------------------------------------------- +# project name: +# +PROJECT := test_gizmo + +#----------------------------------------------------------------------------- +# project directories: +# + +# list of all source directories used by this project +VPATH := . \ + ../src + +# list of all include directories needed by this project +INCLUDES := -I. \ + -I../src + +# location of the QP/C framework (if not provided in an env. variable) +ifeq ($(QPC),) +QPC := ../../../.. +endif + +# make sure that QTOOLS env. variable is defined... +ifeq ("$(wildcard $(QTOOLS))","") +$(error QTOOLS not found. Please install QTools and define QTOOLS env. variable) +endif + +#----------------------------------------------------------------------------- +# project files: +# + +# C source files... +C_SRCS := \ + gizmo.c \ + bsp.c \ + test_fixture.c + +# C++ source files... +CPP_SRCS := + +LIB_DIRS := +LIBS := + +# defines... +DEFINES := + +#----------------------------------------------------------------------------- +# add QP/C framework: +# +C_SRCS += \ + qep_hsm.c \ + qep_msm.c \ + qf_act.c \ + qf_actq.c \ + qf_defer.c \ + qf_dyn.c \ + qf_mem.c \ + qf_ps.c \ + qf_qact.c \ + qf_qeq.c \ + qf_qmact.c \ + qf_time.c \ + qs.c \ + qs_64bit.c \ + qs_rx.c \ + qs_fp.c \ + qutest.c \ + qutest_port.c + + +ifeq ($(OS),Windows_NT) + +QP_PORT_DIR := $(QPC)/ports/win32-qutest +LIBS += -lws2_32 + +else + +QP_PORT_DIR := $(QPC)/ports/posix-qutest +#QP_PORT_DIR := $(QPC)/ports/posix +LIBS += -lpthread + +endif + +#============================================================================ +# Typically you should not need to change anything below this line + +VPATH += $(QPC)/src/qf $(QPC)/src/qs $(QP_PORT_DIR) +INCLUDES += -I$(QPC)/include -I$(QP_PORT_DIR) + +#----------------------------------------------------------------------------- +# GNU toolset: +# +# NOTE: +# GNU toolset (MinGW) is included in the QTools collection for Windows, see: +# https://www.state-machine.com/qtools +# It is assumed that %QTOOLS%\bin directory is added to the PATH +# +CC := gcc +CPP := g++ +LINK := gcc # for C programs +#LINK := g++ # for C++ programs + +#----------------------------------------------------------------------------- +# QUTest test script utilities (requires QTOOLS): +# +ifeq ("$(wildcard $(QUTEST))","") +QUTEST := python3 $(QTOOLS)/qutest/qutest.py +endif + +#----------------------------------------------------------------------------- +# basic utilities (depends on the OS this Makefile runs on): +# +ifeq ($(OS),Windows_NT) + MKDIR := mkdir + RM := rm + TARGET_EXT := .exe +else ifeq ($(OSTYPE),cygwin) + MKDIR := mkdir -p + RM := rm -f + TARGET_EXT := .exe +else + MKDIR := mkdir -p + RM := rm -f + TARGET_EXT := +endif + +#----------------------------------------------------------------------------- +# build options... + +BIN_DIR := build + +CFLAGS := -c -g -O -fno-pie -std=c11 -pedantic -Wall -Wextra -W \ + $(INCLUDES) $(DEFINES) -DQ_SPY -DQ_UTEST -DQ_HOST + +CPPFLAGS := -c -g -O -fno-pie -std=c++11 -pedantic -Wall -Wextra \ + -fno-rtti -fno-exceptions \ + $(INCLUDES) $(DEFINES) -DQ_SPY -DQ_UTEST -DQ_HOST + +ifndef GCC_OLD + LINKFLAGS := -no-pie +endif + +ifdef GCOV + CFLAGS += -fprofile-arcs -ftest-coverage + CPPFLAGS += -fprofile-arcs -ftest-coverage + LINKFLAGS += -lgcov --coverage +endif + +#----------------------------------------------------------------------------- +C_OBJS := $(patsubst %.c,%.o, $(C_SRCS)) +CPP_OBJS := $(patsubst %.cpp,%.o, $(CPP_SRCS)) + +TARGET_EXE := $(BIN_DIR)/$(PROJECT)$(TARGET_EXT) +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)) + +#----------------------------------------------------------------------------- +# rules +# + +.PHONY : norun debug clean show + +ifeq ($(MAKECMDGOALS),norun) +all : $(TARGET_EXE) +norun : all +else +all : $(TARGET_EXE) run +endif + +$(TARGET_EXE) : $(C_OBJS_EXT) $(CPP_OBJS_EXT) + $(CC) $(CFLAGS) $(QPC)/include/qstamp.c -o $(BIN_DIR)/qstamp.o + $(LINK) $(LINKFLAGS) $(LIB_DIRS) -o $@ $^ $(BIN_DIR)/qstamp.o $(LIBS) + +run : $(TARGET_EXE) + $(QUTEST) -e$(TARGET_EXE) -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) + +$(BIN_DIR)/%.d : %.cpp + $(CPP) -MM -MT $(@:.d=.o) $(CPPFLAGS) $< > $@ + +$(BIN_DIR)/%.d : %.c + $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ + +$(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) + +clean : + -$(RM) $(BIN_DIR)/*.* + +show : + @echo PROJECT = $(PROJECT) + @echo TARGET_EXE = $(TARGET_EXE) + @echo VPATH = $(VPATH) + @echo C_SRCS = $(C_SRCS) + @echo CPP_SRCS = $(CPP_SRCS) + @echo C_DEPS_EXT = $(C_DEPS_EXT) + @echo C_OBJS_EXT = $(C_OBJS_EXT) + @echo C_DEPS_EXT = $(C_DEPS_EXT) + @echo CPP_DEPS_EXT = $(CPP_DEPS_EXT) + @echo CPP_OBJS_EXT = $(CPP_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/examples/qutest/start_seq/test/test_fixture.c b/examples/qutest/start_seq/test/test_fixture.c new file mode 100644 index 00000000..cc11a3e5 --- /dev/null +++ b/examples/qutest/start_seq/test/test_fixture.c @@ -0,0 +1,102 @@ +/***************************************************************************** +* Purpose: Fixture for QUTEST +* Last Updated for Version: 7.2.0 +* Date of the Last Update: 2022-12-22 +* +* Q u a n t u m L e a P s +* ------------------------ +* Modern Embedded Software +* +* Copyright (C) 2005 Quantum Leaps, LLC. All rights reserved. +* +* This program is open source software: you can redistribute it and/or +* modify it under the terms of the GNU General Public License as published +* 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: +* +* +*****************************************************************************/ +#include "qpc.h" +#include "gizmo.h" +#include "bsp.h" + +Q_DEFINE_THIS_FILE + +/*..........................................................................*/ +int main(int argc, char *argv[]) { + + QF_init(); /* initialize the framework */ + + /* initialize the QS software tracing */ + if (QS_INIT(argc > 1 ? argv[1] : (void *)0) == 0U) { + Q_ERROR(); /* no point in continuing if QS initialzation fails */ + } + + BSP_init(); /* initialize the BSP */ + + /* pause execution of the test and wait for the test script to continue */ + QS_TEST_PAUSE(); + + /* publish-subscribe not used, no call to QF_psInit() */ + + /* initialize event pools... */ + static QF_MPOOL_EL(QEvt) smlPoolSto[10]; /* storage for small pool*/ + QF_poolInit(smlPoolSto, sizeof(smlPoolSto), sizeof(smlPoolSto[0])); + + /* start the active objects... */ + Gizmo_ctor(); + static QEvt const *qSto[10]; /* event queue storage */ + QACTIVE_START(AO_Gizmo, + 2U, /* QF-priority/preemption-threshold */ + qSto, Q_DIM(qSto), + (void *)0, 0U, (void *)0); + + return QF_run(); +} + +/*--------------------------------------------------------------------------*/ +void QS_onTestSetup(void) { +} +/*..........................................................................*/ +void QS_onTestTeardown(void) { +} +/*..........................................................................*/ +void QS_onCommand(uint8_t cmdId, + uint32_t param1, uint32_t param2, uint32_t param3) +{ + Q_UNUSED_PAR(cmdId); + Q_UNUSED_PAR(param1); + Q_UNUSED_PAR(param2); + Q_UNUSED_PAR(param3); +} + +/*..........................................................................*/ +/* host callback function to "massage" the event, if necessary */ +void QS_onTestEvt(QEvt *e) { + Q_UNUSED_PAR(e); +} +/*..........................................................................*/ +/*! callback function to output the posted QP events (not used here) */ +void QS_onTestPost(void const *sender, QActive *recipient, + QEvt const *e, bool status) +{ + Q_UNUSED_PAR(sender); + Q_UNUSED_PAR(recipient); + Q_UNUSED_PAR(e); + Q_UNUSED_PAR(status); +} diff --git a/examples/qutest/start_seq/test/test_start_seq.py b/examples/qutest/start_seq/test/test_start_seq.py new file mode 100644 index 00000000..c7076a41 --- /dev/null +++ b/examples/qutest/start_seq/test/test_start_seq.py @@ -0,0 +1,53 @@ +# test-script for QUTest unit testing harness +# see https://www.state-machine.com/qtools/qutest.html + +note(''' +This test group demonstrates testing of the start sequence. +Specifically, a "Gizmo" AO needs to start either in the sate +"on_mains", when the AO detects at runtime that main power +is available, or in the state "on_battery", when it is not. +However, the state machine semantics does not allow guard +conditions on the initial transition itself. A workaroudn is +to self-post a START event, which then triggers a transition +with a guard. +''') + +def on_reset(): + expect_pause() + +test(''' +QACTIVE_START(AO_Gizmo) with status==1, +should go to state "on_mains" +''') +current_obj(OBJ_AP, 'status') +poke(0, 1, pack(' St-Init Obj=AO_Gizmo,State=QHsm_top->Gizmo_init") +expect("@timestamp AO-Post Sdr=AO_Gizmo,Obj=AO_Gizmo,Evt St-Entry Obj=AO_Gizmo,State=Gizmo_init") +expect("@timestamp Init===> Obj=AO_Gizmo,State=Gizmo_init") +expect_run() +expect("@timestamp AO-GetL Obj=AO_Gizmo,Evt Obj=AO_Gizmo,Sig=START_SIG,State=Gizmo_init") +expect("@timestamp USER+005 START") +expect("@timestamp ===>Tran Obj=AO_Gizmo,Sig=START_SIG,State=Gizmo_init->Gizmo_on_mains") + +test(''' +QACTIVE_START(AO_Gizmo) with status==0, +should go to state "on_battery" +''') +current_obj(OBJ_AP, 'status') +poke(0, 1, pack(' St-Init Obj=AO_Gizmo,State=QHsm_top->Gizmo_init") +expect("@timestamp AO-Post Sdr=AO_Gizmo,Obj=AO_Gizmo,Evt St-Entry Obj=AO_Gizmo,State=Gizmo_init") +expect("@timestamp Init===> Obj=AO_Gizmo,State=Gizmo_init") +expect_run() +expect("@timestamp AO-GetL Obj=AO_Gizmo,Evt Obj=AO_Gizmo,Sig=START_SIG,State=Gizmo_init") +expect("@timestamp USER+005 START") +expect("@timestamp ===>Tran Obj=AO_Gizmo,Sig=START_SIG,State=Gizmo_init->Gizmo_on_battery") + diff --git a/examples/qutest/start_seq/test/test_tm4c123-arm.uvoptx b/examples/qutest/start_seq/test/test_tm4c123-arm.uvoptx new file mode 100644 index 00000000..a694dc4a --- /dev/null +++ b/examples/qutest/start_seq/test/test_tm4c123-arm.uvoptx @@ -0,0 +1,581 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj; *.o + *.lib + *.txt; *.h; *.inc + *.plm + *.cpp + 0 + + + + 0 + 0 + + + + test_tm4c123-arm + 0x4 + ARM-ADS + + 12000000 + + 1 + 1 + 1 + 0 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\dbg_armclang\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 4 + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + 0 + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 8 + + + + + + + + + + + BIN\lmidk-agdi.dll + + + + 0 + ARMRTXEVENTFLAGS + -L70 -Z18 -C0 -M0 -T1 + + + 0 + UL2CM3 + UL2CM3(-O207 -S0 -C0 -FO7 -FN1 -FC1000 -FD20000000 -FF0TM4C123_256 -FL040000 -FS00 -FP0($$Device:TM4C123GH6PM$Flash\TM4C123_256.FLM) + + + 0 + DLGTARM + (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) + + + 0 + ARMDBGFLAGS + + + + 0 + lmidk-agdi + -U0E2006F4 -O4622 -S4 -FO61 + + + + + 0 + 0 + 97 + 1 +
1230
+ 0 + 0 + 0 + 0 + 0 + 1 + ..\src\blinky.c + + \\test_tm4c123_arm\../src/blinky.c\97 +
+
+ + + 1 + 2 + 0x20000200 + 0 + + + + + 2 + 0 + 0x400 + 0 + + + + 0 + + + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + 0 + 0 + 0 + + + + + + + + +
+
+ + + Applicatioin + 1 + 0 + 0 + 0 + + 1 + 1 + 1 + 0 + 0 + 0 + .\test_blinky.c + test_blinky.c + 0 + 0 + + + 1 + 2 + 1 + 0 + 0 + 0 + ..\src\blinky.c + blinky.c + 0 + 0 + + + 1 + 3 + 5 + 0 + 0 + 0 + ..\src\blinky.h + blinky.h + 0 + 0 + + + 1 + 4 + 1 + 0 + 0 + 0 + ..\src\bsp.c + bsp.c + 0 + 0 + + + 1 + 5 + 5 + 0 + 0 + 0 + ..\src\bsp.h + bsp.h + 0 + 0 + + + 1 + 6 + 1 + 0 + 0 + 0 + ..\..\..\..\include\qstamp.c + qstamp.c + 0 + 0 + + + + + ek-tm4c123gxl + 1 + 0 + 0 + 0 + + 2 + 7 + 1 + 0 + 0 + 0 + ..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.c + system_TM4C123GH6PM.c + 0 + 0 + + + 2 + 8 + 5 + 0 + 0 + 0 + ..\..\..\..\3rd_party\ek-tm4c123gxl\TM4C123GH6PM.h + TM4C123GH6PM.h + 0 + 0 + + + 2 + 9 + 2 + 0 + 0 + 0 + ..\..\..\..\3rd_party\ek-tm4c123gxl\arm\startup_TM4C123GH6PM.s + startup_TM4C123GH6PM.s + 0 + 0 + + + + + QP + 1 + 0 + 0 + 0 + + 3 + 10 + 1 + 0 + 0 + 0 + ..\..\..\..\src\qf\qep_hsm.c + qep_hsm.c + 0 + 0 + + + 3 + 11 + 1 + 0 + 0 + 0 + ..\..\..\..\src\qf\qep_msm.c + qep_msm.c + 0 + 0 + + + 3 + 12 + 1 + 0 + 0 + 0 + ..\..\..\..\src\qf\qf_act.c + qf_act.c + 0 + 0 + + + 3 + 13 + 1 + 0 + 0 + 0 + ..\..\..\..\src\qf\qf_actq.c + qf_actq.c + 0 + 0 + + + 3 + 14 + 1 + 0 + 0 + 0 + ..\..\..\..\src\qf\qf_defer.c + qf_defer.c + 0 + 0 + + + 3 + 15 + 1 + 0 + 0 + 0 + ..\..\..\..\src\qf\qf_dyn.c + qf_dyn.c + 0 + 0 + + + 3 + 16 + 1 + 0 + 0 + 0 + ..\..\..\..\src\qf\qf_mem.c + qf_mem.c + 0 + 0 + + + 3 + 17 + 1 + 0 + 0 + 0 + ..\..\..\..\src\qf\qf_ps.c + qf_ps.c + 0 + 0 + + + 3 + 18 + 1 + 0 + 0 + 0 + ..\..\..\..\src\qf\qf_qact.c + qf_qact.c + 0 + 0 + + + 3 + 19 + 1 + 0 + 0 + 0 + ..\..\..\..\src\qf\qf_qeq.c + qf_qeq.c + 0 + 0 + + + 3 + 20 + 1 + 0 + 0 + 0 + ..\..\..\..\src\qf\qf_qmact.c + qf_qmact.c + 0 + 0 + + + 3 + 21 + 1 + 0 + 0 + 0 + ..\..\..\..\src\qf\qf_time.c + qf_time.c + 0 + 0 + + + 3 + 22 + 1 + 0 + 0 + 0 + ..\..\..\..\src\qs\qs.c + qs.c + 0 + 0 + + + 3 + 23 + 1 + 0 + 0 + 0 + ..\..\..\..\src\qs\qs_64bit.c + qs_64bit.c + 0 + 0 + + + 3 + 24 + 1 + 0 + 0 + 0 + ..\..\..\..\src\qs\qs_fp.c + qs_fp.c + 0 + 0 + + + 3 + 25 + 1 + 0 + 0 + 0 + ..\..\..\..\src\qs\qs_rx.c + qs_rx.c + 0 + 0 + + + 3 + 26 + 1 + 0 + 0 + 0 + ..\..\..\..\src\qs\qutest.c + qutest.c + 0 + 0 + + + + + QP_port + 1 + 0 + 0 + 0 + + 4 + 27 + 1 + 0 + 0 + 0 + ..\..\target_tm4c123\qutest_port.c + qutest_port.c + 0 + 0 + + + +
diff --git a/examples/qutest/start_seq/test/test_tm4c123-arm.uvprojx b/examples/qutest/start_seq/test/test_tm4c123-arm.uvprojx new file mode 100644 index 00000000..2482c93d --- /dev/null +++ b/examples/qutest/start_seq/test/test_tm4c123-arm.uvprojx @@ -0,0 +1,547 @@ + + + + 2.1 + +
### uVision Project, (C) Keil Software
+ + + + test_tm4c123-arm + 0x4 + ARM-ADS + 5060750::V5.06 update 6 (build 750)::ARMCC + 0 + + + TM4C123GH6PM + Texas Instruments + Keil.TM4C_DFP.1.1.0 + http://www.keil.com/pack/ + IROM(0x00000000,0x040000) IRAM(0x20000000,0x008000) CPUTYPE("Cortex-M4") FPU2 CLOCK(12000000) ELITTLE + + + UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0TM4C123_256 -FS00 -FL040000 -FP0($$Device:TM4C123GH6PM$Flash\TM4C123_256.FLM)) + 0 + $$Device:TM4C123GH6PM$Device\Include\TM4C123\TM4C123.h + + + + + + + + + + $$Device:TM4C123GH6PM$SVD\TM4C123\TM4C123GH6PM.svd + 0 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\dbg_armclang\ + test_tm4c123-arm + 1 + 0 + 0 + 1 + 1 + .\dbg_armclang\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 1 + 0 + cmd /c "del .\dbg_armclang\qstamp.o" + + 0 + 0 + 0 + 0 + + + 1 + 0 + fromelf --bin --output .\dbg_armclang\test_tm4c123-arm.bin .\dbg_armclang\test_tm4c123-arm.axf + + 0 + 0 + 0 + 0 + + 1 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + + SARMCM3.DLL + -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + + 1 + 0 + 0 + 0 + 16 + + + + + 1 + 0 + 0 + 1 + 1 + 4097 + + 1 + BIN\UL2CM3.DLL + + + + + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + "Cortex-M4" + + 0 + 0 + 0 + 1 + 1 + 0 + 0 + 2 + 0 + 0 + 0 + 8 + 1 + 0 + 0 + 0 + 3 + 3 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x8000 + + + 1 + 0x0 + 0x40000 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x40000 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x8000 + + + 0 + 0x0 + 0x0 + + + + + + 0 + 1 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + Q_SPY Q_UTEST __FPU_PRESENT + + .;..\src;..\..\..\..\include;..\..\..\..\src;..\..\..\..\ports\arm-cm\qutest;..\..\..\..\3rd_party\CMSIS\Include;..\..\..\..\3rd_party\ek-tm4c123gxl + + + + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + + + Stack_Size=2048 Heap_Size=16 + + + + + + 1 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x20000000 + + + + + --entry Reset_Handler + + + + + + + + Applicatioin + + + test_blinky.c + 1 + .\test_blinky.c + + + blinky.c + 1 + ..\src\blinky.c + + + blinky.h + 5 + ..\src\blinky.h + + + bsp.c + 1 + ..\src\bsp.c + + + bsp.h + 5 + ..\src\bsp.h + + + qstamp.c + 1 + ..\..\..\..\include\qstamp.c + + + + + ek-tm4c123gxl + + + system_TM4C123GH6PM.c + 1 + ..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.c + + + TM4C123GH6PM.h + 5 + ..\..\..\..\3rd_party\ek-tm4c123gxl\TM4C123GH6PM.h + + + startup_TM4C123GH6PM.s + 2 + ..\..\..\..\3rd_party\ek-tm4c123gxl\arm\startup_TM4C123GH6PM.s + + + + + QP + + + qep_hsm.c + 1 + ..\..\..\..\src\qf\qep_hsm.c + + + qep_msm.c + 1 + ..\..\..\..\src\qf\qep_msm.c + + + qf_act.c + 1 + ..\..\..\..\src\qf\qf_act.c + + + qf_actq.c + 1 + ..\..\..\..\src\qf\qf_actq.c + + + qf_defer.c + 1 + ..\..\..\..\src\qf\qf_defer.c + + + qf_dyn.c + 1 + ..\..\..\..\src\qf\qf_dyn.c + + + qf_mem.c + 1 + ..\..\..\..\src\qf\qf_mem.c + + + qf_ps.c + 1 + ..\..\..\..\src\qf\qf_ps.c + + + qf_qact.c + 1 + ..\..\..\..\src\qf\qf_qact.c + + + qf_qeq.c + 1 + ..\..\..\..\src\qf\qf_qeq.c + + + qf_qmact.c + 1 + ..\..\..\..\src\qf\qf_qmact.c + + + qf_time.c + 1 + ..\..\..\..\src\qf\qf_time.c + + + qs.c + 1 + ..\..\..\..\src\qs\qs.c + + + qs_64bit.c + 1 + ..\..\..\..\src\qs\qs_64bit.c + + + qs_fp.c + 1 + ..\..\..\..\src\qs\qs_fp.c + + + qs_rx.c + 1 + ..\..\..\..\src\qs\qs_rx.c + + + qutest.c + 1 + ..\..\..\..\src\qs\qutest.c + + + + + QP_port + + + qutest_port.c + 1 + ..\..\target_tm4c123\qutest_port.c + + + + + + + + + + + + + +
diff --git a/examples/qutest/start_seq/test/test_vc.sln b/examples/qutest/start_seq/test/test_vc.sln new file mode 100644 index 00000000..fc1e7c19 --- /dev/null +++ b/examples/qutest/start_seq/test/test_vc.sln @@ -0,0 +1,18 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0.31101.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_vc", "test_vc.vcxproj", "{8CC465F7-872E-4D03-B93C-1B64858B4E11}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8CC465F7-872E-4D03-B93C-1B64858B4E11}.Debug|Win32.ActiveCfg = Debug|Win32 + {8CC465F7-872E-4D03-B93C-1B64858B4E11}.Debug|Win32.Build.0 = Debug|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/examples/qutest/start_seq/test/test_vc.vcxproj b/examples/qutest/start_seq/test/test_vc.vcxproj new file mode 100644 index 00000000..671614a1 --- /dev/null +++ b/examples/qutest/start_seq/test/test_vc.vcxproj @@ -0,0 +1,186 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + QSpy + Win32 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {8CC465F7-872E-4D03-B93C-1B64858B4E11} + test_vc + Win32Proj + 10.0 + + + + Application + NotSet + v142 + + + Application + NotSet + true + v142 + + + Application + NotSet + v142 + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.40219.1 + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + + + + Disabled + ../src;../../../../include;../../../../ports/win32-qutest;%(AdditionalIncludeDirectories) + Q_SPY;Q_UTEST;Q_HOST;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + false + + + Default + MultiThreaded + NotUsing + Level4 + ProgramDatabase + 4127 + Default + + + ws2_32.lib;%(AdditionalDependencies) + %(AdditionalLibraryDirectories) + true + Console + MachineX86 + + + cmd /c "del $(OutDir)qstamp.obj" + + + + + MaxSpeed + true + .;../../../include;../../../ports/win32-qv;%(AdditionalIncludeDirectories) + NDEBUG;snprintf=_snprintf;WIN32;_CONSOLE;%(PreprocessorDefinitions) + false + + + Default + MultiThreaded + true + NotUsing + Level4 + ProgramDatabase + 4127 + + + %(AdditionalDependencies) + %(AdditionalLibraryDirectories) + true + Console + true + true + MachineX86 + + + cmd /c "del $(OutDir)qstamp.obj" + + + + + Disabled + .;../../../include;../../../ports/win32-qv;$(QTOOLS)/qspy/include;%(AdditionalIncludeDirectories) + Q_SPY;WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + false + + + Default + MultiThreaded + NotUsing + Level4 + ProgramDatabase + 4127 + + + ws2_32.lib;%(AdditionalDependencies) + %(AdditionalLibraryDirectories) + true + Console + MachineX86 + + + cmd /c "del $(OutDir)qstamp.obj" + + + + + + \ No newline at end of file diff --git a/examples/qutest/start_seq/test/test_vc.vcxproj.filters b/examples/qutest/start_seq/test/test_vc.vcxproj.filters new file mode 100644 index 00000000..0b3e7b1b --- /dev/null +++ b/examples/qutest/start_seq/test/test_vc.vcxproj.filters @@ -0,0 +1,94 @@ + + + + + + + + QP + + + QP + + + QP + + + QP + + + QP + + + QP + + + QP + + + QP + + + QP + + + QP + + + QP + + + QP + + + QP + + + QP + + + QP + + + QP + + + QP + + + QP + + + QP_port + + + + + + + QP_port + + + QP_port + + + QP_port + + + QP_port + + + + + {9aed7b5b-079d-48b1-bf74-404e39b15bb6} + + + {02755b40-4291-4842-8d01-96867b6c8cf5} + + + + + QP_port + + + \ No newline at end of file diff --git a/examples/qutest/unity_basic/test/Makefile b/examples/qutest/unity_basic/test/Makefile index db1e9e9f..f072ac4d 100644 --- a/examples/qutest/unity_basic/test/Makefile +++ b/examples/qutest/unity_basic/test/Makefile @@ -1,7 +1,7 @@ ############################################################################## # Product: Makefile for QUTEST-QP/C for Windows and POSIX *HOSTS* -# Last updated for version 7.1.3 -# Last updated on 2022-11-13 +# Last Updated for Version: 7.2.0 +# Date of the Last Update: 2022-12-21 # # Q u a n t u m L e a P s # ------------------------ @@ -154,8 +154,6 @@ ifeq ("$(wildcard $(QUTEST))","") QUTEST := python3 $(QTOOLS)/qutest/qutest.py endif -TESTS := *.py - #----------------------------------------------------------------------------- # basic utilities (depends on the OS this Makefile runs on): # @@ -223,7 +221,7 @@ $(TARGET_EXE) : $(C_OBJS_EXT) $(CPP_OBJS_EXT) $(LINK) $(LINKFLAGS) $(LIB_DIRS) -o $@ $^ $(BIN_DIR)/qstamp.o $(LIBS) run : $(TARGET_EXE) - $(QUTEST) $(TESTS) $(TARGET_EXE) $(HOST) + $(QUTEST) -e$(TARGET_EXE) -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) $(BIN_DIR)/%.d : %.cpp $(CPP) -MM -MT $(@:.d=.o) $(CPPFLAGS) $< > $@ @@ -250,7 +248,7 @@ endif endif debug : - $(QUTEST) $(TESTS) DEBUG $(HOST) + $(QUTEST) -edebug -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) clean : -$(RM) $(BIN_DIR)/*.* diff --git a/examples/qutest/unity_basic/test/make_efm32 b/examples/qutest/unity_basic/test/make_efm32 index fefdece6..379c6b45 100644 --- a/examples/qutest/unity_basic/test/make_efm32 +++ b/examples/qutest/unity_basic/test/make_efm32 @@ -1,7 +1,7 @@ ############################################################################## # Product: Makefile for QP/C on EMF32, QUTEST, GNU-ARM -# Last Updated for Version: 7.1.0 -# Date of the Last Update: 2022-08-20 +# Last Updated for Version: 7.2.0 +# Date of the Last Update: 2022-12-21 # # Q u a n t u m L e a P s # ------------------------ @@ -192,8 +192,6 @@ ifeq ("$(wildcard $(QUTEST))","") QUTEST := python3 $(QTOOLS)/qutest/qutest.py endif -TESTS := *.py - #----------------------------------------------------------------------------- # build options # @@ -261,7 +259,7 @@ flash : $(FLASH) $(TARGET_BIN) run : $(TARGET_BIN) - $(QUTEST) $(TESTS) $(TARGET_EXE) $(HOST) + $(QUTEST) -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ diff --git a/examples/qutest/unity_basic/test/make_tm4c123 b/examples/qutest/unity_basic/test/make_tm4c123 index f672561a..5c061cbe 100644 --- a/examples/qutest/unity_basic/test/make_tm4c123 +++ b/examples/qutest/unity_basic/test/make_tm4c123 @@ -1,7 +1,7 @@ ############################################################################## # Product: Makefile for QP/C on TM4C123, QUTEST, GNU-ARM -# Last Updated for Version: 7.1.0 -# Date of the Last Update: 2022-08-20 +# Last Updated for Version: 7.2.0 +# Date of the Last Update: 2022-12-21 # # Q u a n t u m L e a P s # ------------------------ @@ -190,8 +190,6 @@ ifeq ("$(wildcard $(QUTEST))","") QUTEST := python3 $(QTOOLS)/qutest/qutest.py endif -TESTS := *.py - #----------------------------------------------------------------------------- # build options # @@ -264,7 +262,7 @@ flash : @echo Reset the board MANUALLY! run : $(TARGET_BIN) - $(QUTEST) $(TESTS) $(TARGET_EXE) $(HOST) + $(QUTEST) -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ diff --git a/examples/qutest/unity_basic/test/test_ProductionCode.c b/examples/qutest/unity_basic/test/test_ProductionCode.c index c0e813c2..aed9f6e5 100644 --- a/examples/qutest/unity_basic/test/test_ProductionCode.c +++ b/examples/qutest/unity_basic/test/test_ProductionCode.c @@ -1,7 +1,7 @@ /***************************************************************************** * Purpose: example QUTEST fixture for the basic example from Unity -* Last Updated for Version: 6.3.6 -* Date of the Last Update: 2018-10-11 +* Last Updated for Version: 7.2.0 +* Date of the Last Update: 2022-11-30 * * Q u a n t u m L e a P s * ------------------------ @@ -86,7 +86,7 @@ void QS_onCommand(uint8_t cmdId, int ret = FunctionWhichReturnsLocalVariable(); QS_BEGIN_ID(QS_USER + cmdId, 0U) /* app-specific record */ QS_FUN(&FunctionWhichReturnsLocalVariable); /* function called */ - QS_U32_HEX(0, (uint32_t)ret); /* returned value */ + QS_U32(QS_HEX_FMT, (uint32_t)ret); /* returned value */ QS_END() break; } @@ -94,10 +94,10 @@ void QS_onCommand(uint8_t cmdId, break; } - /* unused parametrers... */ - //(void)param1; - (void)param2; - (void)param3; + /* unused parameters... */ + //Q_UNUSED_PAR(param1); + Q_UNUSED_PAR(param2); + Q_UNUSED_PAR(param3); } /*..........................................................................*/ /* host callback function to "massage" the event, if necessary */ @@ -112,8 +112,8 @@ void QS_onTestEvt(QEvt *e) { void QS_onTestPost(void const *sender, QActive *recipient, QEvt const *e, bool status) { - (void)sender; - (void)recipient; - (void)e; - (void)status; + Q_UNUSED_PAR(sender); + Q_UNUSED_PAR(recipient); + Q_UNUSED_PAR(e); + Q_UNUSED_PAR(status); } diff --git a/examples/qutest/unity_basic/test/test_ProductionCode.py b/examples/qutest/unity_basic/test/test_ProductionCode.py index 9ad16d97..2e302e4d 100644 --- a/examples/qutest/unity_basic/test/test_ProductionCode.py +++ b/examples/qutest/unity_basic/test/test_ProductionCode.py @@ -9,55 +9,64 @@ def on_setup(): poke(0, 4, pack(' $@ @@ -251,7 +249,7 @@ endif endif debug : - $(QUTEST) $(TESTS) DEBUG $(HOST) + $(QUTEST) -edebug -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) clean : -$(RM) $(BIN_DIR)/*.* diff --git a/examples/qutest/unity_ledbar/qutest/make_efm32 b/examples/qutest/unity_ledbar/qutest/make_efm32 index b14e6b12..44286f87 100644 --- a/examples/qutest/unity_ledbar/qutest/make_efm32 +++ b/examples/qutest/unity_ledbar/qutest/make_efm32 @@ -1,7 +1,7 @@ ############################################################################## # Product: Makefile for QP/C on EMF32, QUTEST, GNU-ARM -# Last Updated for Version: 7.1.0 -# Date of the Last Update: 2022-08-20 +# Last Updated for Version: 7.2.0 +# Date of the Last Update: 2022-12-21 # # Q u a n t u m L e a P s # ------------------------ @@ -193,8 +193,6 @@ ifeq ("$(wildcard $(QUTEST))","") QUTEST := python3 $(QTOOLS)/qutest/qutest.py endif -TESTS := *.py - #----------------------------------------------------------------------------- # build options # @@ -262,7 +260,7 @@ flash : $(FLASH) $(TARGET_BIN) run : $(TARGET_BIN) - $(QUTEST) $(TESTS) $(TARGET_EXE) $(HOST) + $(QUTEST) -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ diff --git a/examples/qutest/unity_ledbar/qutest/make_nucleo-l053r8 b/examples/qutest/unity_ledbar/qutest/make_nucleo-l053r8 index ba9ac028..33071842 100644 --- a/examples/qutest/unity_ledbar/qutest/make_nucleo-l053r8 +++ b/examples/qutest/unity_ledbar/qutest/make_nucleo-l053r8 @@ -1,7 +1,7 @@ ############################################################################## # Product: Makefile for QP/C on NUCLEO-L053R8 board, QUTEST, GNU-ARM -# Last Updated for Version: 7.1.0 -# Date of the Last Update: 2022-08-20 +# Last Updated for Version: 7.2.0 +# Date of the Last Update: 2022-12-21 # # Q u a n t u m L e a P s # ------------------------ @@ -167,11 +167,11 @@ LINK := $(GNU_ARM)/bin/arm-none-eabi-gcc BIN := $(GNU_ARM)/bin/arm-none-eabi-objcopy #----------------------------------------------------------------------------- -# NOTE: The following symbol USB assumes that the NUCLEO board +# NOTE: The symbol USB must be provided for the NUCLEO board # has enumerated as USB drive f: # ifeq ($(USB),) -USB := f: +$(error USB drive not provided for the NUCLEO board.) endif ############################################################################## @@ -192,8 +192,6 @@ ifeq ("$(wildcard $(QUTEST))","") QUTEST := python3 $(QTOOLS)/qutest/qutest.py endif -TESTS := *.py - #----------------------------------------------------------------------------- # build options # @@ -262,7 +260,7 @@ flash : $(CP) $(TARGET_BIN) $(USB) run : $(TARGET_BIN) - $(QUTEST) $(TESTS) $(TARGET_EXE) $(HOST) + $(QUTEST) -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ diff --git a/examples/qutest/unity_ledbar/qutest/make_tm4c123 b/examples/qutest/unity_ledbar/qutest/make_tm4c123 index 7a0448de..a40b29dc 100644 --- a/examples/qutest/unity_ledbar/qutest/make_tm4c123 +++ b/examples/qutest/unity_ledbar/qutest/make_tm4c123 @@ -1,7 +1,7 @@ ############################################################################## # Product: Makefile for QP/C on TM4C123, QUTEST, GNU-ARM -# Last Updated for Version: 7.1.0 -# Date of the Last Update: 2022-08-20 +# Last Updated for Version: 7.2.0 +# Date of the Last Update: 2022-12-21 # # Q u a n t u m L e a P s # ------------------------ @@ -191,8 +191,6 @@ ifeq ("$(wildcard $(QUTEST))","") QUTEST := python3 $(QTOOLS)/qutest/qutest.py endif -TESTS := *.py - #----------------------------------------------------------------------------- # build options # @@ -265,7 +263,7 @@ flash : @echo Reset the board MANUALLY! run : $(TARGET_BIN) - $(QUTEST) $(TESTS) $(TARGET_EXE) $(HOST) + $(QUTEST) -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ diff --git a/examples/qutest/unity_ledbar/test/Makefile b/examples/qutest/unity_ledbar/test/Makefile index 98455617..b7565fb6 100644 --- a/examples/qutest/unity_ledbar/test/Makefile +++ b/examples/qutest/unity_ledbar/test/Makefile @@ -1,6 +1,6 @@ ############################################################################## # Makefile for the Unity test harness v2.5.2, for Windows, Linux, MacOS -# Last updated for version 7.1.3 +# Last updated for version 7.2.0 # Last updated on 2022-11-13 # # Q u a n t u m L e a P s @@ -212,6 +212,7 @@ endif endif endif + clean : -$(RM) $(BIN_DIR)/*.o \ $(BIN_DIR)/*.d \ diff --git a/examples/qutest/unity_ledbar/trace/Makefile b/examples/qutest/unity_ledbar/trace/Makefile index 3a347c99..dc8df341 100644 --- a/examples/qutest/unity_ledbar/trace/Makefile +++ b/examples/qutest/unity_ledbar/trace/Makefile @@ -1,6 +1,6 @@ ############################################################################## # Product: Makefile for QUTEST-QP/C for Windows and POSIX *HOSTS* -# Last updated for version 7.1.3 +# Last updated for version 7.2.0 # Last updated on 2022-11-13 # # Q u a n t u m L e a P s diff --git a/examples/qutest/unity_ledbar2/qutest/Makefile b/examples/qutest/unity_ledbar2/qutest/Makefile index 89b478a6..43f60f75 100644 --- a/examples/qutest/unity_ledbar2/qutest/Makefile +++ b/examples/qutest/unity_ledbar2/qutest/Makefile @@ -1,7 +1,7 @@ ############################################################################## # Product: Makefile for QUTEST-QP/C for Windows and POSIX *HOSTS* -# Last updated for version 7.1.3 -# Last updated on 2022-11-13 +# Last Updated for Version: 7.2.0 +# Date of the Last Update: 2022-12-21 # # Q u a n t u m L e a P s # ------------------------ @@ -156,8 +156,6 @@ ifeq ("$(wildcard $(QUTEST))","") QUTEST := python3 $(QTOOLS)/qutest/qutest.py endif -TESTS := *.py - #----------------------------------------------------------------------------- # basic utilities (depends on the OS this Makefile runs on): # @@ -225,7 +223,7 @@ $(TARGET_EXE) : $(C_OBJS_EXT) $(CPP_OBJS_EXT) $(LINK) $(LINKFLAGS) $(LIB_DIRS) -o $@ $^ $(BIN_DIR)/qstamp.o $(LIBS) run : $(TARGET_EXE) - $(QUTEST) $(TESTS) $(TARGET_EXE) $(HOST) + $(QUTEST) -e$(TARGET_EXE) -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) $(BIN_DIR)/%.d : %.cpp $(CPP) -MM -MT $(@:.d=.o) $(CPPFLAGS) $< > $@ @@ -252,7 +250,7 @@ endif endif debug : - $(QUTEST) $(TESTS) DEBUG $(HOST) + $(QUTEST) -edebug -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) clean : -$(RM) $(BIN_DIR)/*.* diff --git a/examples/qutest/unity_ledbar2/qutest/make_nucleo-l053r8 b/examples/qutest/unity_ledbar2/qutest/make_nucleo-l053r8 index 035248f2..8a1b075e 100644 --- a/examples/qutest/unity_ledbar2/qutest/make_nucleo-l053r8 +++ b/examples/qutest/unity_ledbar2/qutest/make_nucleo-l053r8 @@ -1,7 +1,7 @@ ############################################################################## # Product: Makefile for QUTEST-QP/C on NUCLEO-L053R8 board, QUTEST, GNU-ARM -# Last Updated for Version: 7.1.0 -# Date of the Last Update: 2022-08-20 +# Last Updated for Version: 7.2.0 +# Date of the Last Update: 2022-12-21 # # Q u a n t u m L e a P s # ------------------------ @@ -168,11 +168,11 @@ LINK := $(GNU_ARM)/bin/arm-none-eabi-gcc BIN := $(GNU_ARM)/bin/arm-none-eabi-objcopy #----------------------------------------------------------------------------- -# NOTE: The following symbol USB assumes that the NUCLEO board +# NOTE: The symbol USB must be provided for the NUCLEO board # has enumerated as USB drive f: # ifeq ($(USB),) -USB := f: +$(error USB drive not provided for the NUCLEO board.) endif ############################################################################## @@ -193,8 +193,6 @@ ifeq ("$(wildcard $(QUTEST))","") QUTEST := python3 $(QTOOLS)/qutest/qutest.py endif -TESTS := *.py - #----------------------------------------------------------------------------- # build options # @@ -263,7 +261,7 @@ flash : $(CP) $(TARGET_BIN) $(USB) run : $(TARGET_BIN) - $(QUTEST) $(TESTS) $(TARGET_EXE) $(HOST) + $(QUTEST) -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ diff --git a/examples/qutest/unity_ledbar2/test/Makefile b/examples/qutest/unity_ledbar2/test/Makefile index 6ca05174..3c1c4dc0 100644 --- a/examples/qutest/unity_ledbar2/test/Makefile +++ b/examples/qutest/unity_ledbar2/test/Makefile @@ -1,6 +1,6 @@ ############################################################################## # Makefile for the Unity test harness v2.5.2, for Windows, Linux, MacOS -# Last updated for version 7.1.3 +# Last updated for version 7.2.0 # Last updated on 2022-11-13 # # Q u a n t u m L e a P s diff --git a/examples/qutest/unity_mock/test/Makefile b/examples/qutest/unity_mock/test/Makefile index d9c7dac5..960da1bd 100644 --- a/examples/qutest/unity_mock/test/Makefile +++ b/examples/qutest/unity_mock/test/Makefile @@ -1,7 +1,7 @@ ############################################################################## # Product: Makefile for QUTEST-QP/C for Windows and POSIX *HOSTS* -# Last updated for version 7.1.3 -# Last updated on 2022-11-13 +# Last Updated for Version: 7.2.0 +# Date of the Last Update: 2022-12-21 # # Q u a n t u m L e a P s # ------------------------ @@ -155,8 +155,6 @@ ifeq ("$(wildcard $(QUTEST))","") QUTEST := python3 $(QTOOLS)/qutest/qutest.py endif -TESTS := *.py - #----------------------------------------------------------------------------- # basic utilities (depends on the OS this Makefile runs on): # @@ -224,7 +222,7 @@ $(TARGET_EXE) : $(C_OBJS_EXT) $(CPP_OBJS_EXT) $(LINK) $(LINKFLAGS) $(LIB_DIRS) -o $@ $^ $(BIN_DIR)/qstamp.o $(LIBS) run : $(TARGET_EXE) - $(QUTEST) $(TESTS) $(TARGET_EXE) $(HOST) + $(QUTEST) -e$(TARGET_EXE) -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) $(BIN_DIR)/%.d : %.cpp $(CPP) -MM -MT $(@:.d=.o) $(CPPFLAGS) $< > $@ @@ -251,7 +249,7 @@ endif endif debug : - $(QUTEST) $(TESTS) DEBUG $(HOST) + $(QUTEST) -edebug -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) clean : -$(RM) $(BIN_DIR)/*.* diff --git a/examples/qutest/unity_mock/test/make_efm32 b/examples/qutest/unity_mock/test/make_efm32 index 2e38732a..9bc2fa87 100644 --- a/examples/qutest/unity_mock/test/make_efm32 +++ b/examples/qutest/unity_mock/test/make_efm32 @@ -1,7 +1,7 @@ ############################################################################## # Product: Makefile for QP/C on EMF32, QUTEST, GNU-ARM -# Last Updated for Version: 7.1.0 -# Date of the Last Update: 2022-08-20 +# Last Updated for Version: 7.2.0 +# Date of the Last Update: 2022-12-21 # # Q u a n t u m L e a P s # ------------------------ @@ -193,8 +193,6 @@ ifeq ("$(wildcard $(QUTEST))","") QUTEST := python3 $(QTOOLS)/qutest/qutest.py endif -TESTS := *.py - #----------------------------------------------------------------------------- # build options # @@ -262,7 +260,7 @@ flash : $(FLASH) $(TARGET_BIN) run : $(TARGET_BIN) - $(QUTEST) $(TESTS) $(TARGET_EXE) $(HOST) + $(QUTEST) -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ diff --git a/examples/qutest/unity_mock/test/make_tm4c123 b/examples/qutest/unity_mock/test/make_tm4c123 index 413eacef..618a9554 100644 --- a/examples/qutest/unity_mock/test/make_tm4c123 +++ b/examples/qutest/unity_mock/test/make_tm4c123 @@ -1,7 +1,7 @@ ############################################################################## # Product: Makefile for QP/C on TM4C123, QUTEST, GNU-ARM -# Last Updated for Version: 7.1.0 -# Date of the Last Update: 2022-08-20 +# Last Updated for Version: 7.2.0 +# Date of the Last Update: 2022-12-21 # # Q u a n t u m L e a P s # ------------------------ @@ -191,8 +191,6 @@ ifeq ("$(wildcard $(QUTEST))","") QUTEST := python3 $(QTOOLS)/qutest/qutest.py endif -TESTS := *.py - #----------------------------------------------------------------------------- # build options # @@ -265,7 +263,7 @@ flash : @echo Reset the board MANUALLY! run : $(TARGET_BIN) - $(QUTEST) $(TESTS) $(TARGET_EXE) $(HOST) + $(QUTEST) -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ diff --git a/examples/qutest/unity_mock/test_unity/Makefile b/examples/qutest/unity_mock/test_unity/Makefile index 98455617..52b058a1 100644 --- a/examples/qutest/unity_mock/test_unity/Makefile +++ b/examples/qutest/unity_mock/test_unity/Makefile @@ -1,6 +1,6 @@ ############################################################################## # Makefile for the Unity test harness v2.5.2, for Windows, Linux, MacOS -# Last updated for version 7.1.3 +# Last updated for version 7.2.0 # Last updated on 2022-11-13 # # Q u a n t u m L e a P s diff --git a/examples/qutest/unity_strlen/qutest/Makefile b/examples/qutest/unity_strlen/qutest/Makefile index 4b16b465..32f1befe 100644 --- a/examples/qutest/unity_strlen/qutest/Makefile +++ b/examples/qutest/unity_strlen/qutest/Makefile @@ -1,7 +1,7 @@ ############################################################################## # Product: Makefile for QUTEST-QP/C for Windows and POSIX *HOSTS* -# Last updated for version 7.1.3 -# Last updated on 2022-11-13 +# Last Updated for Version: 7.2.0 +# Date of the Last Update: 2022-12-21 # # Q u a n t u m L e a P s # ------------------------ @@ -154,8 +154,6 @@ ifeq ("$(wildcard $(QUTEST))","") QUTEST := python3 $(QTOOLS)/qutest/qutest.py endif -TESTS := *.py - #----------------------------------------------------------------------------- # basic utilities (depends on the OS this Makefile runs on): # @@ -223,7 +221,7 @@ $(TARGET_EXE) : $(C_OBJS_EXT) $(CPP_OBJS_EXT) $(LINK) $(LINKFLAGS) $(LIB_DIRS) -o $@ $^ $(BIN_DIR)/qstamp.o $(LIBS) run : $(TARGET_EXE) - $(QUTEST) $(TESTS) $(TARGET_EXE) $(HOST) + $(QUTEST) -e$(TARGET_EXE) -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) $(BIN_DIR)/%.d : %.cpp $(CPP) -MM -MT $(@:.d=.o) $(CPPFLAGS) $< > $@ @@ -250,7 +248,7 @@ endif endif debug : - $(QUTEST) $(TESTS) DEBUG $(HOST) + $(QUTEST) -edebug -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) clean : -$(RM) $(BIN_DIR)/*.* diff --git a/examples/qutest/unity_strlen/qutest/make_efm32 b/examples/qutest/unity_strlen/qutest/make_efm32 index 8bc8c805..c8abc0c0 100644 --- a/examples/qutest/unity_strlen/qutest/make_efm32 +++ b/examples/qutest/unity_strlen/qutest/make_efm32 @@ -1,7 +1,7 @@ ############################################################################## # Product: Makefile for QP/C on EMF32, QUTEST, GNU-ARM -# Last Updated for Version: 7.1.0 -# Date of the Last Update: 2022-08-20 +# Last Updated for Version: 7.2.0 +# Date of the Last Update: 2022-12-21 # # Q u a n t u m L e a P s # ------------------------ @@ -192,8 +192,6 @@ ifeq ("$(wildcard $(QUTEST))","") QUTEST := python3 $(QTOOLS)/qutest/qutest.py endif -TESTS := *.py - #----------------------------------------------------------------------------- # build options # @@ -261,7 +259,7 @@ flash : $(FLASH) $(TARGET_BIN) run : $(TARGET_BIN) - $(QUTEST) $(TESTS) $(TARGET_EXE) $(HOST) + $(QUTEST) -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ diff --git a/examples/qutest/unity_strlen/qutest/make_nucleo-l053r8 b/examples/qutest/unity_strlen/qutest/make_nucleo-l053r8 index 79059e7a..c8d204a6 100644 --- a/examples/qutest/unity_strlen/qutest/make_nucleo-l053r8 +++ b/examples/qutest/unity_strlen/qutest/make_nucleo-l053r8 @@ -1,7 +1,7 @@ ############################################################################## # Product: Makefile for QP/C on NUCLEO-L053R8 board, QUTEST, GNU-ARM -# Last Updated for Version: 7.1.0 -# Date of the Last Update: 2022-08-20 +# Last Updated for Version: 7.2.0 +# Date of the Last Update: 2022-12-21 # # Q u a n t u m L e a P s # ------------------------ @@ -166,11 +166,11 @@ LINK := $(GNU_ARM)/bin/arm-none-eabi-gcc BIN := $(GNU_ARM)/bin/arm-none-eabi-objcopy #----------------------------------------------------------------------------- -# NOTE: The following symbol USB assumes that the NUCLEO board +# NOTE: The symbol USB must be provided for the NUCLEO board # has enumerated as USB drive f: # ifeq ($(USB),) -USB := f: +$(error USB drive not provided for the NUCLEO board.) endif ############################################################################## @@ -191,8 +191,6 @@ ifeq ("$(wildcard $(QUTEST))","") QUTEST := python3 $(QTOOLS)/qutest/qutest.py endif -TESTS := *.py - #----------------------------------------------------------------------------- # build options # @@ -261,7 +259,7 @@ flash : $(CP) $(TARGET_BIN) $(USB) run : $(TARGET_BIN) - $(QUTEST) $(TESTS) $(TARGET_EXE) $(HOST) + $(QUTEST) -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ diff --git a/examples/qutest/unity_strlen/qutest/make_tm4c123 b/examples/qutest/unity_strlen/qutest/make_tm4c123 index 95ac3856..e0311e41 100644 --- a/examples/qutest/unity_strlen/qutest/make_tm4c123 +++ b/examples/qutest/unity_strlen/qutest/make_tm4c123 @@ -1,7 +1,7 @@ ############################################################################## # Product: Makefile for QP/C on TM4C123, QUTEST, GNU-ARM -# Last Updated for Version: 7.1.0 -# Date of the Last Update: 2022-08-20 +# Last Updated for Version: 7.2.0 +# Date of the Last Update: 2022-12-21 # # Q u a n t u m L e a P s # ------------------------ @@ -190,8 +190,6 @@ ifeq ("$(wildcard $(QUTEST))","") QUTEST := python3 $(QTOOLS)/qutest/qutest.py endif -TESTS := *.py - #----------------------------------------------------------------------------- # build options # @@ -264,7 +262,7 @@ flash : @echo Reset the board MANUALLY! run : $(TARGET_BIN) - $(QUTEST) $(TESTS) $(TARGET_EXE) $(HOST) + $(QUTEST) -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ diff --git a/examples/qutest/unity_strlen/test/Makefile b/examples/qutest/unity_strlen/test/Makefile index 230bfd76..d516e2ba 100644 --- a/examples/qutest/unity_strlen/test/Makefile +++ b/examples/qutest/unity_strlen/test/Makefile @@ -1,6 +1,6 @@ ############################################################################## # Makefile for the Unity test harness v2.5.2, for Windows, Linux, MacOS -# Last updated for version 7.1.3 +# Last updated for version 7.2.0 # Last updated on 2022-11-13 # # Q u a n t u m L e a P s diff --git a/examples/threadx/arm-cm/dpp_ek-tm4c123gxl/bsp.c b/examples/threadx/arm-cm/dpp_ek-tm4c123gxl/bsp.c index 3140b359..fde77268 100644 --- a/examples/threadx/arm-cm/dpp_ek-tm4c123gxl/bsp.c +++ b/examples/threadx/arm-cm/dpp_ek-tm4c123gxl/bsp.c @@ -1,7 +1,7 @@ /***************************************************************************** * Product: DPP example, EK-TM4C123GXL board, ThreadX kernel -* Last updated for version 7.1.3 -* Last updated on 2022-10-18 +* Last updated for version 7.2.0 +* Last updated on 2022-12-17 * * Q u a n t u m L e a P s * ------------------------ @@ -97,32 +97,154 @@ void UART0_IRQHandler(void) { void UART0_IRQHandler(void) {} #endif +/* MPU setup for TM4C123GXL MCU */ +static void TM4C123GXL_MPU_setup(void) { + /* The following MPU configuration contains the general TM4C memory map. + * + * Please note that the actual TM4C MCUs provide much less Flash and SRAM + * than the maximums configured here. This means that actual MCUs have + * unmapped memory regions (e.g., beyond the actual SRAM). Attempts to + * access these regions causes the HardFault exception, which is the + * desired behavior. + */ + static struct { + uint32_t rbar; + uint32_t rasr; + } const mpu_setup[] = { + { /* region #0: Flash: base=0x0000'0000, size=512M=2^(28+1) */ + 0x00000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 0U), /* region #0 */ + (28U << MPU_RASR_SIZE_Pos) /* 2^(18+1) region */ + | (0x6U << MPU_RASR_AP_Pos) /* PA:ro/UA:ro */ + | (1U << MPU_RASR_C_Pos) /* C=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #1: SRAM: base=0x2000'0000, size=512M=2^(28+1) */ + 0x20000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 1U), /* region #1 */ + (28U << MPU_RASR_SIZE_Pos) /* 2^(28+1) region */ + | (0x3U << MPU_RASR_AP_Pos) /* PA:rw/UA:rw */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | (1U << MPU_RASR_S_Pos) /* S=1 */ + | (1U << MPU_RASR_C_Pos) /* C=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + /* region #3: (not configured) */ + { MPU_RBAR_VALID_Msk | (MPU_RBAR_REGION_Msk & 2U), 0U }, + + { /* region #3: Peripherals: base=0x4000'0000, size=512M=2^(28+1) */ + 0x40000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 3U), /* region #3 */ + (28U << MPU_RASR_SIZE_Pos) /* 2^(28+1) region */ + | (0x3U << MPU_RASR_AP_Pos) /* PA:rw/UA:rw */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | (1U << MPU_RASR_S_Pos) /* S=1 */ + | (1U << MPU_RASR_B_Pos) /* B=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #4: Priv. Periph: base=0xE000'0000, size=512M=2^(28+1) */ + 0xE0000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 4U), /* region #4 */ + (28U << MPU_RASR_SIZE_Pos) /* 2^(28+1) region */ + | (0x3U << MPU_RASR_AP_Pos) /* PA:rw/UA:rw */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | (1U << MPU_RASR_S_Pos) /* S=1 */ + | (1U << MPU_RASR_B_Pos) /* B=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #5: Ext RAM: base=0x6000'0000, size=1G=2^(29+1) */ + 0x60000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 5U), /* region #5 */ + (29U << MPU_RASR_SIZE_Pos) /* 2^(28+1) region */ + | (0x3U << MPU_RASR_AP_Pos) /* PA:rw/UA:rw */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | (1U << MPU_RASR_S_Pos) /* S=1 */ + | (1U << MPU_RASR_B_Pos) /* B=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #6: Ext Dev: base=0xA000'0000, size=1G=2^(29+1) */ + 0xA0000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 6U), /* region #6 */ + (29U << MPU_RASR_SIZE_Pos) /* 2^(28+1) region */ + | (0x3U << MPU_RASR_AP_Pos) /* PA:rw/UA:rw */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | (1U << MPU_RASR_S_Pos) /* S=1 */ + | (1U << MPU_RASR_B_Pos) /* B=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #7: NULL-pointer: base=0x000'0000, size=512B */ + 0x00000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 7U), /* region #7 */ + (8U << MPU_RASR_SIZE_Pos) /* 2^(8+1)=512B region */ + | (0x0U << MPU_RASR_AP_Pos) /* PA:na/UA:na */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + }; + + /* enable the MemManage_Handler for MPU exception */ + SCB->SHCSR |= SCB_SHCSR_MEMFAULTENA_Msk; + + __DSB(); + MPU->CTRL = 0U; /* disable the MPU */ + for (uint_fast8_t n = 0U; n < Q_DIM(mpu_setup); ++n) { + MPU->RBAR = mpu_setup[n].rbar; + MPU->RASR = mpu_setup[n].rasr; + } + MPU->CTRL = MPU_CTRL_ENABLE_Msk; /* enable the MPU */ + __ISB(); + __DSB(); +} + /*..........................................................................*/ void BSP_init(void) { + /* setup the MPU... */ + TM4C123GXL_MPU_setup(); + /* NOTE: SystemInit() already called from the startup code * but SystemCoreClock needs to be updated */ SystemCoreClockUpdate(); - /* Explictily Disable the automatic FPU state preservation as well as - * the FPU lazy stacking - */ - FPU->FPCCR &= ~((1U << FPU_FPCCR_ASPEN_Pos) | (1U << FPU_FPCCR_LSPEN_Pos)); + /* NOTE The VFP (Floating Point Unit) unit is configured by the RTOS */ /* enable clock for to the peripherals used by this application... */ - SYSCTL->RCGCGPIO |= (1U << 5); /* enable Run mode for GPIOF */ + SYSCTL->RCGCGPIO |= (1U << 5); /* enable Run mode for GPIOF */ + SYSCTL->GPIOHBCTL |= (1U << 5); /* enable AHB for GPIOF */ + __ISB(); + __DSB(); - /* configure the LEDs and push buttons */ - GPIOF->DIR |= (LED_RED | LED_GREEN | LED_BLUE); /* set as output */ - GPIOF->DEN |= (LED_RED | LED_GREEN | LED_BLUE); /* digital enable */ - GPIOF->DATA_Bits[LED_RED] = 0U; /* turn the LED off */ - GPIOF->DATA_Bits[LED_GREEN] = 0U; /* turn the LED off */ - GPIOF->DATA_Bits[LED_BLUE] = 0U; /* turn the LED off */ + /* configure LEDs (digital output) */ + GPIOF_AHB->DIR |= (LED_RED | LED_BLUE | LED_GREEN); + GPIOF_AHB->DEN |= (LED_RED | LED_BLUE | LED_GREEN); + GPIOF_AHB->DATA_Bits[LED_RED | LED_BLUE | LED_GREEN] = 0U; - /* configure the User Switches */ - GPIOF->DIR &= ~(BTN_SW1 | BTN_SW2); /* set direction: input */ - ROM_GPIOPadConfigSet(GPIOF_BASE, (BTN_SW1 | BTN_SW2), - GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU); + /* configure switches... */ + + /* unlock access to the SW2 pin because it is PROTECTED */ + GPIOF_AHB->LOCK = 0x4C4F434BU; /* unlock GPIOCR register for SW2 */ + /* commit the write (cast const away) */ + *(uint32_t volatile *)&GPIOF_AHB->CR = 0x01U; + + GPIOF_AHB->DIR &= ~(BTN_SW1 | BTN_SW2); /* input */ + GPIOF_AHB->DEN |= (BTN_SW1 | BTN_SW2); /* digital enable */ + GPIOF_AHB->PUR |= (BTN_SW1 | BTN_SW2); /* pull-up resistor enable */ + + *(uint32_t volatile *)&GPIOF_AHB->CR = 0x00U; + GPIOF_AHB->LOCK = 0x0; /* lock GPIOCR register for SW2 */ /* seed the random number generator */ BSP_randomSeed(1234U); @@ -142,7 +264,7 @@ void BSP_init(void) { } /*..........................................................................*/ void BSP_displayPhilStat(uint8_t n, char const *stat) { - GPIOF->DATA_Bits[LED_GREEN] = ((stat[0] == 'e') ? LED_GREEN : 0U); + GPIOF_AHB->DATA_Bits[LED_GREEN] = ((stat[0] == 'e') ? LED_GREEN : 0U); QS_BEGIN_ID(PHILO_STAT, AO_Philo[n]->prio) /* app-specific record */ QS_U8(1, n); /* Philosopher number */ @@ -151,7 +273,7 @@ void BSP_displayPhilStat(uint8_t n, char const *stat) { } /*..........................................................................*/ void BSP_displayPaused(uint8_t paused) { - GPIOF->DATA_Bits[LED_BLUE] = ((paused != 0U) ? LED_BLUE : 0U); + GPIOF_AHB->DATA_Bits[LED_BLUE] = ((paused != 0U) ? LED_BLUE : 0U); QS_BEGIN_ID(PAUSED_STAT, 0U) /* app-specific record */ QS_U8(1, paused); /* Paused status */ @@ -245,7 +367,7 @@ Q_NORETURN Q_onAssert(char const * const module, int_t const loc) { #ifndef NDEBUG /* light up all LEDs */ - GPIOF->DATA_Bits[LED_GREEN | LED_RED | LED_BLUE] = 0xFFU; + GPIOF_AHB->DATA_Bits[LED_GREEN | LED_RED | LED_BLUE] = 0xFFU; /* for debugging, hang on in an endless loop... */ for (;;) { } diff --git a/examples/threadx/arm-cm/dpp_ek-tm4c123gxl/dpp.h b/examples/threadx/arm-cm/dpp_ek-tm4c123gxl/dpp.h index 08294733..c45cc7c6 100644 --- a/examples/threadx/arm-cm/dpp_ek-tm4c123gxl/dpp.h +++ b/examples/threadx/arm-cm/dpp_ek-tm4c123gxl/dpp.h @@ -3,7 +3,7 @@ * Model: dpp.qm * File: ${.::dpp.h} * -* This code has been generated by QM 5.2.2 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later diff --git a/examples/threadx/arm-cm/dpp_ek-tm4c123gxl/dpp.qm b/examples/threadx/arm-cm/dpp_ek-tm4c123gxl/dpp.qm index c7d2d40f..79ff1da8 100644 --- a/examples/threadx/arm-cm/dpp_ek-tm4c123gxl/dpp.qm +++ b/examples/threadx/arm-cm/dpp_ek-tm4c123gxl/dpp.qm @@ -1,5 +1,5 @@ - + Dining Philosopher Problem example diff --git a/examples/threadx/arm-cm/dpp_ek-tm4c123gxl/philo.c b/examples/threadx/arm-cm/dpp_ek-tm4c123gxl/philo.c index ef62b226..919e39d6 100644 --- a/examples/threadx/arm-cm/dpp_ek-tm4c123gxl/philo.c +++ b/examples/threadx/arm-cm/dpp_ek-tm4c123gxl/philo.c @@ -3,7 +3,7 @@ * Model: dpp.qm * File: ${.::philo.c} * -* This code has been generated by QM 5.2.2 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later @@ -67,8 +67,8 @@ static Philo l_philo[N_PHILO]; /* storage for all Philos */ /* Global objects ----------------------------------------------------------*/ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/examples/threadx/arm-cm/dpp_ek-tm4c123gxl/table.c b/examples/threadx/arm-cm/dpp_ek-tm4c123gxl/table.c index 0dd847c2..d655896e 100644 --- a/examples/threadx/arm-cm/dpp_ek-tm4c123gxl/table.c +++ b/examples/threadx/arm-cm/dpp_ek-tm4c123gxl/table.c @@ -3,7 +3,7 @@ * Model: dpp.qm * File: ${.::table.c} * -* This code has been generated by QM 5.2.2 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later @@ -65,8 +65,8 @@ static Table l_table; /* the single instance of the Table active object */ /* Global-scope objects ----------------------------------------------------*/ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/examples/threadx/arm-cm/dpp_stm32f429-discovery/bsp.c b/examples/threadx/arm-cm/dpp_stm32f429-discovery/bsp.c index e64e1663..15a218e2 100644 --- a/examples/threadx/arm-cm/dpp_stm32f429-discovery/bsp.c +++ b/examples/threadx/arm-cm/dpp_stm32f429-discovery/bsp.c @@ -94,10 +94,7 @@ void BSP_init(void) { */ SystemCoreClockUpdate(); - /* Explictily Disable the automatic FPU state preservation as well as - * the FPU lazy stacking - */ - FPU->FPCCR &= ~((1U << FPU_FPCCR_ASPEN_Pos) | (1U << FPU_FPCCR_LSPEN_Pos)); + /* NOTE The VFP (Floating Point Unit) unit is configured by the RTOS */ /* Initialize thr port for the LEDs */ RCC_AHB1PeriphClockCmd(LED_GPIO_CLK , ENABLE); diff --git a/examples/threadx/arm-cm/dpp_stm32f429-discovery/dpp.h b/examples/threadx/arm-cm/dpp_stm32f429-discovery/dpp.h index 08294733..c45cc7c6 100644 --- a/examples/threadx/arm-cm/dpp_stm32f429-discovery/dpp.h +++ b/examples/threadx/arm-cm/dpp_stm32f429-discovery/dpp.h @@ -3,7 +3,7 @@ * Model: dpp.qm * File: ${.::dpp.h} * -* This code has been generated by QM 5.2.2 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later diff --git a/examples/threadx/arm-cm/dpp_stm32f429-discovery/dpp.qm b/examples/threadx/arm-cm/dpp_stm32f429-discovery/dpp.qm index c7d2d40f..79ff1da8 100644 --- a/examples/threadx/arm-cm/dpp_stm32f429-discovery/dpp.qm +++ b/examples/threadx/arm-cm/dpp_stm32f429-discovery/dpp.qm @@ -1,5 +1,5 @@ - + Dining Philosopher Problem example diff --git a/examples/threadx/arm-cm/dpp_stm32f429-discovery/philo.c b/examples/threadx/arm-cm/dpp_stm32f429-discovery/philo.c index ef62b226..919e39d6 100644 --- a/examples/threadx/arm-cm/dpp_stm32f429-discovery/philo.c +++ b/examples/threadx/arm-cm/dpp_stm32f429-discovery/philo.c @@ -3,7 +3,7 @@ * Model: dpp.qm * File: ${.::philo.c} * -* This code has been generated by QM 5.2.2 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later @@ -67,8 +67,8 @@ static Philo l_philo[N_PHILO]; /* storage for all Philos */ /* Global objects ----------------------------------------------------------*/ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/examples/threadx/arm-cm/dpp_stm32f429-discovery/table.c b/examples/threadx/arm-cm/dpp_stm32f429-discovery/table.c index 0dd847c2..d655896e 100644 --- a/examples/threadx/arm-cm/dpp_stm32f429-discovery/table.c +++ b/examples/threadx/arm-cm/dpp_stm32f429-discovery/table.c @@ -3,7 +3,7 @@ * Model: dpp.qm * File: ${.::table.c} * -* This code has been generated by QM 5.2.2 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later @@ -65,8 +65,8 @@ static Table l_table; /* the single instance of the Table active object */ /* Global-scope objects ----------------------------------------------------*/ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/examples/threadx/win32/dpp_console/dpp.h b/examples/threadx/win32/dpp_console/dpp.h index 08294733..c45cc7c6 100644 --- a/examples/threadx/win32/dpp_console/dpp.h +++ b/examples/threadx/win32/dpp_console/dpp.h @@ -3,7 +3,7 @@ * Model: dpp.qm * File: ${.::dpp.h} * -* This code has been generated by QM 5.2.2 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later diff --git a/examples/threadx/win32/dpp_console/dpp.qm b/examples/threadx/win32/dpp_console/dpp.qm index c7d2d40f..79ff1da8 100644 --- a/examples/threadx/win32/dpp_console/dpp.qm +++ b/examples/threadx/win32/dpp_console/dpp.qm @@ -1,5 +1,5 @@ - + Dining Philosopher Problem example diff --git a/examples/threadx/win32/dpp_console/philo.c b/examples/threadx/win32/dpp_console/philo.c index ef62b226..919e39d6 100644 --- a/examples/threadx/win32/dpp_console/philo.c +++ b/examples/threadx/win32/dpp_console/philo.c @@ -3,7 +3,7 @@ * Model: dpp.qm * File: ${.::philo.c} * -* This code has been generated by QM 5.2.2 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later @@ -67,8 +67,8 @@ static Philo l_philo[N_PHILO]; /* storage for all Philos */ /* Global objects ----------------------------------------------------------*/ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/examples/threadx/win32/dpp_console/table.c b/examples/threadx/win32/dpp_console/table.c index 0dd847c2..d655896e 100644 --- a/examples/threadx/win32/dpp_console/table.c +++ b/examples/threadx/win32/dpp_console/table.c @@ -3,7 +3,7 @@ * Model: dpp.qm * File: ${.::table.c} * -* This code has been generated by QM 5.2.2 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later @@ -65,8 +65,8 @@ static Table l_table; /* the single instance of the Table active object */ /* Global-scope objects ----------------------------------------------------*/ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/examples/uc-os2/arm-cm/dpp_ek-tm4c123gxl/bsp.c b/examples/uc-os2/arm-cm/dpp_ek-tm4c123gxl/bsp.c index acaf8aaa..ba3fdff0 100644 --- a/examples/uc-os2/arm-cm/dpp_ek-tm4c123gxl/bsp.c +++ b/examples/uc-os2/arm-cm/dpp_ek-tm4c123gxl/bsp.c @@ -1,7 +1,7 @@ /***************************************************************************** * Product: DPP example, EK-TM4C123GLX board, uC/OS-II RTOS -* Last updated for version 7.1.3 -* Last updated on 2022-10-18 +* Last updated for version 7.2.0 +* Last updated on 2022-12-17 * * Q u a n t u m L e a P s * ------------------------ @@ -104,8 +104,8 @@ void App_TaskIdleHook(void) { /* toggle LED2 on and then off, see NOTE01 */ OS_ENTER_CRITICAL(); - GPIOF->DATA_Bits[LED_BLUE] = 0xFFU; /* turn the LED on */ - GPIOF->DATA_Bits[LED_BLUE] = 0x00U; /* turn the LED off */ + GPIOF_AHB->DATA_Bits[LED_BLUE] = 0xFFU; /* turn the LED on */ + GPIOF_AHB->DATA_Bits[LED_BLUE] = 0x00U; /* turn the LED off */ OS_EXIT_CRITICAL(); #ifdef Q_SPY @@ -149,7 +149,7 @@ void App_TimeTickHook(void) { uint32_t previous; } buttons = { 0U, 0U }; - uint32_t current = ~GPIOF->DATA_Bits[BTN_SW1 | BTN_SW2]; /* read SW1&SW2 */ + uint32_t current = ~GPIOF_AHB->DATA_Bits[BTN_SW1 | BTN_SW2]; /* read SW1&SW2 */ uint32_t tmp = buttons.depressed; /* save debounced depressed buttons */ buttons.depressed |= (buttons.previous & current); /* set depressed */ buttons.depressed &= (buttons.previous | current); /* clear released */ @@ -168,26 +168,152 @@ void App_TimeTickHook(void) { } /* BSP functions ===========================================================*/ +/* MPU setup for TM4C123GXL MCU */ +static void TM4C123GXL_MPU_setup(void) { + /* The following MPU configuration contains the general TM4C memory map. + * + * Please note that the actual TM4C MCUs provide much less Flash and SRAM + * than the maximums configured here. This means that actual MCUs have + * unmapped memory regions (e.g., beyond the actual SRAM). Attempts to + * access these regions causes the HardFault exception, which is the + * desired behavior. + */ + static struct { + uint32_t rbar; + uint32_t rasr; + } const mpu_setup[] = { + { /* region #0: Flash: base=0x0000'0000, size=512M=2^(28+1) */ + 0x00000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 0U), /* region #0 */ + (28U << MPU_RASR_SIZE_Pos) /* 2^(18+1) region */ + | (0x6U << MPU_RASR_AP_Pos) /* PA:ro/UA:ro */ + | (1U << MPU_RASR_C_Pos) /* C=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #1: SRAM: base=0x2000'0000, size=512M=2^(28+1) */ + 0x20000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 1U), /* region #1 */ + (28U << MPU_RASR_SIZE_Pos) /* 2^(28+1) region */ + | (0x3U << MPU_RASR_AP_Pos) /* PA:rw/UA:rw */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | (1U << MPU_RASR_S_Pos) /* S=1 */ + | (1U << MPU_RASR_C_Pos) /* C=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + /* region #3: (not configured) */ + { MPU_RBAR_VALID_Msk | (MPU_RBAR_REGION_Msk & 2U), 0U }, + + { /* region #3: Peripherals: base=0x4000'0000, size=512M=2^(28+1) */ + 0x40000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 3U), /* region #3 */ + (28U << MPU_RASR_SIZE_Pos) /* 2^(28+1) region */ + | (0x3U << MPU_RASR_AP_Pos) /* PA:rw/UA:rw */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | (1U << MPU_RASR_S_Pos) /* S=1 */ + | (1U << MPU_RASR_B_Pos) /* B=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #4: Priv. Periph: base=0xE000'0000, size=512M=2^(28+1) */ + 0xE0000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 4U), /* region #4 */ + (28U << MPU_RASR_SIZE_Pos) /* 2^(28+1) region */ + | (0x3U << MPU_RASR_AP_Pos) /* PA:rw/UA:rw */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | (1U << MPU_RASR_S_Pos) /* S=1 */ + | (1U << MPU_RASR_B_Pos) /* B=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #5: Ext RAM: base=0x6000'0000, size=1G=2^(29+1) */ + 0x60000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 5U), /* region #5 */ + (29U << MPU_RASR_SIZE_Pos) /* 2^(28+1) region */ + | (0x3U << MPU_RASR_AP_Pos) /* PA:rw/UA:rw */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | (1U << MPU_RASR_S_Pos) /* S=1 */ + | (1U << MPU_RASR_B_Pos) /* B=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #6: Ext Dev: base=0xA000'0000, size=1G=2^(29+1) */ + 0xA0000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 6U), /* region #6 */ + (29U << MPU_RASR_SIZE_Pos) /* 2^(28+1) region */ + | (0x3U << MPU_RASR_AP_Pos) /* PA:rw/UA:rw */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | (1U << MPU_RASR_S_Pos) /* S=1 */ + | (1U << MPU_RASR_B_Pos) /* B=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #7: NULL-pointer: base=0x000'0000, size=512B */ + 0x00000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 7U), /* region #7 */ + (8U << MPU_RASR_SIZE_Pos) /* 2^(8+1)=512B region */ + | (0x0U << MPU_RASR_AP_Pos) /* PA:na/UA:na */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + }; + + /* enable the MemManage_Handler for MPU exception */ + SCB->SHCSR |= SCB_SHCSR_MEMFAULTENA_Msk; + + __DSB(); + MPU->CTRL = 0U; /* disable the MPU */ + for (uint_fast8_t n = 0U; n < Q_DIM(mpu_setup); ++n) { + MPU->RBAR = mpu_setup[n].rbar; + MPU->RASR = mpu_setup[n].rasr; + } + MPU->CTRL = MPU_CTRL_ENABLE_Msk; /* enable the MPU */ + __ISB(); + __DSB(); +} + +/*..........................................................................*/ void BSP_init(void) { + /* setup the MPU... */ + TM4C123GXL_MPU_setup(); + /* NOTE: SystemInit() already called from the startup code * but SystemCoreClock needs to be updated */ SystemCoreClockUpdate(); /* enable clock for to the peripherals used by this application... */ - SYSCTL->RCGCGPIO |= (1U << 5); /* enable Run mode for GPIOF */ + SYSCTL->RCGCGPIO |= (1U << 5); /* enable Run mode for GPIOF */ + SYSCTL->GPIOHBCTL |= (1U << 5); /* enable AHB for GPIOF */ + __ISB(); + __DSB(); - /* configure the LEDs and push buttons */ - GPIOF->DIR |= (LED_RED | LED_GREEN | LED_BLUE); /* set as output */ - GPIOF->DEN |= (LED_RED | LED_GREEN | LED_BLUE); /* digital enable */ - GPIOF->DATA_Bits[LED_RED] = 0U; /* turn the LED off */ - GPIOF->DATA_Bits[LED_GREEN] = 0U; /* turn the LED off */ - GPIOF->DATA_Bits[LED_BLUE] = 0U; /* turn the LED off */ + /* configure LEDs (digital output) */ + GPIOF_AHB->DIR |= (LED_RED | LED_BLUE | LED_GREEN); + GPIOF_AHB->DEN |= (LED_RED | LED_BLUE | LED_GREEN); + GPIOF_AHB->DATA_Bits[LED_RED | LED_BLUE | LED_GREEN] = 0U; - /* configure the User Switches */ - GPIOF->DIR &= ~(BTN_SW1 | BTN_SW2); /* set direction: input */ - ROM_GPIOPadConfigSet(GPIOF_BASE, (BTN_SW1 | BTN_SW2), - GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU); + /* configure switches... */ + + /* unlock access to the SW2 pin because it is PROTECTED */ + GPIOF_AHB->LOCK = 0x4C4F434BU; /* unlock GPIOCR register for SW2 */ + /* commit the write (cast const away) */ + *(uint32_t volatile *)&GPIOF_AHB->CR = 0x01U; + + GPIOF_AHB->DIR &= ~(BTN_SW1 | BTN_SW2); /* input */ + GPIOF_AHB->DEN |= (BTN_SW1 | BTN_SW2); /* digital enable */ + GPIOF_AHB->PUR |= (BTN_SW1 | BTN_SW2); /* pull-up resistor enable */ + + *(uint32_t volatile *)&GPIOF_AHB->CR = 0x00U; + GPIOF_AHB->LOCK = 0x0; /* lock GPIOCR register for SW2 */ /* seed the random number generator */ BSP_randomSeed(1234U); @@ -215,7 +341,7 @@ void BSP_displayPhilStat(uint8_t n, char const *stat) { float volatile x = 3.1415926F; x = x + 2.7182818F; - GPIOF->DATA_Bits[LED_GREEN] = ((stat[0] == 'e') ? LED_GREEN : 0U); + GPIOF_AHB->DATA_Bits[LED_GREEN] = ((stat[0] == 'e') ? LED_GREEN : 0U); QS_BEGIN_ID(PHILO_STAT, AO_Philo[n]->prio) /* app-specific record */ QS_U8(1, n); /* Philosopher number */ @@ -224,7 +350,7 @@ void BSP_displayPhilStat(uint8_t n, char const *stat) { } /*..........................................................................*/ void BSP_displayPaused(uint8_t paused) { - GPIOF->DATA_Bits[LED_BLUE] = ((paused != 0U) ? LED_BLUE : 0U); + GPIOF_AHB->DATA_Bits[LED_BLUE] = ((paused != 0U) ? LED_BLUE : 0U); QS_BEGIN_ID(PAUSED_STAT, 0U) /* app-specific record */ QS_U8(1, paused); /* Paused status */ @@ -277,7 +403,7 @@ Q_NORETURN Q_onAssert(char const * const module, int_t const loc) { #ifndef NDEBUG /* light up all LEDs */ - GPIOF->DATA_Bits[LED_GREEN | LED_RED | LED_BLUE] = 0xFFU; + GPIOF_AHB->DATA_Bits[LED_GREEN | LED_RED | LED_BLUE] = 0xFFU; /* for debugging, hang on in an endless loop... */ for (;;) { } diff --git a/examples/uc-os2/arm-cm/dpp_ek-tm4c123gxl/dpp.h b/examples/uc-os2/arm-cm/dpp_ek-tm4c123gxl/dpp.h index 83694d8f..da094c2c 100644 --- a/examples/uc-os2/arm-cm/dpp_ek-tm4c123gxl/dpp.h +++ b/examples/uc-os2/arm-cm/dpp_ek-tm4c123gxl/dpp.h @@ -3,7 +3,7 @@ * Model: dpp.qm * File: ${.::dpp.h} * -* This code has been generated by QM 5.2.2 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later diff --git a/examples/uc-os2/arm-cm/dpp_ek-tm4c123gxl/dpp.qm b/examples/uc-os2/arm-cm/dpp_ek-tm4c123gxl/dpp.qm index 22312a29..b78ede00 100644 --- a/examples/uc-os2/arm-cm/dpp_ek-tm4c123gxl/dpp.qm +++ b/examples/uc-os2/arm-cm/dpp_ek-tm4c123gxl/dpp.qm @@ -1,5 +1,5 @@ - + Dining Philosopher Problem example @@ -145,18 +145,12 @@ Q_ASSERT(Q_EVT_CAST(TableEvt)->philoNum != PHILO_ID(me));
- + - uint8_t n; -(void)par; /* unused parameter */ + (void)par; /* unused parameter */ QS_OBJ_DICTIONARY(&l_table); -QS_FUN_DICTIONARY(&QHsm_top); -QS_FUN_DICTIONARY(&Table_initial); -QS_FUN_DICTIONARY(&Table_active); -QS_FUN_DICTIONARY(&Table_serving); -QS_FUN_DICTIONARY(&Table_paused); QS_SIG_DICTIONARY(DONE_SIG, (void *)0); /* global signals */ QS_SIG_DICTIONARY(EAT_SIG, (void *)0); @@ -171,7 +165,7 @@ QActive_subscribe(&me->super, PAUSE_SIG); QActive_subscribe(&me->super, SERVE_SIG); QActive_subscribe(&me->super, TEST_SIG); -for (n = 0U; n < N_PHILO; ++n) { +for (uint8_t n = 0U; n < N_PHILO; ++n) { me->fork[n] = FREE; me->isHungry[n] = 0U; BSP_displayPhilStat(n, "thinking"); diff --git a/examples/uc-os2/arm-cm/dpp_ek-tm4c123gxl/philo.c b/examples/uc-os2/arm-cm/dpp_ek-tm4c123gxl/philo.c index 05aef16c..7614912a 100644 --- a/examples/uc-os2/arm-cm/dpp_ek-tm4c123gxl/philo.c +++ b/examples/uc-os2/arm-cm/dpp_ek-tm4c123gxl/philo.c @@ -3,7 +3,7 @@ * Model: dpp.qm * File: ${.::philo.c} * -* This code has been generated by QM 5.2.2 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later @@ -76,8 +76,8 @@ QActive * const AO_Philo[N_PHILO] = { /* "opaque" pointers to Philo AO */ /* Philo definition --------------------------------------------------------*/ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/examples/uc-os2/arm-cm/dpp_ek-tm4c123gxl/table.c b/examples/uc-os2/arm-cm/dpp_ek-tm4c123gxl/table.c index a77305c8..d14c29d4 100644 --- a/examples/uc-os2/arm-cm/dpp_ek-tm4c123gxl/table.c +++ b/examples/uc-os2/arm-cm/dpp_ek-tm4c123gxl/table.c @@ -3,7 +3,7 @@ * Model: dpp.qm * File: ${.::table.c} * -* This code has been generated by QM 5.2.2 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later @@ -68,8 +68,8 @@ QActive * const AO_Table = &l_table.super; /* "opaque" AO pointer */ /*..........................................................................*/ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ @@ -95,15 +95,9 @@ void Table_ctor(void) { /*${AOs::Table::SM} ........................................................*/ static QState Table_initial(Table * const me, void const * const par) { /*${AOs::Table::SM::initial} */ - uint8_t n; (void)par; /* unused parameter */ QS_OBJ_DICTIONARY(&l_table); - QS_FUN_DICTIONARY(&QHsm_top); - QS_FUN_DICTIONARY(&Table_initial); - QS_FUN_DICTIONARY(&Table_active); - QS_FUN_DICTIONARY(&Table_serving); - QS_FUN_DICTIONARY(&Table_paused); QS_SIG_DICTIONARY(DONE_SIG, (void *)0); /* global signals */ QS_SIG_DICTIONARY(EAT_SIG, (void *)0); @@ -118,11 +112,16 @@ static QState Table_initial(Table * const me, void const * const par) { QActive_subscribe(&me->super, SERVE_SIG); QActive_subscribe(&me->super, TEST_SIG); - for (n = 0U; n < N_PHILO; ++n) { + for (uint8_t n = 0U; n < N_PHILO; ++n) { me->fork[n] = FREE; me->isHungry[n] = 0U; BSP_displayPhilStat(n, "thinking"); } + + QS_FUN_DICTIONARY(&Table_active); + QS_FUN_DICTIONARY(&Table_serving); + QS_FUN_DICTIONARY(&Table_paused); + return Q_TRAN(&Table_serving); } diff --git a/examples/uc-os2/arm-cm/dpp_nucleo-l053r8/bsp.c b/examples/uc-os2/arm-cm/dpp_nucleo-l053r8/bsp.c index 6048a94b..ca478923 100644 --- a/examples/uc-os2/arm-cm/dpp_nucleo-l053r8/bsp.c +++ b/examples/uc-os2/arm-cm/dpp_nucleo-l053r8/bsp.c @@ -59,7 +59,6 @@ static uint32_t l_rnd; /* random seed */ enum AppRecords { /* application-specific trace records */ PHILO_STAT = QS_USER, - ON_CONTEXT_SW }; #endif @@ -182,7 +181,6 @@ void BSP_init(void) { } QS_OBJ_DICTIONARY(&l_tickHook); QS_USR_DICTIONARY(PHILO_STAT); - QS_USR_DICTIONARY(ON_CONTEXT_SW); /* setup the QS filters... */ QS_GLB_FILTER(QS_SM_RECORDS); diff --git a/examples/uc-os2/arm-cm/dpp_nucleo-l053r8/dpp.h b/examples/uc-os2/arm-cm/dpp_nucleo-l053r8/dpp.h index 83694d8f..da094c2c 100644 --- a/examples/uc-os2/arm-cm/dpp_nucleo-l053r8/dpp.h +++ b/examples/uc-os2/arm-cm/dpp_nucleo-l053r8/dpp.h @@ -3,7 +3,7 @@ * Model: dpp.qm * File: ${.::dpp.h} * -* This code has been generated by QM 5.2.2 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later diff --git a/examples/uc-os2/arm-cm/dpp_nucleo-l053r8/dpp.qm b/examples/uc-os2/arm-cm/dpp_nucleo-l053r8/dpp.qm index 22312a29..93a66374 100644 --- a/examples/uc-os2/arm-cm/dpp_nucleo-l053r8/dpp.qm +++ b/examples/uc-os2/arm-cm/dpp_nucleo-l053r8/dpp.qm @@ -1,5 +1,5 @@ - + Dining Philosopher Problem example @@ -145,33 +145,26 @@ Q_ASSERT(Q_EVT_CAST(TableEvt)->philoNum != PHILO_ID(me)); - + - uint8_t n; -(void)par; /* unused parameter */ + (void)par; /* unused parameter */ QS_OBJ_DICTIONARY(&l_table); -QS_FUN_DICTIONARY(&QHsm_top); -QS_FUN_DICTIONARY(&Table_initial); -QS_FUN_DICTIONARY(&Table_active); -QS_FUN_DICTIONARY(&Table_serving); -QS_FUN_DICTIONARY(&Table_paused); -QS_SIG_DICTIONARY(DONE_SIG, (void *)0); /* global signals */ -QS_SIG_DICTIONARY(EAT_SIG, (void *)0); -QS_SIG_DICTIONARY(PAUSE_SIG, (void *)0); -QS_SIG_DICTIONARY(SERVE_SIG, (void *)0); -QS_SIG_DICTIONARY(TEST_SIG, (void *)0); - -QS_SIG_DICTIONARY(HUNGRY_SIG, me); /* signal just for Table */ +QS_SIG_DICTIONARY(DONE_SIG, (void *)0); /* global signals */ +QS_SIG_DICTIONARY(EAT_SIG, (void *)0); +QS_SIG_DICTIONARY(PAUSE_SIG, (void *)0); +QS_SIG_DICTIONARY(SERVE_SIG, (void *)0); +QS_SIG_DICTIONARY(TEST_SIG, (void *)0); +QS_SIG_DICTIONARY(HUNGRY_SIG, me); /* signal just for Table */ QActive_subscribe(&me->super, DONE_SIG); QActive_subscribe(&me->super, PAUSE_SIG); QActive_subscribe(&me->super, SERVE_SIG); QActive_subscribe(&me->super, TEST_SIG); -for (n = 0U; n < N_PHILO; ++n) { +for (uint8_t n = 0U; n < N_PHILO; ++n) { me->fork[n] = FREE; me->isHungry[n] = 0U; BSP_displayPhilStat(n, "thinking"); diff --git a/examples/uc-os2/arm-cm/dpp_nucleo-l053r8/philo.c b/examples/uc-os2/arm-cm/dpp_nucleo-l053r8/philo.c index 05aef16c..7614912a 100644 --- a/examples/uc-os2/arm-cm/dpp_nucleo-l053r8/philo.c +++ b/examples/uc-os2/arm-cm/dpp_nucleo-l053r8/philo.c @@ -3,7 +3,7 @@ * Model: dpp.qm * File: ${.::philo.c} * -* This code has been generated by QM 5.2.2 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later @@ -76,8 +76,8 @@ QActive * const AO_Philo[N_PHILO] = { /* "opaque" pointers to Philo AO */ /* Philo definition --------------------------------------------------------*/ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/examples/uc-os2/arm-cm/dpp_nucleo-l053r8/table.c b/examples/uc-os2/arm-cm/dpp_nucleo-l053r8/table.c index a77305c8..c8fb3c37 100644 --- a/examples/uc-os2/arm-cm/dpp_nucleo-l053r8/table.c +++ b/examples/uc-os2/arm-cm/dpp_nucleo-l053r8/table.c @@ -3,7 +3,7 @@ * Model: dpp.qm * File: ${.::table.c} * -* This code has been generated by QM 5.2.2 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later @@ -68,8 +68,8 @@ QActive * const AO_Table = &l_table.super; /* "opaque" AO pointer */ /*..........................................................................*/ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ @@ -95,34 +95,32 @@ void Table_ctor(void) { /*${AOs::Table::SM} ........................................................*/ static QState Table_initial(Table * const me, void const * const par) { /*${AOs::Table::SM::initial} */ - uint8_t n; (void)par; /* unused parameter */ QS_OBJ_DICTIONARY(&l_table); - QS_FUN_DICTIONARY(&QHsm_top); - QS_FUN_DICTIONARY(&Table_initial); - QS_FUN_DICTIONARY(&Table_active); - QS_FUN_DICTIONARY(&Table_serving); - QS_FUN_DICTIONARY(&Table_paused); - QS_SIG_DICTIONARY(DONE_SIG, (void *)0); /* global signals */ - QS_SIG_DICTIONARY(EAT_SIG, (void *)0); - QS_SIG_DICTIONARY(PAUSE_SIG, (void *)0); - QS_SIG_DICTIONARY(SERVE_SIG, (void *)0); - QS_SIG_DICTIONARY(TEST_SIG, (void *)0); - - QS_SIG_DICTIONARY(HUNGRY_SIG, me); /* signal just for Table */ + QS_SIG_DICTIONARY(DONE_SIG, (void *)0); /* global signals */ + QS_SIG_DICTIONARY(EAT_SIG, (void *)0); + QS_SIG_DICTIONARY(PAUSE_SIG, (void *)0); + QS_SIG_DICTIONARY(SERVE_SIG, (void *)0); + QS_SIG_DICTIONARY(TEST_SIG, (void *)0); + QS_SIG_DICTIONARY(HUNGRY_SIG, me); /* signal just for Table */ QActive_subscribe(&me->super, DONE_SIG); QActive_subscribe(&me->super, PAUSE_SIG); QActive_subscribe(&me->super, SERVE_SIG); QActive_subscribe(&me->super, TEST_SIG); - for (n = 0U; n < N_PHILO; ++n) { + for (uint8_t n = 0U; n < N_PHILO; ++n) { me->fork[n] = FREE; me->isHungry[n] = 0U; BSP_displayPhilStat(n, "thinking"); } + + QS_FUN_DICTIONARY(&Table_active); + QS_FUN_DICTIONARY(&Table_serving); + QS_FUN_DICTIONARY(&Table_paused); + return Q_TRAN(&Table_serving); } diff --git a/examples/workstation/blinky/Makefile b/examples/workstation/blinky/Makefile index 79f363c6..230ef9ea 100644 --- a/examples/workstation/blinky/Makefile +++ b/examples/workstation/blinky/Makefile @@ -1,6 +1,6 @@ ############################################################################## # Product: Makefile for QP/C for Windows and POSIX *HOSTS* -# Last updated for version 7.1.3 +# Last updated for version 7.2.0 # Last updated on 2022-11-13 # # Q u a n t u m L e a P s diff --git a/examples/workstation/blinky/blinky.c b/examples/workstation/blinky/blinky.c index f572fcb8..7b3f4362 100644 --- a/examples/workstation/blinky/blinky.c +++ b/examples/workstation/blinky/blinky.c @@ -3,7 +3,7 @@ * Model: blinky.qm * File: ${.::blinky.c} * -* This code has been generated by QM 5.2.1 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later @@ -109,8 +109,8 @@ int main() { /*================ ask QM to define the Blinky class ================*/ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/examples/workstation/blinky/blinky.qm b/examples/workstation/blinky/blinky.qm index 753cb76a..9d8cb4c9 100644 --- a/examples/workstation/blinky/blinky.qm +++ b/examples/workstation/blinky/blinky.qm @@ -1,5 +1,5 @@ - + Blinky example diff --git a/examples/workstation/calc/Makefile b/examples/workstation/calc/Makefile index 2a9f1bf7..04000496 100644 --- a/examples/workstation/calc/Makefile +++ b/examples/workstation/calc/Makefile @@ -1,6 +1,6 @@ ############################################################################## # Product: Makefile for QP/C for Windows and POSIX *HOSTS* -# Last updated for version 7.1.3 +# Last updated for version 7.2.0 # Last updated on 2022-11-13 # # Q u a n t u m L e a P s diff --git a/examples/workstation/calc/calc.c b/examples/workstation/calc/calc.c index c2c8f273..f043852d 100644 --- a/examples/workstation/calc/calc.c +++ b/examples/workstation/calc/calc.c @@ -3,7 +3,7 @@ * Model: calc.qm * File: ${.::calc.c} * -* This code has been generated by QM 5.2.1 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later @@ -72,8 +72,8 @@ QHsm * const the_calc = &l_calc.super; /* "opaque" pointer to MSM */ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/examples/workstation/calc/calc.h b/examples/workstation/calc/calc.h index 4bafdb36..015561dd 100644 --- a/examples/workstation/calc/calc.h +++ b/examples/workstation/calc/calc.h @@ -3,7 +3,7 @@ * Model: calc.qm * File: ${.::calc.h} * -* This code has been generated by QM 5.2.1 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later diff --git a/examples/workstation/calc/calc.qm b/examples/workstation/calc/calc.qm index 69de53b0..5f6ffbe2 100644 --- a/examples/workstation/calc/calc.qm +++ b/examples/workstation/calc/calc.qm @@ -1,5 +1,5 @@ - + Calc is the model of the Calculator described in Chapter 4 of PSiCC2 diff --git a/examples/workstation/calc1/Makefile b/examples/workstation/calc1/Makefile index 6feece48..56c553ef 100644 --- a/examples/workstation/calc1/Makefile +++ b/examples/workstation/calc1/Makefile @@ -1,6 +1,6 @@ ############################################################################## # Product: Makefile for QP/C for Windows and POSIX *HOSTS* -# Last updated for version 7.1.3 +# Last updated for version 7.2.0 # Last updated on 2022-11-13 # # Q u a n t u m L e a P s diff --git a/examples/workstation/calc1/calc1.c b/examples/workstation/calc1/calc1.c index 5be52aad..04012fec 100644 --- a/examples/workstation/calc1/calc1.c +++ b/examples/workstation/calc1/calc1.c @@ -3,7 +3,7 @@ * Model: calc1.qm * File: ${.::calc1.c} * -* This code has been generated by QM 5.2.1 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later @@ -94,8 +94,8 @@ static QState Calc_final(Calc * const me, QEvt const * const e); /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/examples/workstation/calc1/calc1.h b/examples/workstation/calc1/calc1.h index d4253e6f..1505072e 100644 --- a/examples/workstation/calc1/calc1.h +++ b/examples/workstation/calc1/calc1.h @@ -3,7 +3,7 @@ * Model: calc1.qm * File: ${.::calc1.h} * -* This code has been generated by QM 5.2.1 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later diff --git a/examples/workstation/calc1/calc1.qm b/examples/workstation/calc1/calc1.qm index 06d56673..e307fb9d 100644 --- a/examples/workstation/calc1/calc1.qm +++ b/examples/workstation/calc1/calc1.qm @@ -1,5 +1,5 @@ - + Improved model of the Calculator described in Chapter 4 of PSiCC2. Improvements include: - placing the "negated1" state inside "operand1" superstate - placing the "negated2" state inside "operand2" superstate diff --git a/examples/workstation/calc1_sub/Makefile b/examples/workstation/calc1_sub/Makefile index 7ecff7ee..f9744dad 100644 --- a/examples/workstation/calc1_sub/Makefile +++ b/examples/workstation/calc1_sub/Makefile @@ -1,6 +1,6 @@ ############################################################################## # Product: Makefile for QP/C for Windows and POSIX *HOSTS* -# Last updated for version 7.1.3 +# Last updated for version 7.2.0 # Last updated on 2022-11-13 # # Q u a n t u m L e a P s diff --git a/examples/workstation/calc1_sub/calc1_sub.c b/examples/workstation/calc1_sub/calc1_sub.c index ae252768..f4fd2a0c 100644 --- a/examples/workstation/calc1_sub/calc1_sub.c +++ b/examples/workstation/calc1_sub/calc1_sub.c @@ -3,7 +3,7 @@ * Model: calc1_sub.qm * File: ${.::calc1_sub.c} * -* This code has been generated by QM 5.2.3 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later @@ -237,8 +237,8 @@ static QMState const Calc_operand_negated_s = { /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/examples/workstation/calc1_sub/calc1_sub.h b/examples/workstation/calc1_sub/calc1_sub.h index 9af77eb8..549daf04 100644 --- a/examples/workstation/calc1_sub/calc1_sub.h +++ b/examples/workstation/calc1_sub/calc1_sub.h @@ -3,7 +3,7 @@ * Model: calc1_sub.qm * File: ${.::calc1_sub.h} * -* This code has been generated by QM 5.2.3 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later diff --git a/examples/workstation/calc1_sub/calc1_sub.qm b/examples/workstation/calc1_sub/calc1_sub.qm index 2ccb91ee..792235d8 100644 --- a/examples/workstation/calc1_sub/calc1_sub.qm +++ b/examples/workstation/calc1_sub/calc1_sub.qm @@ -1,5 +1,5 @@ - + The improved Calculator model with QMsm state machine implementation strategy and Sub-Machines. diff --git a/examples/workstation/calc2/Makefile b/examples/workstation/calc2/Makefile index 6314bdb5..da15efa8 100644 --- a/examples/workstation/calc2/Makefile +++ b/examples/workstation/calc2/Makefile @@ -1,6 +1,6 @@ ############################################################################## # Product: Makefile for QP/C for Windows and POSIX *HOSTS* -# Last updated for version 7.1.3 +# Last updated for version 7.2.0 # Last updated on 2022-11-13 # # Q u a n t u m L e a P s diff --git a/examples/workstation/calc2/calc2.c b/examples/workstation/calc2/calc2.c index be4d88a2..5a81d4ec 100644 --- a/examples/workstation/calc2/calc2.c +++ b/examples/workstation/calc2/calc2.c @@ -3,7 +3,7 @@ * Model: calc2.qm * File: ${.::calc2.c} * -* This code has been generated by QM 5.2.1 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later @@ -89,8 +89,8 @@ static QState Calc_final(Calc * const me, QEvt const * const e); /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/examples/workstation/calc2/calc2.h b/examples/workstation/calc2/calc2.h index d34555fc..8c0fa25e 100644 --- a/examples/workstation/calc2/calc2.h +++ b/examples/workstation/calc2/calc2.h @@ -3,7 +3,7 @@ * Model: calc2.qm * File: ${.::calc2.h} * -* This code has been generated by QM 5.2.1 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later diff --git a/examples/workstation/calc2/calc2.qm b/examples/workstation/calc2/calc2.qm index a3bc6f4d..30ac26c9 100644 --- a/examples/workstation/calc2/calc2.qm +++ b/examples/workstation/calc2/calc2.qm @@ -1,5 +1,5 @@ - + Improved model of the Calculator described in Chapter 4 of PSiCC2. Improvements include: - placing the "negated1" state inside "operand1" superstate - placing the "negated2" state inside "operand2" superstate diff --git a/examples/workstation/comp/Makefile b/examples/workstation/comp/Makefile index 136ad339..379cc42f 100644 --- a/examples/workstation/comp/Makefile +++ b/examples/workstation/comp/Makefile @@ -1,6 +1,6 @@ ############################################################################## # Product: Makefile for QP/C for Windows and POSIX *HOSTS* -# Last updated for version 7.1.3 +# Last updated for version 7.2.0 # Last updated on 2022-11-13 # # Q u a n t u m L e a P s diff --git a/examples/workstation/comp/alarm.c b/examples/workstation/comp/alarm.c index a7c1666e..daa60d3c 100644 --- a/examples/workstation/comp/alarm.c +++ b/examples/workstation/comp/alarm.c @@ -3,7 +3,7 @@ * Model: comp.qm * File: ${.::alarm.c} * -* This code has been generated by QM 5.2.1 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later @@ -38,8 +38,8 @@ /* Alarm component --------------------*/ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/examples/workstation/comp/alarm.h b/examples/workstation/comp/alarm.h index 88f94602..0b6c4b2e 100644 --- a/examples/workstation/comp/alarm.h +++ b/examples/workstation/comp/alarm.h @@ -3,7 +3,7 @@ * Model: comp.qm * File: ${.::alarm.h} * -* This code has been generated by QM 5.2.1 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later diff --git a/examples/workstation/comp/clock.c b/examples/workstation/comp/clock.c index c3987500..47fb829d 100644 --- a/examples/workstation/comp/clock.c +++ b/examples/workstation/comp/clock.c @@ -3,7 +3,7 @@ * Model: comp.qm * File: ${.::clock.c} * -* This code has been generated by QM 5.2.1 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later @@ -67,8 +67,8 @@ static AlarmClock l_alarmClock; /* the single inst of the AO */ /* Global-scope objects ----------------------------------------------------*/ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/examples/workstation/comp/clock.h b/examples/workstation/comp/clock.h index fd7acf60..6ec4438f 100644 --- a/examples/workstation/comp/clock.h +++ b/examples/workstation/comp/clock.h @@ -3,7 +3,7 @@ * Model: comp.qm * File: ${.::clock.h} * -* This code has been generated by QM 5.2.1 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later diff --git a/examples/workstation/comp/comp.qm b/examples/workstation/comp/comp.qm index 74770c2e..d48c26b7 100644 --- a/examples/workstation/comp/comp.qm +++ b/examples/workstation/comp/comp.qm @@ -1,5 +1,5 @@ - + "Orthogonal Component" example diff --git a/examples/workstation/defer/Makefile b/examples/workstation/defer/Makefile index 27358753..deffbdf2 100644 --- a/examples/workstation/defer/Makefile +++ b/examples/workstation/defer/Makefile @@ -1,6 +1,6 @@ ############################################################################## # Product: Makefile for QP/C for Windows and POSIX *HOSTS* -# Last updated for version 7.1.3 +# Last updated for version 7.2.0 # Last updated on 2022-11-13 # # Q u a n t u m L e a P s diff --git a/examples/workstation/defer/defer.c b/examples/workstation/defer/defer.c index b64ad242..d997ad9b 100644 --- a/examples/workstation/defer/defer.c +++ b/examples/workstation/defer/defer.c @@ -3,7 +3,7 @@ * Model: defer.qm * File: ${.::defer.c} * -* This code has been generated by QM 5.2.1 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later @@ -88,8 +88,8 @@ static QState TServer_final(TServer * const me, QEvt const * const e); /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/examples/workstation/defer/defer.qm b/examples/workstation/defer/defer.qm index ffd0a1d7..be7f17bb 100644 --- a/examples/workstation/defer/defer.qm +++ b/examples/workstation/defer/defer.qm @@ -1,5 +1,5 @@ - + "Deferred Event" state pattern example diff --git a/examples/workstation/dpp-comp/Makefile b/examples/workstation/dpp-comp/Makefile index cc4fc42a..68232133 100644 --- a/examples/workstation/dpp-comp/Makefile +++ b/examples/workstation/dpp-comp/Makefile @@ -1,6 +1,6 @@ ############################################################################## # Product: Makefile for QP/C for Windows and POSIX *HOSTS* -# Last updated for version 7.1.3 +# Last updated for version 7.2.0 # Last updated on 2022-11-13 # # Q u a n t u m L e a P s diff --git a/examples/workstation/dpp-comp/bsp.c b/examples/workstation/dpp-comp/bsp.c index 5324b399..6943086f 100644 --- a/examples/workstation/dpp-comp/bsp.c +++ b/examples/workstation/dpp-comp/bsp.c @@ -1,7 +1,7 @@ /***************************************************************************** * Product: DPP example (console) -* Last updated for: @ref qpc_7_0_0 -* Date of the Last Update: 2022-02-16 +* Last Updated for Version: 7.2.0 +* Date of the Last Update: 2022-12-22 * * Q u a n t u m L e a P s * ------------------------ @@ -70,7 +70,6 @@ void BSP_init(int argc, char *argv[]) { QS_OBJ_DICTIONARY(&l_clock_tick); /* must be called *after* QF_init() */ QS_USR_DICTIONARY(PHILO_STAT); - QS_FUN_DICTIONARY(&QHsm_top); /* global signals */ QS_SIG_DICTIONARY(DONE_SIG, (void *)0); diff --git a/examples/workstation/dpp-comp/dpp-comp.qm b/examples/workstation/dpp-comp/dpp-comp.qm index f9c733b3..c49158fc 100644 --- a/examples/workstation/dpp-comp/dpp-comp.qm +++ b/examples/workstation/dpp-comp/dpp-comp.qm @@ -1,5 +1,5 @@ - + Dining Philosopher Problem example with the "Orthogonal Component" state pattern (see https://state-machine.com/doc/Pattern_Orthogonal.pdf) The model demonstrates the following features: diff --git a/examples/workstation/dpp-comp/dpp.h b/examples/workstation/dpp-comp/dpp.h index 2ca321f8..1495abf8 100644 --- a/examples/workstation/dpp-comp/dpp.h +++ b/examples/workstation/dpp-comp/dpp.h @@ -3,7 +3,7 @@ * Model: dpp-comp.qm * File: ${.::dpp.h} * -* This code has been generated by QM 5.2.1 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later diff --git a/examples/workstation/dpp-comp/philo.c b/examples/workstation/dpp-comp/philo.c index f76021c0..1ddf399f 100644 --- a/examples/workstation/dpp-comp/philo.c +++ b/examples/workstation/dpp-comp/philo.c @@ -3,7 +3,7 @@ * Model: dpp-comp.qm * File: ${.::philo.c} * -* This code has been generated by QM 5.2.1 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later @@ -64,8 +64,8 @@ static QState Philo_eating(Philo * const me, QEvt const * const e); /* definition of the whole "Comp" package */ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/examples/workstation/dpp-comp/table.c b/examples/workstation/dpp-comp/table.c index 281aa8ac..b7506b0e 100644 --- a/examples/workstation/dpp-comp/table.c +++ b/examples/workstation/dpp-comp/table.c @@ -3,7 +3,7 @@ * Model: dpp-comp.qm * File: ${.::table.c} * -* This code has been generated by QM 5.2.1 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later @@ -64,8 +64,8 @@ static QState Table_paused(Table * const me, QEvt const * const e); /* definition of the whole "Cont" package */ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/examples/workstation/dpp/Makefile b/examples/workstation/dpp/Makefile index cc4fc42a..68232133 100644 --- a/examples/workstation/dpp/Makefile +++ b/examples/workstation/dpp/Makefile @@ -1,6 +1,6 @@ ############################################################################## # Product: Makefile for QP/C for Windows and POSIX *HOSTS* -# Last updated for version 7.1.3 +# Last updated for version 7.2.0 # Last updated on 2022-11-13 # # Q u a n t u m L e a P s diff --git a/examples/workstation/dpp/Makefile_clang b/examples/workstation/dpp/Makefile_clang index e6e8eea3..babf08ab 100644 --- a/examples/workstation/dpp/Makefile_clang +++ b/examples/workstation/dpp/Makefile_clang @@ -1,6 +1,6 @@ ############################################################################## # Product: Makefile for QP/C for Windows and POSIX *HOSTS* -# Last updated for version 7.1.3 +# Last updated for version 7.2.0 # Last updated on 2022-11-13 # # Q u a n t u m L e a P s diff --git a/examples/workstation/dpp/Makefile_t b/examples/workstation/dpp/Makefile_t index f4aa409a..4e763a1e 100644 --- a/examples/workstation/dpp/Makefile_t +++ b/examples/workstation/dpp/Makefile_t @@ -1,6 +1,6 @@ ############################################################################## # Product: Makefile for QP/C for Windows and POSIX *HOSTS* (multithreaded) -# Last updated for version 7.1.3 +# Last updated for version 7.2.0 # Last updated on 2022-11-13 # # Q u a n t u m L e a P s diff --git a/examples/workstation/dpp/dpp.h b/examples/workstation/dpp/dpp.h index b6981505..bbca41ff 100644 --- a/examples/workstation/dpp/dpp.h +++ b/examples/workstation/dpp/dpp.h @@ -3,7 +3,7 @@ * Model: dpp.qm * File: ${.::dpp.h} * -* This code has been generated by QM 5.2.2 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later diff --git a/examples/workstation/dpp/dpp.qm b/examples/workstation/dpp/dpp.qm index b2009bee..5cb89d69 100644 --- a/examples/workstation/dpp/dpp.qm +++ b/examples/workstation/dpp/dpp.qm @@ -1,5 +1,5 @@ - + Dining Philosopher Problem example diff --git a/examples/workstation/dpp/philo.c b/examples/workstation/dpp/philo.c index c3490795..4cd1e47b 100644 --- a/examples/workstation/dpp/philo.c +++ b/examples/workstation/dpp/philo.c @@ -3,7 +3,7 @@ * Model: dpp.qm * File: ${.::philo.c} * -* This code has been generated by QM 5.2.2 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later @@ -68,8 +68,8 @@ static QState Philo_eating(Philo * const me, QEvt const * const e); /* Shared objects ----------------------------------------------------------*/ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/examples/workstation/dpp/table.c b/examples/workstation/dpp/table.c index c75ce419..4daf8d20 100644 --- a/examples/workstation/dpp/table.c +++ b/examples/workstation/dpp/table.c @@ -3,7 +3,7 @@ * Model: dpp.qm * File: ${.::table.c} * -* This code has been generated by QM 5.2.2 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later @@ -65,8 +65,8 @@ static QState Table_paused(Table * const me, QEvt const * const e); /* Shared objects ----------------------------------------------------------*/ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/examples/workstation/history_qhsm/Makefile b/examples/workstation/history_qhsm/Makefile index a488e9a8..5ad70bbf 100644 --- a/examples/workstation/history_qhsm/Makefile +++ b/examples/workstation/history_qhsm/Makefile @@ -1,6 +1,6 @@ ############################################################################## # Product: Makefile for QP/C for Windows and POSIX *HOSTS* -# Last updated for version 7.1.3 +# Last updated for version 7.2.0 # Last updated on 2022-11-13 # # Q u a n t u m L e a P s diff --git a/examples/workstation/history_qhsm/history.c b/examples/workstation/history_qhsm/history.c index 4ea3a048..dfece4c7 100644 --- a/examples/workstation/history_qhsm/history.c +++ b/examples/workstation/history_qhsm/history.c @@ -3,7 +3,7 @@ * Model: history.qm * File: ${.::history.c} * -* This code has been generated by QM 5.2.1 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later @@ -66,8 +66,8 @@ QHsm * const the_oven = &l_oven.super; /* the opaque pointer */ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/examples/workstation/history_qhsm/history.h b/examples/workstation/history_qhsm/history.h index 3a6bfd0d..0e191687 100644 --- a/examples/workstation/history_qhsm/history.h +++ b/examples/workstation/history_qhsm/history.h @@ -3,7 +3,7 @@ * Model: history.qm * File: ${.::history.h} * -* This code has been generated by QM 5.2.1 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later diff --git a/examples/workstation/history_qhsm/history.qm b/examples/workstation/history_qhsm/history.qm index 38ccc54d..c28a4a63 100644 --- a/examples/workstation/history_qhsm/history.qm +++ b/examples/workstation/history_qhsm/history.qm @@ -1,5 +1,5 @@ - + Demonstration of transitions to history and deep history in QHsm-style state machines. diff --git a/examples/workstation/history_qmsm/Makefile b/examples/workstation/history_qmsm/Makefile index 19839b30..aa821d85 100644 --- a/examples/workstation/history_qmsm/Makefile +++ b/examples/workstation/history_qmsm/Makefile @@ -1,6 +1,6 @@ ############################################################################## # Product: Makefile for QP/C for Windows and POSIX *HOSTS* -# Last updated for version 7.1.3 +# Last updated for version 7.2.0 # Last updated on 2022-11-13 # # Q u a n t u m L e a P s diff --git a/examples/workstation/history_qmsm/history.c b/examples/workstation/history_qmsm/history.c index 89cb13e3..f4308067 100644 --- a/examples/workstation/history_qmsm/history.c +++ b/examples/workstation/history_qmsm/history.c @@ -3,7 +3,7 @@ * Model: history.qm * File: ${.::history.c} * -* This code has been generated by QM 5.2.3 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later @@ -127,8 +127,8 @@ QHsm * const the_oven = &l_oven.super.super; /* the opaque pointer */ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/examples/workstation/history_qmsm/history.h b/examples/workstation/history_qmsm/history.h index 696fd026..0e191687 100644 --- a/examples/workstation/history_qmsm/history.h +++ b/examples/workstation/history_qmsm/history.h @@ -3,7 +3,7 @@ * Model: history.qm * File: ${.::history.h} * -* This code has been generated by QM 5.2.3 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later diff --git a/examples/workstation/history_qmsm/history.qm b/examples/workstation/history_qmsm/history.qm index 4ed4c2a5..777b4b77 100644 --- a/examples/workstation/history_qmsm/history.qm +++ b/examples/workstation/history_qmsm/history.qm @@ -1,5 +1,5 @@ - + Demonstration of transitions to shallow history and deep history in QMsm-style state machines. diff --git a/examples/workstation/history_qmsm/main.c b/examples/workstation/history_qmsm/main.c index 7bd179a6..0f35febe 100644 --- a/examples/workstation/history_qmsm/main.c +++ b/examples/workstation/history_qmsm/main.c @@ -61,7 +61,7 @@ int main() { QEvt e; uint8_t c; - PRINTF_S("\n", ""); + PRINTF_S("%c", '\n'); c = (uint8_t)QF_consoleWaitForKey(); PRINTF_S("%c: ", (c >= ' ') ? c : 'X'); diff --git a/examples/workstation/history_qmsm/proj.sln b/examples/workstation/history_qmsm/proj.sln new file mode 100644 index 00000000..5780f268 --- /dev/null +++ b/examples/workstation/history_qmsm/proj.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Express 2013 for Windows Desktop +VisualStudioVersion = 12.0.21005.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "proj", "proj.vcxproj", "{8CC465F7-872E-4D03-B93C-1B64858B4E11}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + QSpy|Win32 = QSpy|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8CC465F7-872E-4D03-B93C-1B64858B4E11}.Debug|Win32.ActiveCfg = Debug|Win32 + {8CC465F7-872E-4D03-B93C-1B64858B4E11}.Debug|Win32.Build.0 = Debug|Win32 + {8CC465F7-872E-4D03-B93C-1B64858B4E11}.Release|Win32.ActiveCfg = Release|Win32 + {8CC465F7-872E-4D03-B93C-1B64858B4E11}.Release|Win32.Build.0 = Release|Win32 + {8CC465F7-872E-4D03-B93C-1B64858B4E11}.QSpy|Win32.ActiveCfg = QSpy|Win32 + {8CC465F7-872E-4D03-B93C-1B64858B4E11}.QSpy|Win32.Build.0 = QSpy|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/examples/workstation/history_qmsm/proj.vcxproj b/examples/workstation/history_qmsm/proj.vcxproj new file mode 100644 index 00000000..488088fd --- /dev/null +++ b/examples/workstation/history_qmsm/proj.vcxproj @@ -0,0 +1,184 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + QSpy + Win32 + + + + {8CC465F7-872E-4D03-B93C-1B64858B4E11} + proj + Win32Proj + 10.0 + + + + Application + NotSet + v142 + + + Application + NotSet + true + v142 + + + Application + NotSet + v142 + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.40219.1 + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + + + + Disabled + .;../../../include;../../../ports/win32-qv;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + false + + + Default + MultiThreaded + NotUsing + Level4 + ProgramDatabase + 4127 + Default + + + %(AdditionalDependencies) + %(AdditionalLibraryDirectories) + true + Console + MachineX86 + + + cmd /c "del $(OutDir)qstamp.obj" + + + + + MaxSpeed + true + .;../../../include;../../../ports/win32-qv;%(AdditionalIncludeDirectories) + NDEBUG;WIN32;_CONSOLE;%(PreprocessorDefinitions) + false + + + Default + MultiThreaded + true + NotUsing + Level4 + ProgramDatabase + 4127 + + + %(AdditionalDependencies) + %(AdditionalLibraryDirectories) + true + Console + true + true + MachineX86 + + + cmd /c "del $(OutDir)qstamp.obj" + + + + + Disabled + .;../../../include;../../../ports/win32-qv;%(AdditionalIncludeDirectories) + Q_SPY;WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + false + + + Default + MultiThreaded + NotUsing + Level4 + ProgramDatabase + 4127 + + + ws2_32.lib;%(AdditionalDependencies) + %(AdditionalLibraryDirectories) + true + Console + MachineX86 + + + cmd /c "del $(OutDir)qstamp.obj" + + + + + + + true + false + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/examples/workstation/history_qmsm/proj.vcxproj.filters b/examples/workstation/history_qmsm/proj.vcxproj.filters new file mode 100644 index 00000000..921ffc79 --- /dev/null +++ b/examples/workstation/history_qmsm/proj.vcxproj.filters @@ -0,0 +1,78 @@ + + + + + + + QP_port + + + QP_port + + + QP + + + QP + + + QP + + + QP + + + QP + + + QP + + + QP + + + QP + + + QP + + + QP + + + QP + + + QP + + + + + + QP_port + + + QP_port + + + QP_port + + + QP_port + + + + + + {6fef7230-b720-452f-b1f6-6fe039768944} + + + {ee79d87d-043f-4f52-9525-2d3df056d571} + + + + + QP_port + + + \ No newline at end of file diff --git a/examples/workstation/qhsmtst/Makefile b/examples/workstation/qhsmtst/Makefile index dbb64165..ae6633dc 100644 --- a/examples/workstation/qhsmtst/Makefile +++ b/examples/workstation/qhsmtst/Makefile @@ -1,6 +1,6 @@ ############################################################################## # Product: Makefile for QP/C for Windows and POSIX *HOSTS* -# Last updated for version 7.1.3 +# Last updated for version 7.2.0 # Last updated on 2022-11-13 # # Q u a n t u m L e a P s diff --git a/examples/workstation/qhsmtst/qhsmtst.c b/examples/workstation/qhsmtst/qhsmtst.c index 2a4a3cb5..4467334f 100644 --- a/examples/workstation/qhsmtst/qhsmtst.c +++ b/examples/workstation/qhsmtst/qhsmtst.c @@ -3,7 +3,7 @@ * Model: qhsmtst.qm * File: ${.::qhsmtst.c} * -* This code has been generated by QM 5.2.1 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later @@ -59,8 +59,8 @@ QHsm * const the_sm = &l_sm.super; /* the opaque pointer */ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/examples/workstation/qhsmtst/qhsmtst.h b/examples/workstation/qhsmtst/qhsmtst.h index fa9bccad..c35bb600 100644 --- a/examples/workstation/qhsmtst/qhsmtst.h +++ b/examples/workstation/qhsmtst/qhsmtst.h @@ -3,7 +3,7 @@ * Model: qhsmtst.qm * File: ${.::qhsmtst.h} * -* This code has been generated by QM 5.2.1 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later diff --git a/examples/workstation/qhsmtst/qhsmtst.qm b/examples/workstation/qhsmtst/qhsmtst.qm index ab2830fd..739dc9bc 100644 --- a/examples/workstation/qhsmtst/qhsmtst.qm +++ b/examples/workstation/qhsmtst/qhsmtst.qm @@ -1,5 +1,5 @@ - + QHsmTst is a contrived state machine from Chapter 2 of the PSiCC2 book for testing all possible transition topologies with up to 4-levels of state nesting. diff --git a/examples/workstation/qmsmtst/Makefile b/examples/workstation/qmsmtst/Makefile index d04b4d0e..16338684 100644 --- a/examples/workstation/qmsmtst/Makefile +++ b/examples/workstation/qmsmtst/Makefile @@ -1,6 +1,6 @@ ############################################################################## # Product: Makefile for QP/C for Windows and POSIX *HOSTS* -# Last updated for version 7.1.3 +# Last updated for version 7.2.0 # Last updated on 2022-11-13 # # Q u a n t u m L e a P s diff --git a/examples/workstation/qmsmtst/qmsmtst.c b/examples/workstation/qmsmtst/qmsmtst.c index 23464ba5..772bbe06 100644 --- a/examples/workstation/qmsmtst/qmsmtst.c +++ b/examples/workstation/qmsmtst/qmsmtst.c @@ -3,7 +3,7 @@ * Model: qmsmtst.qm * File: ${.::qmsmtst.c} * -* This code has been generated by QM 5.2.3 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later @@ -117,8 +117,8 @@ QHsm * const the_sm = &l_sm.super.super; /* the opaque pointer */ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/examples/workstation/qmsmtst/qmsmtst.h b/examples/workstation/qmsmtst/qmsmtst.h index d364016f..57ef458b 100644 --- a/examples/workstation/qmsmtst/qmsmtst.h +++ b/examples/workstation/qmsmtst/qmsmtst.h @@ -3,7 +3,7 @@ * Model: qmsmtst.qm * File: ${.::qmsmtst.h} * -* This code has been generated by QM 5.2.3 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later diff --git a/examples/workstation/qmsmtst/qmsmtst.qm b/examples/workstation/qmsmtst/qmsmtst.qm index 66e9c78c..7bf560bb 100644 --- a/examples/workstation/qmsmtst/qmsmtst.qm +++ b/examples/workstation/qmsmtst/qmsmtst.qm @@ -1,5 +1,5 @@ - + QMsmTst is a QMsm state machine test based on the contrived state machine from Chapter 2 of the PSiCC2 book for testing all possible transition topologies with up to 4-levels of state nesting. diff --git a/examples/workstation/reminder/Makefile b/examples/workstation/reminder/Makefile index f2170f74..13ca8d70 100644 --- a/examples/workstation/reminder/Makefile +++ b/examples/workstation/reminder/Makefile @@ -1,6 +1,6 @@ ############################################################################## # Product: Makefile for QP/C for Windows and POSIX *HOSTS* -# Last updated for version 7.1.3 +# Last updated for version 7.2.0 # Last updated on 2022-11-13 # # Q u a n t u m L e a P s diff --git a/examples/workstation/reminder2/Makefile b/examples/workstation/reminder2/Makefile index 295529b9..fba8fcd5 100644 --- a/examples/workstation/reminder2/Makefile +++ b/examples/workstation/reminder2/Makefile @@ -1,6 +1,6 @@ ############################################################################## # Product: Makefile for QP/C for Windows and POSIX *HOSTS* -# Last updated for version 7.1.3 +# Last updated for version 7.2.0 # Last updated on 2022-11-13 # # Q u a n t u m L e a P s diff --git a/examples/workstation/reminder2/reminder2.c b/examples/workstation/reminder2/reminder2.c index 4a1ebfa8..f9bf08d5 100644 --- a/examples/workstation/reminder2/reminder2.c +++ b/examples/workstation/reminder2/reminder2.c @@ -3,7 +3,7 @@ * Model: reminder2.qm * File: ${.::reminder2.c} * -* This code has been generated by QM 5.2.1 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later @@ -82,8 +82,8 @@ static QState Cruncher_final(Cruncher * const me, QEvt const * const e); /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/examples/workstation/reminder2/reminder2.qm b/examples/workstation/reminder2/reminder2.qm index a57ad9bd..90568b21 100644 --- a/examples/workstation/reminder2/reminder2.qm +++ b/examples/workstation/reminder2/reminder2.qm @@ -1,5 +1,5 @@ - + "Reminder" state pattern example #2 diff --git a/examples/zephyr/dpp/dpp.qm b/examples/zephyr/dpp/dpp.qm index 7f30e34f..27670b13 100644 --- a/examples/zephyr/dpp/dpp.qm +++ b/examples/zephyr/dpp/dpp.qm @@ -1,5 +1,5 @@ - + Dining Philosopher Problem example diff --git a/examples/zephyr/dpp/src/dpp.h b/examples/zephyr/dpp/src/dpp.h index 87d5730a..7866c757 100644 --- a/examples/zephyr/dpp/src/dpp.h +++ b/examples/zephyr/dpp/src/dpp.h @@ -3,7 +3,7 @@ * Model: dpp.qm * File: ${src::dpp.h} * -* This code has been generated by QM 5.2.2 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later diff --git a/examples/zephyr/dpp/src/philo.c b/examples/zephyr/dpp/src/philo.c index 1201eee0..e16efa06 100644 --- a/examples/zephyr/dpp/src/philo.c +++ b/examples/zephyr/dpp/src/philo.c @@ -3,7 +3,7 @@ * Model: dpp.qm * File: ${src::philo.c} * -* This code has been generated by QM 5.2.2 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later @@ -66,8 +66,8 @@ static QState Philo_eating(Philo * const me, QEvt const * const e); /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/examples/zephyr/dpp/src/table.c b/examples/zephyr/dpp/src/table.c index c0918d4d..1743e79a 100644 --- a/examples/zephyr/dpp/src/table.c +++ b/examples/zephyr/dpp/src/table.c @@ -3,7 +3,7 @@ * Model: dpp.qm * File: ${src::table.c} * -* This code has been generated by QM 5.2.2 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * SPDX-License-Identifier: GPL-3.0-or-later @@ -64,8 +64,8 @@ static QState Table_paused(Table * const me, QEvt const * const e); /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/include/qassert.h b/include/qassert.h index 6ac392a5..b8de1642 100644 --- a/include/qassert.h +++ b/include/qassert.h @@ -3,7 +3,7 @@ * Model: qpc.qm * File: ${include::qassert.h} * -* This code has been generated by QM 5.2.3 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This code is covered by the following QP license: @@ -59,6 +59,7 @@ /*$declare${DbC} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*${DbC::Q_NORETURN} .......................................................*/ +#ifndef Q_NORETURN /*! No-return function specifier for the Q_onAssert() callback function. * * The `Q_NORETURN` macro is supposed to be defined in the QP/C port @@ -67,7 +68,6 @@ * * @tr{PQA01_4} */ -#ifndef Q_NORETURN #define Q_NORETURN void #endif /* ndef Q_NORETURN */ @@ -341,6 +341,7 @@ #define Q_ASSERT_COMPILE(expr_) Q_ASSERT_STATIC(expr_) /*${DbC::int_t} ............................................................*/ +#ifndef QP_VERSION /*! typedef for assertions-ids and line numbers in assertions. * * @details @@ -348,7 +349,6 @@ * Use of this type, rather than plain 'int', is in compliance * with the MISRA-C 2012 Dir 4.6 (adv). */ -#ifndef QP_VERSION typedef int int_t; #endif /* ndef QP_VERSION */ diff --git a/include/qep.h b/include/qep.h index 6bb24a67..e981e466 100644 --- a/include/qep.h +++ b/include/qep.h @@ -3,7 +3,7 @@ * Model: qpc.qm * File: ${include::qep.h} * -* This code has been generated by QM 5.2.3 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This code is covered by the following QP license: @@ -52,7 +52,7 @@ * major version number, Y is a 1-digit minor version number, and Z is * a 1-digit release number. */ -#define QP_VERSION 713U +#define QP_VERSION 720U /*! The current QP version as a zero terminated string literal. * @@ -61,10 +61,10 @@ * major version number, Y is a 1-digit minor version number, and Z is * a 1-digit release number. */ -#define QP_VERSION_STR "7.1.3" +#define QP_VERSION_STR "7.2.0" -/*! Encrypted current QP release (7.1.3) and date (2022-11-18) */ -#define QP_RELEASE 0x7C340F56U +/*! Encrypted current QP release (7.2.0) and date (2023-01-06) */ +#define QP_RELEASE 0x76D8998FU /*==========================================================================*/ /*$declare${glob-types} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ @@ -104,6 +104,7 @@ typedef double float64_t; /*$declare${QEP-config} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*${QEP-config::Q_SIGNAL_SIZE} .............................................*/ +#ifndef Q_SIGNAL_SIZE /*! The size (in bytes) of the signal of an event. Valid values: * 1U, 2U, or 4U; default 2U * @@ -112,7 +113,6 @@ typedef double float64_t; * configure the ::QSignal type. When the macro is not defined, the * default of 2 bytes is applied. */ -#ifndef Q_SIGNAL_SIZE #define Q_SIGNAL_SIZE 2U #endif /* ndef Q_SIGNAL_SIZE */ /*$enddecl${QEP-config} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ @@ -125,6 +125,7 @@ typedef double float64_t; extern char const QP_versionStr[8]; /*${QEP::QSignal} ..........................................................*/ +#if (Q_SIGNAL_SIZE == 2U) /*! ::QSignal represents the signal of an event * * @details @@ -135,7 +136,6 @@ extern char const QP_versionStr[8]; * can also contain additional quantitative information about the * occurrence in form of event parameters. */ -#if (Q_SIGNAL_SIZE == 2U) typedef uint16_t QSignal; #endif /* (Q_SIGNAL_SIZE == 2U) */ @@ -195,12 +195,13 @@ typedef struct { /* public: */ +#ifdef Q_EVT_CTOR /*! Custom event constructor * @public @memberof QEvt -* +* @note +* Available only when the macro #Q_EVT_CTOR is defined * @tr{RQP005} */ -#ifdef Q_EVT_CTOR void QEvt_ctor(QEvt * const me, enum_t const sig); #endif /* def Q_EVT_CTOR */ @@ -384,7 +385,7 @@ typedef struct { * @note For a HSM, to "be in a state" means also to be in a superstate of * of the state. * -* @param[in] me pointer (see @ref oop) +* @param[in] me current instance pointer (see @ref oop) * @param[in] state pointer to the state-handler function to be tested * * @returns @@ -399,7 +400,7 @@ bool QHsm_isIn(QHsm * const me, /*! Obtain the current active state from a HSM (read only). * @public @memberof QHsm * -* @param[in] me pointer (see @ref oop) +* @param[in] me current instance pointer (see @ref oop) * * @returns the current active state of the QHsm class * @@ -419,7 +420,7 @@ static inline QStateHandler QHsm_state(QHsm * const me) { * function is to support **shallow history** transitions in state machines * derived from QHsm. * -* @param[in] me pointer (see @ref oop) +* @param[in] me current instance pointer (see @ref oop) * @param[in] parent pointer to the state-handler function * * @returns @@ -447,7 +448,7 @@ QStateHandler QHsm_childState(QHsm * const me, * Performs the first step of HSM initialization by assigning the initial * pseudostate to the currently active state of the state machine. * -* @param[in,out] me pointer (see @ref oop) +* @param[in,out] me current instance pointer (see @ref oop) * @param[in] initial pointer to the top-most initial state-handler * function in the derived state machine * @@ -473,7 +474,7 @@ void QHsm_ctor(QHsm * const me, * QHsm_top() is the ultimate root of state hierarchy in all HSMs derived * from ::QHsm. * -* @param[in] me pointer (see @ref oop) +* @param[in] me current instance pointer (see @ref oop) * @param[in] e pointer to the event to be dispatched to the FSM * * @returns @@ -494,7 +495,7 @@ QState QHsm_top(QHsm const * const me, * @details * Executes the top-most initial transition in a HSM. * -* @param[in,out] me pointer (see @ref oop) +* @param[in,out] me current instance pointer (see @ref oop) * @param[in] e pointer to an extra parameter (might be NULL) * @param[in] qs_id QS-id of this state machine (for QS local filter) * @@ -513,7 +514,7 @@ void QHsm_init_(QHsm * const me, * Dispatches an event for processing to a hierarchical state machine (HSM). * The processing of an event represents one run-to-completion (RTC) step. * -* @param[in,out] me pointer (see @ref oop) +* @param[in,out] me current instance pointer (see @ref oop) * @param[in] e pointer to the event to be dispatched to the HSM * @param[in] qs_id QS-id of this state machine (for QS local filter) * @@ -530,10 +531,10 @@ void QHsm_dispatch_(QHsm * const me, /* private: */ +#ifdef Q_SPY /*! Implementation of getting the state handler in a ::QHsm subclass * @private @memberof QHsm */ -#ifdef Q_SPY QStateHandler QHsm_getStateHandler_(QHsm * const me); #endif /* def Q_SPY */ @@ -643,7 +644,7 @@ typedef struct { * For a MSM, to "be-in" a state means also to "be-in" a superstate of * of the state. * -* @param[in] me pointer (see @ref oop) +* @param[in] me current instance pointer (see @ref oop) * @param[in] state pointer to the QMState object that corresponds to the * tested state. * @returns @@ -655,7 +656,7 @@ bool QMsm_isInState(QMsm const * const me, /*! Obtain the current active state from a MSM (read only) * @public @memberof QMsm * -* @param[in] me pointer (see @ref oop) +* @param[in] me current instance pointer (see @ref oop) * * @returns the current active state-object * @@ -673,7 +674,7 @@ QMState const * QMsm_stateObj(QHsm const * const me); * function is to support **shallow history** transitions in state machines * derived from QMsm. * -* @param[in] me pointer (see @ref oop) +* @param[in] me current instance pointer (see @ref oop) * @param[in] parent pointer to the state-handler object * * @returns @@ -696,7 +697,7 @@ QMState const * QMsm_childStateObj( * Performs the first step of QMsm initialization by assigning the initial * pseudostate to the currently active state of the state machine. * -* @param[in,out] me pointer (see @ref oop) +* @param[in,out] me current instance pointer (see @ref oop) * @param[in] initial the top-most initial transition for the MSM. * * @note @@ -726,7 +727,7 @@ void QMsm_ctor(QMsm * const me, * @details * Executes the top-most initial transition in a MSM. * -* @param[in,out] me pointer (see @ref oop) +* @param[in,out] me current instance pointer (see @ref oop) * @param[in] e pointer to an extra parameter (might be NULL) * @param[in] qs_id QS-id of this state machine (for QS local filter) * @@ -748,7 +749,7 @@ void QMsm_init_( * Dispatches an event for processing to a meta state machine (MSM). * The processing of an event represents one run-to-completion (RTC) step. * -* @param[in,out] me pointer (see @ref oop) +* @param[in,out] me current instance pointer (see @ref oop) * @param[in] e pointer to the event to be dispatched to the MSM * @param[in] qs_id QS-id of this state machine (for QS local filter) * @@ -763,10 +764,10 @@ void QMsm_dispatch_( /* public: */ +#ifdef Q_SPY /*! Implementation of getting the state handler in a ::QMsm subclass * @public @memberof QMsm */ -#ifdef Q_SPY QStateHandler QMsm_getStateHandler_(QHsm * const me); #endif /* def Q_SPY */ @@ -778,7 +779,7 @@ QStateHandler QMsm_getStateHandler_(QHsm * const me); * @details * Helper function to execute transition sequence in a transition-action table. * -* @param[in,out] me pointer (see @ref oop) +* @param[in,out] me current instance pointer (see @ref oop) * @param[in] tatbl pointer to the transition-action table * @param[in] qs_id QS-id of this state machine (for QS local filter) * @@ -802,7 +803,7 @@ QState QMsm_execTatbl_( * transition source, which in a hierarchical state machine might be a * superstate of the current state. * -* @param[in,out] me pointer (see @ref oop) +* @param[in,out] me current instance pointer (see @ref oop) * @param[in] cs pointer to the current state * @param[in] ts pointer to the transition source state * @param[in] qs_id QS-id of this state machine (for QS local filter) @@ -820,7 +821,7 @@ void QMsm_exitToTranSource_( * Static helper function to execute the segment of transition to history * after entering the composite state and * -* @param[in,out] me pointer (see @ref oop) +* @param[in,out] me current instance pointer (see @ref oop) * @param[in] hist pointer to the history substate * @param[in] qs_id QS-id of this state machine (for QS local filter) * @@ -841,10 +842,9 @@ QState QMsm_enterHistory_( #ifdef Q_SPY /*! Virtual call to the top-most initial transition in a HSM. * -* @param[in,out] me_ pointer (see @ref oop) -* @param[in] e_ constant pointer the ::QEvt or a class derived from -* ::QEvt (see @ref oop) -* @param[in] qs_id_ QS local filter ID (used only when Q_SPY is defined) +* @param[in,out] me_ current instance pointer (see @ref oop) +* @param[in] par_ pointer the optional initialization parameter +* @param[in] qs_id_ QS local filter ID (used only when Q_SPY is defined) * * @note Must be called only ONCE after the SM "constructor". * @@ -876,7 +876,7 @@ QState QMsm_enterHistory_( * @details * Processes one event at a time in Run-to-Completion fashion. * -* @param[in,out] me_ pointer (see @ref oop) +* @param[in,out] me_ current instance pointer (see @ref oop) * @param[in] e_ constant pointer the ::QEvt or a class * derived from ::QEvt (see @ref oop) * @param[in] qs_id_ QS local filter ID (used only when Q_SPY is defined) @@ -1142,7 +1142,7 @@ QState QMsm_enterHistory_( /*! Macro to call in a QM state-handler when it designates the * superstate to handle an event. Applicable only to QMSMs. */ -#define QM_SUPER(super_) (Q_RET_SUPER) +#define QM_SUPER() (Q_RET_SUPER) /*${QEP-macros::QM_SUPER_SUB} ..............................................*/ /*! Macro to call in a QM submachine-handler when it designates the diff --git a/include/qequeue.h b/include/qequeue.h index 69dce00b..276dbe7d 100644 --- a/include/qequeue.h +++ b/include/qequeue.h @@ -3,7 +3,7 @@ * Model: qpc.qm * File: ${include::qequeue.h} * -* This code has been generated by QM 5.2.3 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This code is covered by the following QP license: @@ -190,7 +190,7 @@ typedef struct { * @details * Initialize the event queue by giving it the storage for the ring buffer. * -* @param[in,out] me pointer (see @ref oop) +* @param[in,out] me current instance pointer (see @ref oop) * @param[in] qSto an array of pointers to ::QEvt to sereve as the * ring buffer for the event queue * @param[in] qLen the length of the `qSto` buffer (in ::QEvt pointers) @@ -214,7 +214,7 @@ void QEQueue_init(QEQueue * const me, * Post an event to the "raw" thread-safe event queue using the * First-In-First-Out (FIFO) order. * -* @param[in,out] me pointer (see @ref oop) +* @param[in,out] me current instance pointer (see @ref oop) * @param[in] e pointer to the event to be posted to the queue * @param[in] margin number of required free slots in the queue after * posting the event. The special value #QF_NO_MARGIN @@ -244,7 +244,7 @@ bool QEQueue_post(QEQueue * const me, * Post an event to the "raw" thread-safe event queue using the * Last-In-First-Out (LIFO) order. * -* @param[in,out] me pointer (see @ref oop) +* @param[in,out] me current instance pointer (see @ref oop) * @param[in] e pointer to the event to be posted to the queue * * @attention @@ -272,7 +272,7 @@ void QEQueue_postLIFO(QEQueue * const me, * Retrieves an event from the front of the "raw" thread-safe queue and * returns a pointer to this event to the caller. * -* @param[in,out] me pointer (see @ref oop) +* @param[in,out] me current instance pointer (see @ref oop) * * @returns * pointer to event at the front of the queue, if the queue is @@ -299,7 +299,7 @@ QEvt const * QEQueue_get(QEQueue * const me, * only from a single thread (by a single AO), so the number of free * entries cannot change unexpectedly. * -* @param[in] me pointer (see @ref oop) +* @param[in] me current instance pointer (see @ref oop) * * @returns the current number of free slots in the queue. */ @@ -316,7 +316,7 @@ static inline QEQueueCtr QEQueue_getNFree(QEQueue const * const me) { * can change unexpectedly. The main intent for using this operation is to * get an idea of queue usage to size the queue adequately. * -* @param[in] me pointer (see @ref oop) +* @param[in] me current instance pointer (see @ref oop) * * @returns the minimum number of free entries ever in the queue since init. */ @@ -335,7 +335,7 @@ static inline QEQueueCtr QEQueue_getNMin(QEQueue const * const me) { * from a single thread (by a single AO), so no other entity can post * events to the queue. * -* @param[in] me_ pointer (see @ref oop) +* @param[in] me_ current instance pointer (see @ref oop) * * @returns 'true' if the queue is current empty and 'false' otherwise. */ diff --git a/include/qf.h b/include/qf.h index 947eb5d5..e3c6b50c 100644 --- a/include/qf.h +++ b/include/qf.h @@ -3,7 +3,7 @@ * Model: qpc.qm * File: ${include::qf.h} * -* This code has been generated by QM 5.2.3 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This code is covered by the following QP license: @@ -46,10 +46,10 @@ /*$declare${QF-config} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*${QF-config::QF_MAX_ACTIVE} ..............................................*/ +#ifndef QF_MAX_ACTIVE /*! Maximum number of active objects (configurable value in qf_port.h) * Valid values: [1U..64U]; default 32U */ -#ifndef QF_MAX_ACTIVE #define QF_MAX_ACTIVE 32U #endif /* ndef QF_MAX_ACTIVE */ @@ -59,10 +59,10 @@ #endif /* (QF_MAX_ACTIVE > 64U) */ /*${QF-config::QF_MAX_TICK_RATE} ...........................................*/ +#ifndef QF_MAX_TICK_RATE /*! Maximum number of clock rates (configurable value in qf_port.h) * Valid values: [0U..15U]; default 1U */ -#ifndef QF_MAX_TICK_RATE #define QF_MAX_TICK_RATE 1U #endif /* ndef QF_MAX_TICK_RATE */ @@ -72,6 +72,7 @@ #endif /* (QF_MAX_TICK_RATE > 15U) */ /*${QF-config::QF_MAX_EPOOL} ...............................................*/ +#ifndef QF_MAX_EPOOL /*! Maximum number of event pools (configurable value in qf_port.h) * Valid values: [0U..15U]; default 3U * @@ -79,7 +80,6 @@ * #QF_MAX_EPOOL set to zero means that dynamic events are NOT configured * and should not be used in the application. */ -#ifndef QF_MAX_EPOOL #define QF_MAX_EPOOL 3U #endif /* ndef QF_MAX_EPOOL */ @@ -89,10 +89,10 @@ #endif /* (QF_MAX_EPOOL > 15U) */ /*${QF-config::QF_TIMEEVT_CTR_SIZE} ........................................*/ +#ifndef QF_TIMEEVT_CTR_SIZE /*! Size of the QTimeEvt counter (configurable value in qf_port.h) * Valid values: 1U, 2U, or 4U; default 4U */ -#ifndef QF_TIMEEVT_CTR_SIZE #define QF_TIMEEVT_CTR_SIZE 4U #endif /* ndef QF_TIMEEVT_CTR_SIZE */ @@ -102,10 +102,10 @@ #endif /* (QF_TIMEEVT_CTR_SIZE != 1U) && (QF_TIMEEVT_CTR_SIZE != 2U) && (QF_TIMEEVT_CTR_SIZE != 4U) */ /*${QF-config::QF_EVENT_SIZ_SIZE} ..........................................*/ +#ifndef QF_EVENT_SIZ_SIZE /*! Size of the event-size (configurable value in qf_port.h) * Valid values: 1U, 2U, or 4U; default 2U */ -#ifndef QF_EVENT_SIZ_SIZE #define QF_EVENT_SIZ_SIZE 2U #endif /* ndef QF_EVENT_SIZ_SIZE */ @@ -119,8 +119,8 @@ /*$declare${QF-types} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*${QF-types::QPSetBits} ...................................................*/ -/*! bitmask for the internal representation of QPSet elements */ #if (8U < QF_MAX_ACTIVE) && (QF_MAX_ACTIVE <= 16U) +/*! bitmask for the internal representation of QPSet elements */ typedef uint16_t QPSetBits; #endif /* (8U < QF_MAX_ACTIVE) && (QF_MAX_ACTIVE <= 16U) */ @@ -135,6 +135,7 @@ typedef uint8_t QPSetBits; #endif /* (QF_MAX_ACTIVE <= 8U) */ /*${QF-types::QTimeEvtCtr} .................................................*/ +#if (QF_TIMEEVT_CTR_SIZE == 2U) /*! Data type to store the block-size defined based on the macro * #QF_TIMEEVT_CTR_SIZE. * @@ -142,7 +143,6 @@ typedef uint8_t QPSetBits; * The dynamic range of this data type determines the maximum block * size that can be managed by the pool. */ -#if (QF_TIMEEVT_CTR_SIZE == 2U) typedef uint16_t QTimeEvtCtr; #endif /* (QF_TIMEEVT_CTR_SIZE == 2U) */ @@ -228,13 +228,13 @@ typedef uint_fast16_t QSchedStatus; typedef struct { /* public: */ - /*! bitmask with a bit for each element */ #if (QF_MAX_ACTIVE <= 32) + /*! bitmask with a bit for each element */ QPSetBits volatile bits; #endif /* (QF_MAX_ACTIVE <= 32) */ - /*! bitmasks with a bit for each element */ #if (32 < QF_MAX_ACTIVE) + /*! bitmasks with a bit for each element */ QPSetBits volatile bits[2]; #endif /* (32 < QF_MAX_ACTIVE) */ } QPSet; @@ -374,6 +374,7 @@ typedef struct QActive { /* private: */ +#ifdef QF_EQUEUE_TYPE /*! OS-dependent event-queue type * @private @memberof QActive * @@ -387,10 +388,10 @@ typedef struct QActive { * The native QF event queue is configured by defining the macro * #QF_EQUEUE_TYPE as ::QEQueue. */ -#ifdef QF_EQUEUE_TYPE QF_EQUEUE_TYPE eQueue; #endif /* def QF_EQUEUE_TYPE */ +#ifdef QF_OS_OBJECT_TYPE /*! OS-dependent per-thread object * @private @memberof QActive * @@ -400,10 +401,10 @@ typedef struct QActive { * the native QF queue is empty. In other QF ports the OS-dependent * object might be used differently. */ -#ifdef QF_OS_OBJECT_TYPE QF_OS_OBJECT_TYPE osObject; #endif /* def QF_OS_OBJECT_TYPE */ +#ifdef QF_THREAD_TYPE /*! OS-dependent representation of the thread of the active object * @private @memberof QActive * @@ -412,7 +413,6 @@ typedef struct QActive { * In some ports me->thread is used store the thread handle. In other ports * me->thread can be a pointer to the Thread-Local-Storage (TLS). */ -#ifdef QF_THREAD_TYPE QF_THREAD_TYPE thread; #endif /* def QF_THREAD_TYPE */ @@ -473,6 +473,7 @@ void QActive_start_(QActive * const me, /* protected: */ +#ifdef QF_ACTIVE_STOP /*! Stops execution of an active object and removes it from the * framework's supervision * @protected @memberof QActive @@ -483,7 +484,6 @@ void QActive_start_(QActive * const me, * to the AO are considered invalid (dangling) and it becomes * illegal for the rest of the application to post events to the AO. */ -#ifdef QF_ACTIVE_STOP void QActive_stop(QActive * const me); #endif /* def QF_ACTIVE_STOP */ @@ -776,13 +776,6 @@ uint_fast16_t QActive_flushDeferred(QActive const * const me, /* public: */ -/*! Get the priority of the active object. -* @public @memberof QActive -*/ -static inline QPrioSpec QActive_getPrio(QActive const * const me) { - return (QPrioSpec)me->prio | (me->pthre << 8U); -} - /*! Generic setting of additional attributes (useful in QP ports) * @public @memberof QActive */ @@ -835,10 +828,10 @@ void QActive_unregister_(QActive * const me); /* private: */ +#ifdef QF_ISR_API /*! the "FromISR" variant used in the QP port to "FreeRTOS" * @private @memberof QActive */ -#ifdef QF_ISR_API bool QActive_postFromISR_(QActive * const me, QEvt const * const e, uint_fast16_t const margin, @@ -848,10 +841,10 @@ bool QActive_postFromISR_(QActive * const me, /* public: */ +#ifdef QF_ISR_API /*! the "FromISR" variant used in the QP port to "FreeRTOS" * @private @memberof QActive */ -#ifdef QF_ISR_API void QActive_publishFromISR_( QEvt const * e, void * par, @@ -948,7 +941,7 @@ typedef struct { * Performs the first step of active object initialization by assigning * the virtual pointer and calling the superclass constructor. * -* @param[in,out] me pointer (see @ref oop) +* @param[in,out] me current instance pointer (see @ref oop) * @param[in] initial pointer to the event to be dispatched to the MSM * * @note Must be called only ONCE before QHSM_INIT(). @@ -1064,7 +1057,7 @@ typedef struct QTimeEvt { * `act`, tick rate `tickRate` and event signal `sig`. You cannot change * these attributes later. * -* @param[in,out] me pointer (see @ref oop) +* @param[in,out] me current instance pointer (see @ref oop) * @param[in] act pointer to the active object associated with this * time event. The time event will post itself to this AO. * @param[in] sig signal to associate with this time event. @@ -1096,7 +1089,7 @@ void QTimeEvt_ctorX(QTimeEvt * const me, * Also, a time event can be re-armed to fire in a different number of clock * ticks by calling the QTimeEvt_rearm(). * -* @param[in,out] me pointer (see @ref oop) +* @param[in,out] me current instance pointer (see @ref oop) * @param[in] nTicks number of clock ticks (at the associated rate) * to rearm the time event with. * @param[in] interval interval (in clock ticks) for periodic time event. @@ -1121,7 +1114,7 @@ void QTimeEvt_armX(QTimeEvt * const me, * @details * Disarm the time event so it can be safely reused. * -* @param[in,out] me pointer (see @ref oop) +* @param[in,out] me current instance pointer (see @ref oop) * * @returns * 'true' if the time event was truly disarmed, that is, it was running. @@ -1147,7 +1140,7 @@ bool QTimeEvt_disarm(QTimeEvt * const me); * Rearming a periodic timer leaves the interval unchanged and is a convenient * method to adjust the phasing of a periodic time event. * -* @param[in,out] me pointer (see @ref oop) +* @param[in,out] me current instance pointer (see @ref oop) * @param[in] nTicks number of clock ticks (at the associated rate) * to rearm the time event with. * @@ -1169,7 +1162,7 @@ bool QTimeEvt_rearm(QTimeEvt * const me, * Useful for checking whether a one-shot time event was disarmed in the * QTimeEvt_disarm() operation. * -* @param[in,out] me pointer (see @ref oop) +* @param[in,out] me current instance pointer (see @ref oop) * * @returns * 'true' if the time event was truly disarmed in the last QTimeEvt_disarm() @@ -1194,7 +1187,7 @@ bool QTimeEvt_wasDisarmed(QTimeEvt * const me); * Useful for checking how many clock ticks (at the tick rate associated * with the time event) remain until the time event expires. * -* @param[in,out] me pointer (see @ref oop) +* @param[in,out] me current instance pointer (see @ref oop) * * @returns * For an armed time event, the function returns the current value of the @@ -1234,8 +1227,8 @@ void QTimeEvt_tick_( uint_fast8_t const tickRate, void const * const sender); -/*! Processes one clock tick for QUTest */ #ifdef Q_UTEST +/*! Processes one clock tick for QUTest */ void QTimeEvt_tick1_( uint_fast8_t const tickRate, void const * const sender); @@ -1445,9 +1438,13 @@ uint_fast16_t QF_getQueueMin(uint_fast8_t const prio); * @static @public @memberof QF * * @details -* The timeline for calling QF_onStartup() depends on the particular -* QF port. In most cases, QF_onStartup() is called from QF_run(), right -* before starting any multitasking kernel or the background loop. +* The purpose of the QF_onStartup() callback is to configure and enable +* hardware interrupts. The callback is invoked from QF_run(), right before +* starting the underlying real-time kernel. By that time, the application +* is considered ready to receive and service interrupts. +* +* This function is application-specific and is not implemented in QF, but +* rather in the Board Support Package (BSP) for the given application. */ void QF_onStartup(void); @@ -1457,7 +1454,7 @@ void QF_onStartup(void); * * @details * QF_onCleanup() is called in some QF ports before QF returns to the -* underlying operating system or RTOS. +* underlying real-time kernel or operating system. * * This function is strongly platform-specific and is not implemented in * the QF, but either in the QF port or in the Board Support Package (BSP) @@ -1636,6 +1633,36 @@ QEvt const * QF_newRef_( */ void QF_deleteRef_(void const * const evtRef); /*$enddecl${QF::QF-dyn} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ +/*$declare${QF::QF-extern-C} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ + +/*${QF::QF-extern-C::onContextSw} ..........................................*/ +#ifdef QF_ON_CONTEXT_SW +/*! QF context switch callback used in built-in kernels (QV, QK, QXK) +* @static @public @memberof QF +* +* @details +* This callback function provides a mechanism to perform additional +* custom operations when one of the built-in kernels switches context +* from one thread to another. +* +* @param[in] prev pointer to the previous thread (active object) +* (prev==0 means that `prev` was the idle loop) +* @param[in] next pointer to the next thread (active object) +* (next==0) means that `next` is the idle loop) +* @attention +* QF_onContextSw() is invoked with interrupts **disabled** and must also +* return with interrupts **disabled**. +* +* @note +* This callback is enabled by defining the macro #QF_ON_CONTEXT_SW. +* +* @include qf_oncontextsw.c +*/ +void QF_onContextSw( + QActive * prev, + QActive * next); +#endif /* def QF_ON_CONTEXT_SW */ +/*$enddecl${QF::QF-extern-C} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*==========================================================================*/ /*$declare${QF-macros} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ @@ -1685,8 +1712,7 @@ void QF_deleteRef_(void const * const evtRef); */ #define Q_NEW(evtT_, sig_, ...) \ (evtT_##_ctor((evtT_ *)QF_newX_((uint_fast16_t)sizeof(evtT_), \ - QF_NO_MARGIN, 0), (enum_t)(sig_), ##__VA_ARGS__)) - + QF_NO_MARGIN, (sig_)), (enum_t)(sig_), ##__VA_ARGS__)) #endif /* def Q_EVT_CTOR */ /*${QF-macros::Q_NEW_X} ....................................................*/ @@ -1730,7 +1756,7 @@ void QF_deleteRef_(void const * const evtRef); */ #define Q_NEW_X(e_, evtT_, margin_, sig_, ...) do { \ (e_) = (evtT_ *)QF_newX_((uint_fast16_t)sizeof(evtT_), \ - (margin_), 0);\ + (margin_), (enum_t)(sig_));\ if ((e_) != (evtT_ *)0) { \ evtT_##_ctor((e_), (enum_t)(sig_), ##__VA_ARGS__); \ } \ @@ -1788,7 +1814,7 @@ void QF_deleteRef_(void const * const evtRef); * @details * Starts execution of the AO and registers the AO with the framework. * -* @param[in,out] me_ pointer (see @ref oop) +* @param[in,out] me_ current instance pointer (see @ref oop) * @param[in] prioSpec_ priority specification for the Active Object * @param[in] qSto_ pointer to the storage for the ring buffer of the * event queue (used only with the built-in ::QEQueue) @@ -1815,7 +1841,7 @@ void QF_deleteRef_(void const * const evtRef); * @details * This macro asserts if the queue overflows and cannot accept the event. * -* @param[in,out] me_ pointer (see @ref oop) +* @param[in,out] me_ current instance pointer (see @ref oop) * @param[in] e_ pointer to the event to post * @param[in] sender_ pointer to the sender object. * @@ -1854,7 +1880,7 @@ void QF_deleteRef_(void const * const evtRef); * This macro does not assert if the queue overflows and cannot accept * the event with the specified margin of free slots remaining. * -* @param[in,out] me_ pointer (see @ref oop) +* @param[in,out] me_ current instance pointer (see @ref oop) * @param[in] e_ pointer to the event to post * @param[in] margin_ the minimum free slots in the queue, which * must still be available after posting the event. @@ -1898,7 +1924,7 @@ void QF_deleteRef_(void const * const evtRef); /*! Virtual call to post an event to an active object using the * Last-In-First-Out (LIFO) policy. * -* @param[in,out] me_ pointer (see @ref oop) +* @param[in,out] me_ current instance pointer (see @ref oop) * @param[in] e_ pointer to the event to post */ #define QACTIVE_POST_LIFO(me_, e_) \ diff --git a/include/qf_pkg.h b/include/qf_pkg.h index 924174fd..53143839 100644 --- a/include/qf_pkg.h +++ b/include/qf_pkg.h @@ -3,7 +3,7 @@ * Model: qpc.qm * File: ${include::qf_pkg.h} * -* This code has been generated by QM 5.2.3 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This code is covered by the following QP license: @@ -46,8 +46,8 @@ /*$declare${QF::QF-pkg} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*${QF::QF-pkg::ePool_[QF_MAX_EPOOL]} ......................................*/ -/*! array of event pools managed by QF */ #if (QF_MAX_EPOOL > 0U) +/*! array of event pools managed by QF */ extern QF_EPOOL_TYPE_ QF_ePool_[QF_MAX_EPOOL]; #endif /* (QF_MAX_EPOOL > 0U) */ diff --git a/include/qk.h b/include/qk.h index db1db8d1..b6b2927b 100644 --- a/include/qk.h +++ b/include/qk.h @@ -3,7 +3,7 @@ * Model: qpc.qm * File: ${include::qk.h} * -* This code has been generated by QM 5.2.3 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This code is covered by the following QP license: @@ -173,34 +173,6 @@ uint_fast8_t QK_sched_(void); * returns with interrupts **disabled**. */ void QK_activate_(void); - -/*${QK::QK-extern-C::onContextSw} ..........................................*/ -#ifdef QK_ON_CONTEXT_SW -/*! QK context switch callback (customized in BSPs for QK) -* @static @public @memberof QK -* -* @details -* This callback function provides a mechanism to perform additional -* custom operations when QK switches context from one thread to -* another. -* -* @param[in] prev pointer to the previous thread (active object) -* (prev==0 means that `prev` was the QK idle loop) -* @param[in] next pointer to the next thread (active object) -* (next==0) means that `next` is the QK idle loop) -* @attention -* QK_onContextSw() is invoked with interrupts **disabled** and must also -* return with interrupts **disabled**. -* -* @note -* This callback is enabled by defining the macro #QK_ON_CONTEXT_SW. -* -* @include qk_oncontextsw.c -*/ -void QK_onContextSw( - QActive * prev, - QActive * next); -#endif /* def QK_ON_CONTEXT_SW */ /*$enddecl${QK::QK-extern-C} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*==========================================================================*/ diff --git a/include/qmpool.h b/include/qmpool.h index a5e5ad1c..b76cc2b1 100644 --- a/include/qmpool.h +++ b/include/qmpool.h @@ -3,7 +3,7 @@ * Model: qpc.qm * File: ${include::qmpool.h} * -* This code has been generated by QM 5.2.3 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This code is covered by the following QP license: @@ -177,7 +177,7 @@ typedef struct { * Initialize a fixed block-size memory pool by providing it with the pool * memory to manage, size of this memory, and the block size. * -* @param[in,out] me pointer (see @ref oop) +* @param[in,out] me current instance pointer (see @ref oop) * @param[in] poolSto pointer to the memory buffer for pool storage * @param[in] poolSize size of the storage buffer in bytes * @param[in] blockSize fixed-size of the memory blocks in bytes @@ -219,7 +219,7 @@ void QMPool_init(QMPool * const me, * The function allocates a memory block from the pool and returns a pointer * to the block back to the caller. * -* @param[in,out] me pointer (see @ref oop) +* @param[in,out] me current instance pointer (see @ref oop) * @param[in] margin the minimum number of unused blocks still available * in the pool after the allocation. * @@ -256,7 +256,7 @@ void * QMPool_get(QMPool * const me, * @details * Recycle a memory block to the fixed block-size memory pool. * -* @param[in,out] me pointer (see @ref oop) +* @param[in,out] me current instance pointer (see @ref oop) * @param[in] b pointer to the memory block that is being recycled * * @attention diff --git a/include/qpc.h b/include/qpc.h index 1a8285bd..f9028c52 100644 --- a/include/qpc.h +++ b/include/qpc.h @@ -3,7 +3,7 @@ * Model: qpc.qm * File: ${include::qpc.h} * -* This code has been generated by QM 5.2.3 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This code is covered by the following QP license: @@ -129,7 +129,7 @@ typedef char char_t; /*! @deprecated Output formatted uint32_t to the QS record */ #define QS_U32_HEX(width_, data_) \ - (QS_u32_fmt_((uint8_t)(((width_) << 4)) | (uint8_t)0x0FU, (data_))) + (QS_u32_fmt_((uint8_t)(((width_) << 4)) | QS_HEX_FMT, (data_))) #else @@ -157,34 +157,6 @@ typedef char char_t; * instead use: QHSM_DISPATCH() */ #define QMSM_DISPATCH(me_, e_) QHSM_DISPATCH((me_), (e_), 0U) -/*==========================================================================*/ -#if (QP_API_VERSION < 540) - -/*! @deprecated QFsm state machine; -* instead use: ::QHsm. Legacy state machines coded in the "QFsm-style" will -* continue to work, but will use the ::QHsm implementation internally. -* There is no longer any efficiency advantage in using the "QFsm-style" -* state machines. -* -* @note -* For efficiency, the recommended migration path is to use the ::QMsm -* state machine and the QM modeling tool. -*/ -typedef QHsm QFsm; - -/*! @deprecated QFsm state machine constructor; instead use: QHsm_ctor() */ -#define QFsm_ctor QHsm_ctor - -/*! deprecated macro to call in QFsm state-handler when it -* ignores (does not handle) an event (instead use Q_SUPER()) -*/ -#define Q_IGNORED() (Q_SUPER(&QHsm_top)) - -/*! @deprecated macro for cooperativew "Vanilla" kernel; -* instead use: QV_onIdle() */ -#define QF_onIdle QV_onIdle - -#endif /* QP_API_VERSION < 540 */ #endif /* QP_API_VERSION < 580 */ #endif /* QP_API_VERSION < 660 */ #endif /* QP_API_VERSION < 691 */ diff --git a/include/qs.h b/include/qs.h index a83b59fd..63d5691a 100644 --- a/include/qs.h +++ b/include/qs.h @@ -3,7 +3,7 @@ * Model: qpc.qm * File: ${include::qs.h} * -* This code has been generated by QM 5.2.3 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This code is covered by the following QP license: @@ -49,7 +49,26 @@ /*==========================================================================*/ /*$declare${QS-config} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ +/*${QS-config::QS_CTR_SIZE} ................................................*/ +#ifndef QS_CTR_SIZE +/*! The size [bytes] of the internal QS buffer-counters. Valid values: 2U or 4U; +* default 2U. +* +* @details +* This macro can be defined in the QS port file (qs_port.h) to +* configure the ::QSCtr type. Here the macro is not defined so the +* default of 2 byte is chosen. +*/ +#define QS_CTR_SIZE 2U +#endif /* ndef QS_CTR_SIZE */ + +/*${QS-config::QS_CTR_SIZE defined incorrectly,~} ..........................*/ +#if (QS_CTR_SIZE != 2U) && (QS_CTR_SIZE != 4U) +#error QS_CTR_SIZE defined incorrectly, expected 2U or 4U; +#endif /* (QS_CTR_SIZE != 2U) && (QS_CTR_SIZE != 4U) */ + /*${QS-config::QS_TIME_SIZE} ...............................................*/ +#ifndef QS_TIME_SIZE /*! The size [bytes] of the QS time stamp. Valid values: 1U, 2U, or 4U; * default 4U. * @@ -58,7 +77,6 @@ * configure the ::QSTimeCtr type. Here the macro is not defined so the * default of 4 byte is chosen. */ -#ifndef QS_TIME_SIZE #define QS_TIME_SIZE 4U #endif /* ndef QS_TIME_SIZE */ @@ -71,9 +89,20 @@ /*==========================================================================*/ /*$declare${QS} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ +/*${QS::QSCtr} .............................................................*/ +#if (QS_CTR_SIZE == 2U) +/*! QS ring buffer counter and offset type */ +typedef uint_fast16_t QSCtr; +#endif /* (QS_CTR_SIZE == 2U) */ + +/*${QS::QSCtr} .............................................................*/ +#if (QS_CTR_SIZE == 4U) +typedef uint_fast32_t QSCtr; +#endif /* (QS_CTR_SIZE == 4U) */ + /*${QS::QSTimeCtr} .........................................................*/ -/*! QS time stamp type, which determines the dynamic range of QS time stamps */ #if (QS_TIME_SIZE == 4U) +/*! QS time stamp type, which determines the dynamic range of QS time stamps */ typedef uint32_t QSTimeCtr; #endif /* (QS_TIME_SIZE == 4U) */ @@ -88,8 +117,8 @@ typedef uint8_t QSTimeCtr; #endif /* (QS_TIME_SIZE == 1U) */ /*${QS::QSFun} .............................................................*/ -/*! QS function pointer type (for serializing function pointers) */ #if (QS_FUN_PTR_SIZE == 4U) +/*! QS function pointer type (for serializing function pointers) */ typedef uint32_t QSFun; #endif /* (QS_FUN_PTR_SIZE == 4U) */ @@ -108,10 +137,6 @@ typedef uint16_t QSFun; typedef uint8_t QSFun; #endif /* (QS_FUN_PTR_SIZE == 1U) */ -/*${QS::QSCtr} .............................................................*/ -/*! QS ring buffer counter and offset type */ -typedef uint_fast16_t QSCtr; - /*${QS::QSpyPre} ...........................................................*/ /*! QS pre-defined record types (TX channel) * @static @public @memberof QS_tx @@ -208,7 +233,9 @@ enum QSpyPre { QS_SCHED_UNLOCK, /*!< scheduler was unlocked */ QS_SCHED_NEXT, /*!< scheduler started new task */ QS_SCHED_IDLE, /*!< scheduler restored the idle task */ - QS_SCHED_RESUME, /*!< scheduler resumed a (blocked) task */ + + /* [54] Miscellaneous QS records (not maskable) */ + QS_ENUM_DICT, /*!< enumeration dictionary entry */ /* [55] Additional QEP records */ QS_QEP_TRAN_HIST, /*!< a tran to history was taken */ @@ -313,13 +340,6 @@ enum QSpyIdGroups { */ typedef void (* QSpyFunPtr )(void); -/*${QS::QS_EOD} ............................................................*/ -/*! Constant representing End-Of-Data condition returned from the -* QS_getByte() function. -* @static @public @memberof QS_tx -*/ -#define QS_EOD ((uint16_t)0xFFFFU) - /*${QS::QSpyId} ............................................................*/ /*! @brief QS ID type for applying local filtering * @static @public @memberof QS_tx @@ -367,32 +387,29 @@ typedef struct { /*! critical section nesting level */ uint8_t volatile critNest; + + /* flags for internal use */ + uint8_t flags; } QS_tx; /*${QS::QS-tx::preType} ....................................................*/ -/*! Enumerates data formats recognized by QS -* -* @details -* QS uses this enumeration is used only internally for the formatted -* user data elements. -*/ +/*! Enumerates data elements for app-specific trace records */ enum QS_preType { - QS_I8_T, /*!< signed 8-bit integer format */ - QS_U8_T, /*!< unsigned 8-bit integer format */ - QS_I16_T, /*!< signed 16-bit integer format */ - QS_U16_T, /*!< unsigned 16-bit integer format */ - QS_I32_T, /*!< signed 32-bit integer format */ - QS_U32_T, /*!< unsigned 32-bit integer format */ - QS_F32_T, /*!< 32-bit floating point format */ - QS_F64_T, /*!< 64-bit floating point format */ - QS_STR_T, /*!< zero-terminated ASCII string format */ - QS_MEM_T, /*!< up to 255-bytes memory block format */ - QS_SIG_T, /*!< event signal format */ - QS_OBJ_T, /*!< object pointer format */ - QS_FUN_T, /*!< function pointer format */ - QS_I64_T, /*!< signed 64-bit integer format */ - QS_U64_T, /*!< unsigned 64-bit integer format */ - QS_HEX_FMT /*!< HEX format for the "width" filed */ + QS_I8_ENUM_T, /*!< signed 8-bit integer or enum format */ + QS_U8_T, /*!< unsigned 8-bit integer format */ + QS_I16_T, /*!< signed 16-bit integer format */ + QS_U16_T, /*!< unsigned 16-bit integer format */ + QS_I32_T, /*!< signed 32-bit integer format */ + QS_U32_T, /*!< unsigned 32-bit integer format */ + QS_F32_T, /*!< 32-bit floating point format */ + QS_F64_T, /*!< 64-bit floating point format */ + QS_STR_T, /*!< zero-terminated ASCII string format */ + QS_MEM_T, /*!< up to 255-bytes memory block format */ + QS_SIG_T, /*!< event signal format */ + QS_OBJ_T, /*!< object pointer format */ + QS_FUN_T, /*!< function pointer format */ + QS_I64_T, /*!< signed 64-bit integer format */ + QS_U64_T, /*!< unsigned 64-bit integer format */ }; /*${QS::QS-tx::priv_} ......................................................*/ @@ -429,7 +446,7 @@ extern QS_tx QS_priv_; */ void QS_initBuf( uint8_t * const sto, - uint_fast16_t const stoSize); + uint_fast32_t const stoSize); /*${QS::QS-tx::getByte} ....................................................*/ /*! Byte-oriented interface to the QS-TX data buffer @@ -706,6 +723,17 @@ void QS_usr_dict_pre_( enum_t const rec, char const * const name); +/*${QS::QS-tx::enum_dict_pre_} .............................................*/ +/*! Output predefined enum-dictionary record +* @static @private @memberof QS_tx +* +* @note This function is only to be used through macro QS_ENUM_DICTIONARY() +*/ +void QS_enum_dict_pre_( + enum_t const value, + uint8_t const group, + char const * const name); + /*${QS::QS-tx::ASSERTION} ..................................................*/ /*! Output the predefined assertion failure trace record * @static @public @memberof QS_tx @@ -793,6 +821,7 @@ typedef struct { QSCtr end; QSCtr volatile head; QSCtr volatile tail; + #ifdef Q_UTEST bool inTestLoop; #endif /* def Q_UTEST */ @@ -999,8 +1028,8 @@ bool QS_RX_PUT(uint8_t const b); * if #Q_SPY is defined, or do nothing if #Q_SPY is not defined. * * @sa -* - ::QSpyRecordGroups - QS record groups that can be used as `rec_` -* - ::QSpyRecords - individual QS records that can be used as `rec_` +* - enum QSpyGroups - QS record groups that can be used as `rec_` +* - enum QSpyPre - predefined QS records that can be used as `rec_` * * @usage * The following example shows how to use QS filters: @@ -1016,8 +1045,8 @@ bool QS_RX_PUT(uint8_t const b); * if #Q_SPY is defined, or do nothing if #Q_SPY is not defined. * * @sa -* - ::QSpyIdGroups - QS ID groups that can be used as `qs_id_` -* - ::QSpyIdOffsets - QS ID offsets for `qs_id_` (e.g., QS_AP_IDS + 5) +* - enum QSpyIdGroups - QS ID groups that can be used as `qs_id_` +* - enum QSpyIdOffsets - QS ID offsets for `qs_id_` (e.g., QS_AP_IDS + 5) * * The following example shows how to use QS filters: * @include qs_filter.c @@ -1035,7 +1064,7 @@ bool QS_RX_PUT(uint8_t const b); * @note * Must always be used in pair with QS_END() * -* @include qs_user.c +* @include qs_ap.c */ #define QS_BEGIN_ID(rec_, qs_id_) \ if (QS_GLB_CHECK_(rec_) && QS_LOC_CHECK_(qs_id_)) { \ @@ -1104,7 +1133,8 @@ if (QS_GLB_CHECK_(rec_) && QS_LOC_CHECK_(qs_id_)) { \ /*${QS-macros::QS_I8} ......................................................*/ /*! Output formatted int8_t to the QS record */ #define QS_I8(width_, data_) \ - (QS_u8_fmt_((uint8_t)(((width_) << 4)) | (uint8_t)QS_I8_T, (data_))) + (QS_u8_fmt_((uint8_t)(((width_) << 4U) & 0x7U) | (uint8_t)QS_I8_ENUM_T, \ + (data_))) /*${QS-macros::QS_U8} ......................................................*/ /*! Output formatted uint8_t to the QS record */ @@ -1159,6 +1189,12 @@ if (QS_GLB_CHECK_(rec_) && QS_LOC_CHECK_(qs_id_)) { \ /*! Output formatted memory block of up to 255 bytes to the QS record */ #define QS_MEM(mem_, size_) (QS_mem_fmt_((mem_), (size_))) +/*${QS-macros::QS_ENUM} ....................................................*/ +/*! Output formatted enumeration to the QS record */ +#define QS_ENUM(group_, value_) \ + (QS_u8_fmt_((uint8_t)(0x80U | ((group_) << 4U)) | (uint8_t)QS_I8_ENUM_T,\ + (uint8_t)(value_))) + /*${QS-macros::QS_TIME_PRE_} ...............................................*/ #if (QS_TIME_SIZE == 4U) /*! Output time stamp to a QS record (used in predefined @@ -1351,6 +1387,16 @@ if (QS_GLB_CHECK_(rec_) && QS_LOC_CHECK_(qs_id_)) { \ #define QS_USR_DICTIONARY(rec_) \ (QS_usr_dict_pre_((rec_), #rec_)) +/*${QS-macros::QS_ENUM_DICTIONARY} .........................................*/ +/*! Output enumeration dictionary record +* +* @details +* An enum QS record dictionary record associates the numerical value of +* an enumeration with the human-readable identifier. +*/ +#define QS_ENUM_DICTIONARY(value_, group_) \ + (QS_enum_dict_pre_((value_), (group_), #value_)) + /*${QS-macros::QF_QS_CRIT_ENTRY} ...........................................*/ /*! Output the critical section entry record */ void QF_QS_CRIT_ENTRY(void); @@ -1374,6 +1420,25 @@ void QF_QS_ISR_EXIT( /*${QS-macros::QF_QS_ACTION} ...............................................*/ /*! Execute an action that is only necessary for QS output */ #define QF_QS_ACTION(act_) (act_) + +/*${QS-macros::QS_EOD} .....................................................*/ +/*! Constant representing End-Of-Data condition returned from the +* QS_getByte() function. +*/ +#define QS_EOD ((uint16_t)0xFFFFU) + +/*${QS-macros::QS_CMD} .....................................................*/ +/*! Constant representing command enumeration group +* in QS_ENUM_DICTIONARY() and QS_ENUM() +* @sa QS_onCommand() +*/ +#define QS_CMD ((uint8_t)7U) + +/*${QS-macros::QS_HEX_FMT} .................................................*/ +/*! Constant representing HEX format for the "width" filed +* in QS_U8(), QS_U16(), QS_U32(), and QS_U64(). +*/ +#define QS_HEX_FMT ((uint8_t)0x0FU) /*$enddecl${QS-macros} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*==========================================================================*/ diff --git a/include/qs_dummy.h b/include/qs_dummy.h index d609792b..37ac26b0 100644 --- a/include/qs_dummy.h +++ b/include/qs_dummy.h @@ -3,7 +3,7 @@ * Model: qpc.qm * File: ${include::qs_dummy.h} * -* This code has been generated by QM 5.2.3 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This code is covered by the following QP license: @@ -69,7 +69,9 @@ #define QS_U32(width_, data_) ((void)0) #define QS_F32(width_, data_) ((void)0) #define QS_F64(width_, data_) ((void)0) +#define QS_I64(width_, data_) ((void)0) #define QS_U64(width_, data_) ((void)0) +#define QS_ENUM(group_, value_) ((void)0) #define QS_STR(str_) ((void)0) #define QS_MEM(mem_, size_) ((void)0) #define QS_SIG(sig_, obj_) ((void)0) @@ -81,6 +83,7 @@ #define QS_OBJ_ARR_DICTIONARY(obj_, idx_) ((void)0) #define QS_FUN_DICTIONARY(fun_) ((void)0) #define QS_USR_DICTIONARY(rec_) ((void)0) +#define QS_ENUM_DICTIONARY(value_, group_) ((void)0) #define QS_ASSERTION(module_, loc_, delay_) ((void)0) #define QS_FLUSH() ((void)0) diff --git a/include/qs_pkg.h b/include/qs_pkg.h index 1d977a31..13dbf974 100644 --- a/include/qs_pkg.h +++ b/include/qs_pkg.h @@ -3,7 +3,7 @@ * Model: qpc.qm * File: ${include::qs_pkg.h} * -* This code has been generated by QM 5.2.3 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This code is covered by the following QP license: diff --git a/include/qstamp.h b/include/qstamp.h index 356421f0..1185b280 100644 --- a/include/qstamp.h +++ b/include/qstamp.h @@ -3,7 +3,7 @@ * Model: qpc.qm * File: ${include::qstamp.h} * -* This code has been generated by QM 5.2.3 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This code is covered by the following QP license: diff --git a/include/qv.h b/include/qv.h index 3aaca7b5..53034693 100644 --- a/include/qv.h +++ b/include/qv.h @@ -3,7 +3,7 @@ * Model: qpc.qm * File: ${include::qv.h} * -* This code has been generated by QM 5.2.3 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This code is covered by the following QP license: diff --git a/include/qxk.h b/include/qxk.h index e9db7c10..2639a7b0 100644 --- a/include/qxk.h +++ b/include/qxk.h @@ -3,7 +3,7 @@ * Model: qpc.qm * File: ${include::qxk.h} * -* This code has been generated by QM 5.2.3 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This code is covered by the following QP license: @@ -225,13 +225,13 @@ void QXK_stackInit_( uint_fast16_t const stkSize); /*${QXK::QXK-extern-C::contextSw} ..........................................*/ -#if defined(Q_SPY) || defined(QXK_ON_CONTEXT_SW) +#if defined(Q_SPY) || defined(QF_ON_CONTEXT_SW) /*! QXK context switch management * @static @public @memberof QXK * * @details * This function performs software tracing (if #Q_SPY is defined) -* and calls QXK_onContextSw() (if #QXK_ON_CONTEXT_SW is defined) +* and calls QF_onContextSw() (if #QF_ON_CONTEXT_SW is defined) * * @param[in] next pointer to the next thread (NULL for basic-thread) * @@ -240,34 +240,7 @@ void QXK_stackInit_( * return with interrupts **disabled**. */ void QXK_contextSw(QActive * const next); -#endif /* defined(Q_SPY) || defined(QXK_ON_CONTEXT_SW) */ - -/*${QXK::QXK-extern-C::onContextSw} ........................................*/ -#ifdef QXK_ON_CONTEXT_SW -/*! QXK context switch callback (customized in BSPs for QXK) -* @static @public @memberof QXK -* -* @details -* This callback function provides a mechanism to perform additional -* custom operations when QXK switches context from one thread to -* another. -* -* @param[in] prev pointer to the previous thread (NULL for idle thead) -* @param[in] next pointer to the next thread (NULL for idle thead) -* -* @attention -* QXK_onContextSw() is invoked with interrupts **disabled** and must also -* return with interrupts **disabled**. -* -* @note -* This callback is enabled by defining the macro #QXK_ON_CONTEXT_SW. -* -* @include qxk_oncontextsw.c -*/ -void QXK_onContextSw( - QActive * prev, - QActive * next); -#endif /* def QXK_ON_CONTEXT_SW */ +#endif /* defined(Q_SPY) || defined(QF_ON_CONTEXT_SW) */ /*$enddecl${QXK::QXK-extern-C} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*$declare${QXK::QXThread} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ @@ -311,7 +284,7 @@ typedef struct QXThread { * thread-handler function and the tick rate at which it will handle * the timeouts. * -* @param[in,out] me pointer (see @ref oop) +* @param[in,out] me current instance pointer (see @ref oop) * @param[in] handler the thread-handler function * @param[in] tickRate the ticking rate for timeouts in this thread * (see QXThread_delay() and QTIMEEVT_TICK_X()) @@ -405,7 +378,7 @@ void QXThread_dispatch_( * The extended thread becomes ready-to-run immediately and is scheduled * if the QXK is already running. * -* @param[in,out] me pointer (see @ref oop) +* @param[in,out] me current instance pointer (see @ref oop) * @param[in] prio QF-priority of the thread, but no preemption- * threshold. See also ::QPrioSpec. * @param[in] qSto pointer to the storage for the ring buffer of the @@ -450,7 +423,7 @@ void QXThread_start_( * returns 1 (success) if the posting succeeded (with the provided margin) * and 0 (failure) when the posting fails. * -* @param[in,out] me pointer (see @ref oop) +* @param[in,out] me current instance pointer (see @ref oop) * @param[in] e pointer to the event to be posted * @param[in] margin number of required free slots in the queue after * posting the event. The special value #QF_NO_MARGIN @@ -488,8 +461,8 @@ bool QXThread_post_( * @details * Last-In-First-Out (LIFO) policy is not supported for extened threads. * -* @param[in] me pointer (see @ref oop) -* @param[in] e pointer to the event to post to the queue +* @param[in] me current instance pointer (see @ref oop) +* @param[in] e pointer to the event to post to the queue * * @sa * QActive_postLIFO_() @@ -606,7 +579,7 @@ typedef struct { * mechanism, the initial count should set to 0 and maximum count to 1 * (binary semaphore). * -* @param[in,out] me pointer (see @ref oop) +* @param[in,out] me current instance pointer (see @ref oop) * @param[in] count initial value of the semaphore counter * @param[in] max_count maximum value of the semaphore counter. * The purpose of the max_count is to limit the counter @@ -634,11 +607,11 @@ void QXSemaphore_init(QXSemaphore * const me, * expires. If the semaphore is signaled before the timeout expires, QXK * resumes the highest-priority extended thread waiting for the semaphore. * -* @param[in,out] me pointer (see @ref oop) -* @param[in] nTicks number of clock ticks (at the associated rate) -* to wait for the semaphore. The value of -* ::QXTHREAD_NO_TIMEOUT indicates that no timeout will -* occur and the semaphore will wait indefinitely. +* @param[in,out] me current instance pointer (see @ref oop) +* @param[in] nTicks number of clock ticks (at the associated rate) +* to wait for the semaphore. The value of +* ::QXTHREAD_NO_TIMEOUT indicates that no timeout will +* occur and the semaphore will wait indefinitely. * * @returns * 'true' if the semaphore has been signaled and 'false' if a timeout @@ -657,7 +630,7 @@ bool QXSemaphore_wait(QXSemaphore * const me, * This function checks if the semaphore counter is greater than 0, * in which case the counter is decremented. * -* @param[in,out] me pointer (see @ref oop) +* @param[in,out] me current instance pointer (see @ref oop) * * @returns * 'true' if the semaphore has count available and 'false' NOT available. @@ -679,7 +652,7 @@ bool QXSemaphore_tryWait(QXSemaphore * const me); * this thread ready-to-run. The QXK scheduler is then called to determine if * the awakened thread is now the highest-priority thread that is ready-to-run. * -* @param[in,out] me pointer (see @ref oop) +* @param[in,out] me current instance pointer (see @ref oop) * * @returns * 'true' when the semaphore signaled and 'false' when the semaphore count @@ -748,7 +721,7 @@ typedef struct { * @details * Initialize the QXK priority ceiling mutex. * -* @param[in,out] me pointer (see @ref oop) +* @param[in,out] me current instance pointer (see @ref oop) * @param[in] prioSpec the priority specification for the mutex * (See also ::QPrioSpec). This value might * also be zero. @@ -771,7 +744,7 @@ void QXMutex_init(QXMutex * const me, /*! lock the QXK priority-ceiling mutex ::QXMutex * @public @memberof QXMutex * -* @param[in,out] me pointer (see @ref oop) +* @param[in,out] me current instance pointer (see @ref oop) * @param[in] nTicks number of clock ticks (at the associated rate) * to wait for the mutex. The value of * ::QXTHREAD_NO_TIMEOUT indicates that no timeout will @@ -793,7 +766,7 @@ bool QXMutex_lock(QXMutex * const me, /*! try to lock the QXK priority-ceiling mutex ::QXMutex * @public @memberof QXMutex * -* @param[in,out] me pointer (see @ref oop) +* @param[in,out] me current instance pointer (see @ref oop) * * @returns * 'true' if the mutex was successfully locked and 'false' if the mutex was @@ -814,7 +787,7 @@ bool QXMutex_tryLock(QXMutex * const me); /*! unlock the QXK priority-ceiling mutex ::QXMutex * @public @memberof QXMutex *! -* @param[in,out] me pointer (see @ref oop) +* @param[in,out] me current instance pointer (see @ref oop) * * @note * This function **can** be called from both basic threads (active objects) @@ -839,7 +812,7 @@ void QXMutex_unlock(QXMutex * const me); * @details * Starts execution of the thread and registers the AO with the framework. * -* @param[in,out] me_ pointer (see @ref oop) +* @param[in,out] me_ current instance pointer (see @ref oop) * @param[in] prioSpec_ priority specification at which to start the * extended thread (see ::QPrioSpec) * @param[in] qSto_ pointer to the storage for the ring buffer of the @@ -871,7 +844,7 @@ do { \ * This macro does not assert if the queue overflows and cannot accept * the event with the specified margin of free slots remaining. * -* @param[in,out] me_ pointer (see @ref oop) +* @param[in,out] me_ current instance pointer (see @ref oop) * @param[in] e_ pointer to the event to post * @param[in] margin_ the minimum free slots in the queue, which * must still be available after posting the event. diff --git a/ports/arm-cm/qk/armclang/qk_port.c b/ports/arm-cm/qk/armclang/qk_port.c index d81b1ec5..4c31bd73 100644 --- a/ports/arm-cm/qk/armclang/qk_port.c +++ b/ports/arm-cm/qk/armclang/qk_port.c @@ -23,8 +23,8 @@ * ============================================================================*/ /*! -* @date Last updated on: 2022-10-02 -* @version Last updated for: @ref qpc_7_1_2 +* @date Last updated on: 2022-12-18 +* @version Last updated for: @ref qpc_7_2_0 * * @file * @brief QK/C port to ARM Cortex-M, ARM-CLANG toolset @@ -41,10 +41,11 @@ void QK_USE_IRQ_HANDLER(void); void NMI_Handler(void); #endif -#define SCnSCB_ICTR ((uint32_t volatile *)0xE000E004) -#define SCB_SYSPRI ((uint32_t volatile *)0xE000ED14) -#define NVIC_EN ((uint32_t volatile *)0xE000E100) -#define NVIC_IP ((uint8_t volatile *)0xE000E400) +#define SCnSCB_ICTR ((uint32_t volatile *)0xE000E004U) +#define SCB_SYSPRI ((uint32_t volatile *)0xE000ED14U) +#define NVIC_EN ((uint32_t volatile *)0xE000E100U) +#define NVIC_IP ((uint8_t volatile *)0xE000E400U) +#define FPU_FPCCR *((uint32_t volatile *)0xE000EF34U) #define NVIC_PEND 0xE000E200 #define NVIC_ICSR 0xE000ED04 @@ -52,8 +53,8 @@ void NMI_Handler(void); #define VAL(x) #x #define STRINGIFY(x) VAL(x) -/* -* Initialize the exception priorities and IRQ priorities to safe values. +/*..........................................................................*/ +/* Initialize the exception priorities and IRQ priorities to safe values. * * Description: * On ARMv7-M or higher, this QK port disables interrupts by means of the @@ -69,23 +70,24 @@ void NMI_Handler(void); * changed by the application-level code. */ void QK_init(void) { + #if (__ARM_ARCH != 6) /*--------- if ARMv7-M and higher... */ /* set exception priorities to QF_BASEPRI... * SCB_SYSPRI1: Usage-fault, Bus-fault, Memory-fault */ SCB_SYSPRI[1] = (SCB_SYSPRI[1] - | (QF_BASEPRI << 16) | (QF_BASEPRI << 8) | QF_BASEPRI); + | (QF_BASEPRI << 16U) | (QF_BASEPRI << 8U) | QF_BASEPRI); /* SCB_SYSPRI2: SVCall */ - SCB_SYSPRI[2] = (SCB_SYSPRI[2] | (QF_BASEPRI << 24)); + SCB_SYSPRI[2] = (SCB_SYSPRI[2] | (QF_BASEPRI << 24U)); /* SCB_SYSPRI3: SysTick, PendSV, Debug */ SCB_SYSPRI[3] = (SCB_SYSPRI[3] - | (QF_BASEPRI << 24) | (QF_BASEPRI << 16) | QF_BASEPRI); + | (QF_BASEPRI << 24U) | (QF_BASEPRI << 16U) | QF_BASEPRI); /* set all implemented IRQ priories to QF_BASEPRI... */ - uint8_t nprio = (8U + ((*SCnSCB_ICTR & 0x7U) << 3U))*4; + uint8_t nprio = (8U + ((*SCnSCB_ICTR & 0x7U) << 3U)) * 4U; for (uint8_t n = 0U; n < nprio; ++n) { NVIC_IP[n] = QF_BASEPRI; } @@ -102,9 +104,15 @@ void QK_init(void) { NVIC_IP[QK_USE_IRQ_NUM] = 0U; /* priority 0 (highest) */ NVIC_EN[QK_USE_IRQ_NUM / 32U] = (1U << (QK_USE_IRQ_NUM % 32U)); #endif /*--------- QK IRQ specified */ + +#if (__ARM_FP != 0) /*--------- if VFP available... */ + /* configure the FPU for QK */ + FPU_FPCCR |= (1U << 30U) /* automatic FPU state preservation (ASPEN) */ + | (1U << 31U); /* lazy stacking (LSPEN) */ +#endif /*--------- VFP available */ } -/*==========================================================================*/ +/*..........................................................................*/ /* The PendSV_Handler exception is used for handling the asynchronous * preemption in QK. The use of the PendSV exception is the recommended and * the most efficient method for performing context switches with ARM Cortex-M. @@ -186,7 +194,7 @@ __asm volatile ( * NOTE: QK_thread_ret does not execute in the PendSV context! * NOTE: QK_thread_ret is entered with interrupts DISABLED. */ -__attribute__ ((naked)) +__attribute__ ((naked, used)) void QK_thread_ret(void) { __asm volatile ( @@ -274,7 +282,7 @@ __asm volatile ( /*==========================================================================*/ #if (__ARM_ARCH == 6) /* if ARMv6-M... */ -/* hand-optimized quick LOG2 in assembly (No CLZ instruction in ARMv6-M) */ +/* hand-optimized quick LOG2 in assembly (no CLZ instruction in ARMv6-M) */ __attribute__ ((naked)) uint_fast8_t QF_qlog2(uint32_t x) { __asm volatile ( diff --git a/ports/arm-cm/qk/armclang/qk_port.h b/ports/arm-cm/qk/armclang/qk_port.h index d2ab1e98..3903a935 100644 --- a/ports/arm-cm/qk/armclang/qk_port.h +++ b/ports/arm-cm/qk/armclang/qk_port.h @@ -1,5 +1,5 @@ /*============================================================================ -* QK/C port to ARM Cortex-M, ARM-CLANG +* 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 @@ -23,8 +23,8 @@ * ============================================================================*/ /*! -* @date Last updated on: 2022-05-02 -* @version Last updated for: @ref qpc_7_0_0 +* @date Last updated on: 2022-12-18 +* @version Last updated for: @ref qpc_7_2_0 * * @file * @brief QK/C port to ARM Cortex-M, ARM-CLANG toolset @@ -42,7 +42,7 @@ static inline uint32_t QK_get_IPSR(void) { return regIPSR; } -/* QK interrupt entry and exit */ +/* QK ISR entry and exit */ #define QK_ISR_ENTRY() ((void)0) #define QK_ISR_EXIT() do { \ @@ -54,16 +54,16 @@ static inline uint32_t QK_get_IPSR(void) { QK_ARM_ERRATUM_838869(); \ } while (false) -#if (__ARM_ARCH == 6) /* Cortex-M0/M0+/M1 (v6-M, v6S-M)? */ +#if (__ARM_ARCH == 6) /* ARMv6-M? */ #define QK_ARM_ERRATUM_838869() ((void)0) -#else /* Cortex-M3/M4/M7 (v7-M) */ +#else /* ARMv7-M or higher */ /* The following macro implements the recommended workaround for the * ARM Erratum 838869. Specifically, for Cortex-M3/M4/M7 the DSB * (memory barrier) instruction needs to be added before exiting an ISR. */ #define QK_ARM_ERRATUM_838869() \ __asm volatile ("dsb" ::: "memory") -#endif /* ARMv6-M */ +#endif /* Use a given ARM Cortex-M IRQ to return to thread mode (default NMI) * @@ -82,6 +82,13 @@ static inline uint32_t QK_get_IPSR(void) { void QK_init(void); void QK_thread_ret(void); +#if (__ARM_FP != 0) /* if VFP available... */ +/* When the FPU is configured, clear the FPCA bit in the CONTROL register +* to prevent wasting the stack space for the FPU context. +*/ +#define QK_START() __asm volatile ("msr CONTROL,%0" :: "r" (0) : ) +#endif + #include "qk.h" /* QK platform-independent public interface */ #endif /* QK_PORT_H */ diff --git a/ports/arm-cm/qk/gnu/qk_port.c b/ports/arm-cm/qk/gnu/qk_port.c index afa03acb..85d637e8 100644 --- a/ports/arm-cm/qk/gnu/qk_port.c +++ b/ports/arm-cm/qk/gnu/qk_port.c @@ -23,8 +23,8 @@ * ============================================================================*/ /*! -* @date Last updated on: 2022-10-02 -* @version Last updated for: @ref qpc_7_1_2 +* @date Last updated on: 2022-12-18 +* @version Last updated for: @ref qpc_7_2_0 * * @file * @brief QK/C port to ARM Cortex-M, GNU-ARM toolset @@ -41,10 +41,11 @@ void QK_USE_IRQ_HANDLER(void); void NMI_Handler(void); #endif -#define SCnSCB_ICTR ((uint32_t volatile *)0xE000E004) -#define SCB_SYSPRI ((uint32_t volatile *)0xE000ED14) -#define NVIC_EN ((uint32_t volatile *)0xE000E100) -#define NVIC_IP ((uint8_t volatile *)0xE000E400) +#define SCnSCB_ICTR ((uint32_t volatile *)0xE000E004U) +#define SCB_SYSPRI ((uint32_t volatile *)0xE000ED14U) +#define NVIC_EN ((uint32_t volatile *)0xE000E100U) +#define NVIC_IP ((uint8_t volatile *)0xE000E400U) +#define FPU_FPCCR *((uint32_t volatile *)0xE000EF34U) #define NVIC_PEND 0xE000E200 #define NVIC_ICSR 0xE000ED04 @@ -52,11 +53,11 @@ void NMI_Handler(void); #define VAL(x) #x #define STRINGIFY(x) VAL(x) -/* -* Initialize the exception priorities and IRQ priorities to safe values. +/*..........................................................................*/ +/* Initialize the exception priorities and IRQ priorities to safe values. * * Description: -* On Cortex-M3/M4/M7, this QK port disables interrupts by means of the +* On ARMv7-M or higher, this QK port disables interrupts by means of the * BASEPRI register. However, this method cannot disable interrupt * priority zero, which is the default for all interrupts out of reset. * The following code changes the SysTick priority and all IRQ priorities @@ -69,23 +70,24 @@ void NMI_Handler(void); * changed by the application-level code. */ void QK_init(void) { + #if (__ARM_ARCH != 6) /*--------- if ARMv7-M and higher... */ /* set exception priorities to QF_BASEPRI... * SCB_SYSPRI1: Usage-fault, Bus-fault, Memory-fault */ SCB_SYSPRI[1] = (SCB_SYSPRI[1] - | (QF_BASEPRI << 16) | (QF_BASEPRI << 8) | QF_BASEPRI); + | (QF_BASEPRI << 16U) | (QF_BASEPRI << 8U) | QF_BASEPRI); /* SCB_SYSPRI2: SVCall */ - SCB_SYSPRI[2] = (SCB_SYSPRI[2] | (QF_BASEPRI << 24)); + SCB_SYSPRI[2] = (SCB_SYSPRI[2] | (QF_BASEPRI << 24U)); /* SCB_SYSPRI3: SysTick, PendSV, Debug */ SCB_SYSPRI[3] = (SCB_SYSPRI[3] - | (QF_BASEPRI << 24) | (QF_BASEPRI << 16) | QF_BASEPRI); + | (QF_BASEPRI << 24U) | (QF_BASEPRI << 16U) | QF_BASEPRI); /* set all implemented IRQ priories to QF_BASEPRI... */ - uint8_t nprio = (8U + ((*SCnSCB_ICTR & 0x7U) << 3U))*4; + uint8_t nprio = (8U + ((*SCnSCB_ICTR & 0x7U) << 3U)) * 4U; for (uint8_t n = 0U; n < nprio; ++n) { NVIC_IP[n] = QF_BASEPRI; } @@ -102,9 +104,15 @@ void QK_init(void) { NVIC_IP[QK_USE_IRQ_NUM] = 0U; /* priority 0 (highest) */ NVIC_EN[QK_USE_IRQ_NUM / 32U] = (1U << (QK_USE_IRQ_NUM % 32U)); #endif /*--------- QK IRQ specified */ + +#if (__ARM_FP != 0) /*--------- if VFP available... */ + /* configure the FPU for QK */ + FPU_FPCCR |= (1U << 30U) /* automatic FPU state preservation (ASPEN) */ + | (1U << 31U); /* lazy stacking (LSPEN) */ +#endif /*--------- VFP available */ } -/*==========================================================================*/ +/*..........................................................................*/ /* The PendSV_Handler exception is used for handling the asynchronous * preemption in QK. The use of the PendSV exception is the recommended and * the most efficient method for performing context switches with ARM Cortex-M. @@ -191,7 +199,7 @@ __asm volatile ( * NOTE: QK_thread_ret does not execute in the PendSV context! * NOTE: QK_thread_ret is entered with interrupts DISABLED. */ -__attribute__ ((naked, optimize("-fno-stack-protector"))) +__attribute__ ((naked, used, optimize("-fno-stack-protector"))) void QK_thread_ret(void) { __asm volatile ( @@ -208,7 +216,7 @@ __asm volatile ( #if (__ARM_FP != 0) /*--------- if VFP available... */ /* make sure that the VFP stack frame will NOT be used */ " MRS r0,CONTROL \n" /* r0 := CONTROL */ - " BICS r0,r0,#4 \n" /* r0 := r0 & ~4 (FPCA bit) */ + " BIC r0,r0,#4 \n" /* r0 := r0 & ~4 (FPCA bit) */ " MSR CONTROL,r0 \n" /* CONTROL := r0 (clear CONTROL[2] FPCA bit) */ " ISB \n" /* ISB after MSR CONTROL (ARM AN321,Sect.4.16) */ #endif /*--------- VFP available */ @@ -245,7 +253,7 @@ __asm volatile ( * the stack (MSP) and returns to the preempted task using the interrupt * stack frame that must be at the top of the stack. */ -__attribute__ ((naked)) +__attribute__ ((naked, optimize("-fno-stack-protector"))) #ifndef QK_USE_IRQ_NUM /*--------- IRQ NOT defined, use NMI by default */ /* NOTE: The NMI_Handler() is entered with interrupts still disabled! */ @@ -279,7 +287,7 @@ __asm volatile ( /*==========================================================================*/ #if (__ARM_ARCH == 6) /* if ARMv6-M... */ -/* hand-optimized quick LOG2 in assembly (No CLZ instruction in ARMv6-M) */ +/* hand-optimized quick LOG2 in assembly (no CLZ instruction in ARMv6-M) */ /* * NOTE: * The inline GNU assembler does not accept mnemonics MOVS, LSRS and ADDS, diff --git a/ports/arm-cm/qk/gnu/qk_port.h b/ports/arm-cm/qk/gnu/qk_port.h index cb167a5c..842dab26 100644 --- a/ports/arm-cm/qk/gnu/qk_port.h +++ b/ports/arm-cm/qk/gnu/qk_port.h @@ -23,8 +23,8 @@ * ============================================================================*/ /*! -* @date Last updated on: 2022-05-02 -* @version Last updated for: @ref qpc_7_0_0 +* @date Last updated on: 2022-12-18 +* @version Last updated for: @ref qpc_7_2_0 * * @file * @brief QK/C port to ARM Cortex-M, GNU-ARM toolset @@ -42,7 +42,7 @@ static inline uint32_t QK_get_IPSR(void) { return regIPSR; } -/* QK interrupt entry and exit */ +/* QK ISR entry and exit */ #define QK_ISR_ENTRY() ((void)0) #define QK_ISR_EXIT() do { \ @@ -54,9 +54,9 @@ static inline uint32_t QK_get_IPSR(void) { QK_ARM_ERRATUM_838869(); \ } while (false) -#if (__ARM_ARCH == 6) /* Cortex-M0/M0+/M1 (v6-M, v6S-M)? */ +#if (__ARM_ARCH == 6) /* ARMv6-M? */ #define QK_ARM_ERRATUM_838869() ((void)0) -#else /* Cortex-M3/M4/M7 (v7-M) */ +#else /* ARMv7-M or higher */ /* The following macro implements the recommended workaround for the * ARM Erratum 838869. Specifically, for Cortex-M3/M4/M7 the DSB * (memory barrier) instruction needs to be added before exiting an ISR. @@ -82,6 +82,13 @@ static inline uint32_t QK_get_IPSR(void) { void QK_init(void); void QK_thread_ret(void); +#if (__ARM_FP != 0) /* if VFP available... */ +/* When the FPU is configured, clear the FPCA bit in the CONTROL register +* to prevent wasting the stack space for the FPU context. +*/ +#define QK_START() __asm volatile ("msr CONTROL,%0" :: "r" (0) : ) +#endif + #include "qk.h" /* QK platform-independent public interface */ #endif /* QK_PORT_H */ diff --git a/ports/arm-cm/qk/iar/qk_port.c b/ports/arm-cm/qk/iar/qk_port.c index 6a8b8a5a..ff93e6d6 100644 --- a/ports/arm-cm/qk/iar/qk_port.c +++ b/ports/arm-cm/qk/iar/qk_port.c @@ -23,8 +23,8 @@ * ============================================================================*/ /*! -* @date Last updated on: 2022-10-02 -* @version Last updated for: @ref qpc_7_1_2 +* @date Last updated on: 2022-12-18 +* @version Last updated for: @ref qpc_7_2_0 * * @file * @brief QK/C port to ARM Cortex-M, IAR-ARM toolset @@ -41,10 +41,11 @@ void QK_USE_IRQ_HANDLER(void); void NMI_Handler(void); #endif -#define SCnSCB_ICTR ((uint32_t volatile *)0xE000E004) -#define SCB_SYSPRI ((uint32_t volatile *)0xE000ED14) -#define NVIC_EN ((uint32_t volatile *)0xE000E100) -#define NVIC_IP ((uint8_t volatile *)0xE000E400) +#define SCnSCB_ICTR ((uint32_t volatile *)0xE000E004U) +#define SCB_SYSPRI ((uint32_t volatile *)0xE000ED14U) +#define NVIC_EN ((uint32_t volatile *)0xE000E100U) +#define NVIC_IP ((uint8_t volatile *)0xE000E400U) +#define FPU_FPCCR *((uint32_t volatile *)0xE000EF34U) #define NVIC_PEND 0xE000E200 #define NVIC_ICSR 0xE000ED04 @@ -52,11 +53,11 @@ void NMI_Handler(void); #define VAL(x) #x #define STRINGIFY(x) VAL(x) -/* -* Initialize the exception priorities and IRQ priorities to safe values. +/*..........................................................................*/ +/* Initialize the exception priorities and IRQ priorities to safe values. * * Description: -* On Cortex-M3/M4/M7, this QK port disables interrupts by means of the +* On ARMv7-M or higher, this QK port disables interrupts by means of the * BASEPRI register. However, this method cannot disable interrupt * priority zero, which is the default for all interrupts out of reset. * The following code changes the SysTick priority and all IRQ priorities @@ -75,17 +76,17 @@ void QK_init(void) { * SCB_SYSPRI1: Usage-fault, Bus-fault, Memory-fault */ SCB_SYSPRI[1] = (SCB_SYSPRI[1] - | (QF_BASEPRI << 16) | (QF_BASEPRI << 8) | QF_BASEPRI); + | (QF_BASEPRI << 16U) | (QF_BASEPRI << 8U) | QF_BASEPRI); /* SCB_SYSPRI2: SVCall */ - SCB_SYSPRI[2] = (SCB_SYSPRI[2] | (QF_BASEPRI << 24)); + SCB_SYSPRI[2] = (SCB_SYSPRI[2] | (QF_BASEPRI << 24U)); /* SCB_SYSPRI3: SysTick, PendSV, Debug */ SCB_SYSPRI[3] = (SCB_SYSPRI[3] - | (QF_BASEPRI << 24) | (QF_BASEPRI << 16) | QF_BASEPRI); + | (QF_BASEPRI << 24U) | (QF_BASEPRI << 16U) | QF_BASEPRI); /* set all implemented IRQ priories to QF_BASEPRI... */ - uint8_t nprio = (8U + ((*SCnSCB_ICTR & 0x7U) << 3U))*4; + uint8_t nprio = (8U + ((*SCnSCB_ICTR & 0x7U) << 3U)) * 4U; for (uint8_t n = 0U; n < nprio; ++n) { NVIC_IP[n] = QF_BASEPRI; } @@ -102,9 +103,15 @@ void QK_init(void) { NVIC_IP[QK_USE_IRQ_NUM] = 0U; /* priority 0 (highest) */ NVIC_EN[QK_USE_IRQ_NUM / 32U] = (1U << (QK_USE_IRQ_NUM % 32U)); #endif /*--------- QK IRQ specified */ + +#if (__ARM_FP != 0) /*--------- if VFP available... */ + /* configure the FPU for QK */ + FPU_FPCCR |= (1U << 30U) /* automatic FPU state preservation (ASPEN) */ + | (1U << 31U); /* lazy stacking (LSPEN) */ +#endif /*--------- VFP available */ } -/*==========================================================================*/ +/*..........................................................................*/ /* The PendSV_Handler exception is used for handling the asynchronous * preemption in QK. The use of the PendSV exception is the recommended and * the most efficient method for performing context switches with ARM Cortex-M. @@ -278,36 +285,36 @@ __asm volatile ( /*==========================================================================*/ #if (__ARM_ARCH == 6) /* if ARMv6-M... */ -/* hand-optimized quick LOG2 in assembly (No CLZ instruction in ARMv6-M) */ +/* hand-optimized quick LOG2 in assembly (no CLZ instruction in ARMv6-M) */ uint_fast8_t QF_qlog2(uint32_t x) { static uint8_t const log2LUT[16] = { 0U, 1U, 2U, 2U, 3U, 3U, 3U, 3U, 4U, 4U, 4U, 4U, 4U, 4U, 4U, 4U }; uint_fast8_t n; - __asm ( - "MOVS %[n],#0\n" + +__asm volatile ( + " MOVS %[n],#0 \n" #if (QF_MAX_ACTIVE > 16U) - "LSRS r2,r0,#16\n" - "BEQ.N QF_qlog2_1\n" - "MOVS %[n],#16\n" - "MOVS r0,r2\n" - "QF_qlog2_1:\n" + " LSRS r2,r0,#16 \n" + " BEQ QF_qlog2_1 \n" + " MOVS %[n],#16 \n" + " MOVS r0,r2 \n" + "QF_qlog2_1: \n" #endif #if (QF_MAX_ACTIVE > 8U) - "LSRS r2,r0,#8\n" - "BEQ.N QF_qlog2_2\n" - "ADDS %[n],%[n],#8\n" - "MOVS r0,r2\n" - "QF_qlog2_2:\n" + " LSRS r2,r0,#8 \n" + " BEQ QF_qlog2_2 \n" + " ADDS %[n],%[n],#8 \n" + " MOVS r0,r2 \n" + "QF_qlog2_2: \n" #endif - "LSRS r2,r0,#4\n" - "BEQ.N QF_qlog2_3\n" - "ADDS %[n],%[n],#4\n" - "MOVS r0,r2\n" - "QF_qlog2_3:" - : [n]"=r"(n) - ); + " LSRS r2,r0,#4 \n" + " BEQ.N QF_qlog2_3 \n" + " ADDS %[n],%[n],#4 \n" + " MOVS r0,r2 \n" + "QF_qlog2_3:" : [n]"=r"(n) +); return n + log2LUT[x]; } diff --git a/ports/arm-cm/qk/iar/qk_port.h b/ports/arm-cm/qk/iar/qk_port.h index 996807ca..eaa0bccc 100644 --- a/ports/arm-cm/qk/iar/qk_port.h +++ b/ports/arm-cm/qk/iar/qk_port.h @@ -23,8 +23,8 @@ * ============================================================================*/ /*! -* @date Last updated on: 2022-05-02 -* @version Last updated for: @ref qpc_7_0_0 +* @date Last updated on: 2022-12-18 +* @version Last updated for: @ref qpc_7_2_0 * * @file * @brief QK/C port to ARM Cortex-M, IAR-ARM toolset @@ -47,9 +47,9 @@ QK_ARM_ERRATUM_838869(); \ } while (false) -#if (__ARM_ARCH == 6) /* Cortex-M0/M0+/M1 (v6-M, v6S-M)? */ +#if (__ARM_ARCH == 6) /* ARMv6-M? */ #define QK_ARM_ERRATUM_838869() ((void)0) -#else /* Cortex-M3/M4/M7 (v7-M) */ +#else /* ARMv7-M or higher */ /* The following macro implements the recommended workaround for the * ARM Erratum 838869. Specifically, for Cortex-M3/M4/M7 the DSB * (memory barrier) instruction needs to be added before exiting an ISR. @@ -74,6 +74,13 @@ void QK_init(void); void QK_thread_ret(void); +#if (__ARM_FP != 0) /* if VFP available... */ +/* When the FPU is configured, clear the FPCA bit in the CONTROL register +* to prevent wasting the stack space for the FPU context. +*/ +#define QK_START() __set_CONTROL(0U) +#endif + #include "qk.h" /* QK platform-independent public interface */ #endif /* QK_PORT_H */ diff --git a/ports/arm-cm/qv/armclang/qv_port.c b/ports/arm-cm/qv/armclang/qv_port.c index e35b8681..87af3117 100644 --- a/ports/arm-cm/qv/armclang/qv_port.c +++ b/ports/arm-cm/qv/armclang/qv_port.c @@ -23,19 +23,77 @@ * ============================================================================*/ /*! -* @date Last updated on: 2022-05-13 -* @version Last updated for: @ref qpc_7_0_1 +* @date Last updated on: 2022-12-18 +* @version Last updated for: @ref qpc_7_2_0 * * @file * @brief QV/C port to ARM Cortex-M, ARM-CLANG toolset */ -/* This QV port is part of the interanl QP implementation */ +/* This QV port is part of the internal QP implementation */ #define QP_IMPL 1U #include "qf_port.h" -#if (__ARM_ARCH == 6) /* ARMv6-M? */ +#define SCnSCB_ICTR ((uint32_t volatile *)0xE000E004U) +#define SCB_SYSPRI ((uint32_t volatile *)0xE000ED14U) +#define NVIC_IP ((uint32_t volatile *)0xE000E400U) +#define FPU_FPCCR *((uint32_t volatile *)0xE000EF34U) -/* hand-optimized quick LOG2 in assembly (M0/M0+ have no CLZ instruction) */ +/*..........................................................................*/ +/* +* Initialize the exception priorities and IRQ priorities to safe values. +* +* Description: +* On ARMv7-M or higher, this QK port disables interrupts by means of the +* BASEPRI register. However, this method cannot disable interrupt +* priority zero, which is the default for all interrupts out of reset. +* The following code changes the SysTick priority and all IRQ priorities +* to the safe value QF_BASEPRI, which the QF critical section can disable. +* This avoids breaching of the QF critical sections in case the +* application programmer forgets to explicitly set priorities of all +* "kernel aware" interrupts. +* +* The interrupt priorities established in QV_init() can be later +* changed by the application-level code. +*/ +void QV_init(void) { + +#if (__ARM_ARCH != 6) /*--------- if ARMv7-M and higher... */ + + /* set exception priorities to QF_BASEPRI... + * SCB_SYSPRI1: Usage-fault, Bus-fault, Memory-fault + */ + SCB_SYSPRI[1] = (SCB_SYSPRI[1] + | (QF_BASEPRI << 16U) | (QF_BASEPRI << 8U) | QF_BASEPRI); + + /* SCB_SYSPRI2: SVCall */ + SCB_SYSPRI[2] = (SCB_SYSPRI[2] | (QF_BASEPRI << 24U)); + + /* SCB_SYSPRI3: SysTick, PendSV, Debug */ + SCB_SYSPRI[3] = (SCB_SYSPRI[3] + | (QF_BASEPRI << 24U) | (QF_BASEPRI << 16U) | QF_BASEPRI); + + /* set all implemented IRQ priories to QF_BASEPRI... */ + uint8_t nprio = (8U + ((*SCnSCB_ICTR & 0x7U) << 3U)) * 4U; + for (uint8_t n = 0U; n < nprio; ++n) { + NVIC_IP[n] = QF_BASEPRI; + } + +#endif /*--------- ARMv7-M or higher */ + + /* SCB_SYSPRI3: PendSV set to priority 0xFF (lowest) */ + SCB_SYSPRI[3] = (SCB_SYSPRI[3] | (0xFFU << 16U)); + +#if (__ARM_FP != 0) /*--------- if VFP available... */ + /* configure the FPU for QK */ + FPU_FPCCR |= (1U << 30U) /* automatic FPU state preservation (ASPEN) */ + | (1U << 31U); /* lazy stacking (LSPEN) */ +#endif /*--------- VFP available */ +} + +/*==========================================================================*/ +#if (__ARM_ARCH == 6) /* if ARMv6-M... */ + +/* hand-optimized quick LOG2 in assembly (no CLZ instruction in ARMv6-M) */ __attribute__ ((naked)) uint_fast8_t QF_qlog2(uint32_t x) { __asm volatile ( @@ -69,52 +127,5 @@ __asm volatile ( ); } -#else /* ARMv7-M or higher */ - -#define SCnSCB_ICTR ((uint32_t volatile *)0xE000E004) -#define SCB_SYSPRI ((uint32_t volatile *)0xE000ED14) -#define NVIC_IP ((uint32_t volatile *)0xE000E400) - -/* -* Initialize the exception priorities and IRQ priorities to safe values. -* -* Description: -* On Cortex-M3/M4/M7, this QV port disables interrupts by means of the -* BASEPRI register. However, this method cannot disable interrupt -* priority zero, which is the default for all interrupts out of reset. -* The following code changes the SysTick priority and all IRQ priorities -* to the safe value QF_BASEPRI, wich the QF critical section can disable. -* This avoids breaching of the QF critical sections in case the -* application programmer forgets to explicitly set priorities of all -* "kernel aware" interrupts. -* -* The interrupt priorities established in QV_init() can be later -* changed by the application-level code. -*/ -void QV_init(void) { - uint32_t n; - - /* set exception priorities to QF_BASEPRI... - * SCB_SYSPRI1: Usage-fault, Bus-fault, Memory-fault - */ - SCB_SYSPRI[1] = (SCB_SYSPRI[1] - | (QF_BASEPRI << 16) | (QF_BASEPRI << 8) | QF_BASEPRI); - - /* SCB_SYSPRI2: SVCall */ - SCB_SYSPRI[2] = (SCB_SYSPRI[2] | (QF_BASEPRI << 24)); - - /* SCB_SYSPRI3: SysTick, PendSV, Debug */ - SCB_SYSPRI[3] = (SCB_SYSPRI[3] - | (QF_BASEPRI << 24) | (QF_BASEPRI << 16) | QF_BASEPRI); - - /* set all implemented IRQ priories to QF_BASEPRI... */ - n = 8U + ((*SCnSCB_ICTR & 0x7U) << 3); /* (# NVIC_PRIO registers)/4 */ - do { - --n; - NVIC_IP[n] = (QF_BASEPRI << 24) | (QF_BASEPRI << 16) - | (QF_BASEPRI << 8) | QF_BASEPRI; - } while (n != 0); -} - -#endif /* ARMv7-M or higher */ +#endif /* ARMv6-M */ diff --git a/ports/arm-cm/qv/armclang/qv_port.h b/ports/arm-cm/qv/armclang/qv_port.h index ec98d2a5..da3ec8cb 100644 --- a/ports/arm-cm/qv/armclang/qv_port.h +++ b/ports/arm-cm/qv/armclang/qv_port.h @@ -23,8 +23,8 @@ * ============================================================================*/ /*! -* @date Last updated on: 2022-04-09 -* @version Last updated for: @ref qpc_7_0_0 +* @date Last updated on: 2022-12-18 +* @version Last updated for: @ref qpc_7_2_0 * * @file * @brief QV/C port to ARM Cortex-M, ARM-CLANG/LLVM toolset @@ -52,10 +52,6 @@ QF_PRIMASK_ENABLE(); \ } while (false) - /* initialization of the QV kernel for Cortex-M3/M4/M4F */ - #define QV_INIT() QV_init() - void QV_init(void); - /* The following macro implements the recommended workaround for the * ARM Erratum 838869. Specifically, for Cortex-M3/M4/M7 the DSB * (memory barrier) instruction needs to be added before exiting an ISR. @@ -64,7 +60,18 @@ #define QV_ARM_ERRATUM_838869() \ __asm volatile ("dsb 0xf" ::: "memory") -#endif /* ARMv7-M or higher */ +#endif + +/* initialization of the QV kernel */ +#define QV_INIT() QV_init() +void QV_init(void); + +#if (__ARM_FP != 0) /* if VFP available... */ +/* When the FPU is configured, clear the FPCA bit in the CONTROL register +* to prevent wasting the stack space for the FPU context. +*/ +#define QV_START() __asm volatile ("msr CONTROL,%0" :: "r" (0) : ) +#endif #include "qv.h" /* QV platform-independent public interface */ diff --git a/ports/arm-cm/qv/gnu/qf_port.h b/ports/arm-cm/qv/gnu/qf_port.h index 9c2d1ac2..35148d76 100644 --- a/ports/arm-cm/qv/gnu/qf_port.h +++ b/ports/arm-cm/qv/gnu/qf_port.h @@ -36,7 +36,7 @@ #define QF_MAX_TICK_RATE 2U /* QF interrupt disable/enable and log2()... */ -#if (__ARM_ARCH == 6) /* Cortex-M0/M0+/M1(v6-M, v6S-M)? */ +#if (__ARM_ARCH == 6) /* ARMv6-M, v6S-M)? */ /* The maximum number of active objects in the application, see NOTE1 */ #define QF_MAX_ACTIVE 16U @@ -56,7 +56,7 @@ /* hand-optimized LOG2 in assembly for Cortex-M0/M0+/M1(v6-M, v6S-M) */ #define QF_LOG2(n_) QF_qlog2((uint32_t)(n_)) -#else /* Cortex-M3/M4/M7 */ +#else /* ARMv7-M and higher */ /* The maximum number of active objects in the application, see NOTE1 */ #define QF_MAX_ACTIVE 32U diff --git a/ports/arm-cm/qv/gnu/qv_port.c b/ports/arm-cm/qv/gnu/qv_port.c index 33b7a17e..5300c3b1 100644 --- a/ports/arm-cm/qv/gnu/qv_port.c +++ b/ports/arm-cm/qv/gnu/qv_port.c @@ -23,24 +23,81 @@ * ============================================================================*/ /*! -* @date Last updated on: 2022-05-13 -* @version Last updated for: @ref qpc_7_0_1 +* @date Last updated on: 2022-12-18 +* @version Last updated for: @ref qpc_7_2_0 * * @file * @brief QV/C port to ARM Cortex-M, GNU-ARM toolset */ -/* This QV port is part of the interanl QP implementation */ +/* This QV port is part of the internal QP implementation */ #define QP_IMPL 1U #include "qf_port.h" -#if (__ARM_ARCH == 6) /* ARMv6-M? */ +#define SCnSCB_ICTR ((uint32_t volatile *)0xE000E004U) +#define SCB_SYSPRI ((uint32_t volatile *)0xE000ED14U) +#define NVIC_IP ((uint32_t volatile *)0xE000E400U) +#define FPU_FPCCR *((uint32_t volatile *)0xE000EF34U) + +/*..........................................................................*/ +/* Initialize the exception priorities and IRQ priorities to safe values. +* +* Description: +* On ARMv7-M or higher, this QK port disables interrupts by means of the +* BASEPRI register. However, this method cannot disable interrupt +* priority zero, which is the default for all interrupts out of reset. +* The following code changes the SysTick priority and all IRQ priorities +* to the safe value QF_BASEPRI, which the QF critical section can disable. +* This avoids breaching of the QF critical sections in case the +* application programmer forgets to explicitly set priorities of all +* "kernel aware" interrupts. +* +* The interrupt priorities established in QV_init() can be later +* changed by the application-level code. +*/ +void QV_init(void) { + +#if (__ARM_ARCH != 6) /*--------- if ARMv7-M and higher... */ + + /* set exception priorities to QF_BASEPRI... + * SCB_SYSPRI1: Usage-fault, Bus-fault, Memory-fault + */ + SCB_SYSPRI[1] = (SCB_SYSPRI[1] + | (QF_BASEPRI << 16U) | (QF_BASEPRI << 8U) | QF_BASEPRI); + + /* SCB_SYSPRI2: SVCall */ + SCB_SYSPRI[2] = (SCB_SYSPRI[2] | (QF_BASEPRI << 24U)); + + /* SCB_SYSPRI3: SysTick, PendSV, Debug */ + SCB_SYSPRI[3] = (SCB_SYSPRI[3] + | (QF_BASEPRI << 24U) | (QF_BASEPRI << 16U) | QF_BASEPRI); + + /* set all implemented IRQ priories to QF_BASEPRI... */ + uint8_t nprio = (8U + ((*SCnSCB_ICTR & 0x7U) << 3U)) * 4U; + for (uint8_t n = 0U; n < nprio; ++n) { + NVIC_IP[n] = QF_BASEPRI; + } + +#endif /*--------- ARMv7-M or higher */ + + /* SCB_SYSPRI3: PendSV set to priority 0xFF (lowest) */ + SCB_SYSPRI[3] = (SCB_SYSPRI[3] | (0xFFU << 16U)); + +#if (__ARM_FP != 0) /*--------- if VFP available... */ + /* configure the FPU for QK */ + FPU_FPCCR |= (1U << 30U) /* automatic FPU state preservation (ASPEN) */ + | (1U << 31U); /* lazy stacking (LSPEN) */ +#endif /*--------- VFP available */ +} + +/*==========================================================================*/ +#if (__ARM_ARCH == 6) /* if ARMv6-M... */ /* hand-optimized quick LOG2 in assembly (no CLZ instruction in ARMv6-M) */ /* * NOTE: * The inline GNU assembler does not accept mnemonics MOVS, LSRS and ADDS, -* but for Cortex-M0/M0+/M1 the mnemonics MOV, LSR and ADD always set the -* condition flags in the PSR. +* but for ARMv6-M the mnemonics MOV, LSR and ADD always set the condition +* flags in the PSR. */ __attribute__ ((naked, optimize("-fno-stack-protector"))) uint_fast8_t QF_qlog2(uint32_t x) { @@ -75,52 +132,5 @@ __asm volatile ( ); } -#else /* ARMv7-M or higher */ - -#define SCnSCB_ICTR ((uint32_t volatile *)0xE000E004) -#define SCB_SYSPRI ((uint32_t volatile *)0xE000ED14) -#define NVIC_IP ((uint32_t volatile *)0xE000E400) - -/* -* Initialize the exception priorities and IRQ priorities to safe values. -* -* Description: -* On Cortex-M3/M4/M7, this QV port disables interrupts by means of the -* BASEPRI register. However, this method cannot disable interrupt -* priority zero, which is the default for all interrupts out of reset. -* The following code changes the SysTick priority and all IRQ priorities -* to the safe value QF_BASEPRI, wich the QF critical section can disable. -* This avoids breaching of the QF critical sections in case the -* application programmer forgets to explicitly set priorities of all -* "kernel aware" interrupts. -* -* The interrupt priorities established in QV_init() can be later -* changed by the application-level code. -*/ -void QV_init(void) { - uint32_t n; - - /* set exception priorities to QF_BASEPRI... - * SCB_SYSPRI1: Usage-fault, Bus-fault, Memory-fault - */ - SCB_SYSPRI[1] = (SCB_SYSPRI[1] - | (QF_BASEPRI << 16) | (QF_BASEPRI << 8) | QF_BASEPRI); - - /* SCB_SYSPRI2: SVCall */ - SCB_SYSPRI[2] = (SCB_SYSPRI[2] | (QF_BASEPRI << 24)); - - /* SCB_SYSPRI3: SysTick, PendSV, Debug */ - SCB_SYSPRI[3] = (SCB_SYSPRI[3] - | (QF_BASEPRI << 24) | (QF_BASEPRI << 16) | QF_BASEPRI); - - /* set all implemented IRQ priories to QF_BASEPRI... */ - n = 8U + ((*SCnSCB_ICTR & 0x7U) << 3); /* (# NVIC_PRIO registers)/4 */ - do { - --n; - NVIC_IP[n] = (QF_BASEPRI << 24) | (QF_BASEPRI << 16) - | (QF_BASEPRI << 8) | QF_BASEPRI; - } while (n != 0); -} - -#endif /* ARMv7-M or higher */ +#endif /* ARMv6-M */ diff --git a/ports/arm-cm/qv/gnu/qv_port.h b/ports/arm-cm/qv/gnu/qv_port.h index ef37fc4c..fb989564 100644 --- a/ports/arm-cm/qv/gnu/qv_port.h +++ b/ports/arm-cm/qv/gnu/qv_port.h @@ -23,8 +23,8 @@ * ============================================================================*/ /*! -* @date Last updated on: 2022-04-09 -* @version Last updated for: @ref qpc_7_0_0 +* @date Last updated on: 2022-12-18 +* @version Last updated for: @ref qpc_7_2_0 * * @file * @brief QV/C port to ARM Cortex-M, GNU-ARM toolset @@ -52,10 +52,6 @@ QF_PRIMASK_ENABLE(); \ } while (false) - /* initialization of the QV kernel for Cortex-M3/M4/M4F */ - #define QV_INIT() QV_init() - void QV_init(void); - /* The following macro implements the recommended workaround for the * ARM Erratum 838869. Specifically, for Cortex-M3/M4/M7 the DSB * (memory barrier) instruction needs to be added before exiting an ISR. @@ -64,7 +60,18 @@ #define QV_ARM_ERRATUM_838869() \ __asm volatile ("dsb 0xf" ::: "memory") -#endif /* ARMv7-M or higher */ +#endif + +/* initialization of the QV kernel */ +#define QV_INIT() QV_init() +void QV_init(void); + +#if (__ARM_FP != 0) /* if VFP available... */ +/* When the FPU is configured, clear the FPCA bit in the CONTROL register +* to prevent wasting the stack space for the FPU context. +*/ +#define QV_START() __asm volatile ("msr CONTROL,%0" :: "r" (0) : ) +#endif #include "qv.h" /* QV platform-independent public interface */ diff --git a/ports/arm-cm/qv/iar/qv_port.c b/ports/arm-cm/qv/iar/qv_port.c index f493d16a..16f7f8c1 100644 --- a/ports/arm-cm/qv/iar/qv_port.c +++ b/ports/arm-cm/qv/iar/qv_port.c @@ -23,66 +23,30 @@ * ============================================================================*/ /*! -* @date Last updated on: 2022-05-13 -* @version Last updated for: @ref qpcpp_7_0_1 +* @date Last updated on: 2022-12-18 +* @version Last updated for: @ref qpc_7_2_0 * * @file * @brief QV/C port to ARM Cortex-M, IAR-ARM toolset */ -/* This QV port is part of the interanl QP implementation */ +/* This QV port is part of the internal QP implementation */ #define QP_IMPL 1U #include "qf_port.h" -#if (__ARM_ARCH == 6) /* ARMv6-M? */ +#define SCnSCB_ICTR ((uint32_t volatile *)0xE000E004U) +#define SCB_SYSPRI ((uint32_t volatile *)0xE000ED14U) +#define NVIC_IP ((uint32_t volatile *)0xE000E400U) +#define FPU_FPCCR *((uint32_t volatile *)0xE000EF34U) -/* hand-optimized quick LOG2 in assembly (no CLZ instruction in ARMv6-M) */ -uint_fast8_t QF_qlog2(uint32_t x) { - static uint8_t const log2LUT[16] = { - 0U, 1U, 2U, 2U, 3U, 3U, 3U, 3U, - 4U, 4U, 4U, 4U, 4U, 4U, 4U, 4U - }; - uint_fast8_t n; - __asm ( - "MOVS %[n],#0\n" -#if (QF_MAX_ACTIVE > 16U) - "LSRS r2,r0,#16\n" - "BEQ.N QF_qlog2_1\n" - "MOVS %[n],#16\n" - "MOVS r0,r2\n" - "QF_qlog2_1:\n" -#endif -#if (QF_MAX_ACTIVE > 8U) - "LSRS r2,r0,#8\n" - "BEQ.N QF_qlog2_2\n" - "ADDS %[n],%[n],#8\n" - "MOVS r0,r2\n" - "QF_qlog2_2:\n" -#endif - "LSRS r2,r0,#4\n" - "BEQ.N QF_qlog2_3\n" - "ADDS %[n],%[n],#4\n" - "MOVS r0,r2\n" - "QF_qlog2_3:" - : [n]"=r"(n) - ); - return n + log2LUT[x]; -} - -#else /* ARMv7-M or higher */ - -#define SCnSCB_ICTR ((uint32_t volatile *)0xE000E004) -#define SCB_SYSPRI ((uint32_t volatile *)0xE000ED14) -#define NVIC_IP ((uint32_t volatile *)0xE000E400) - -/* -* Initialize the exception priorities and IRQ priorities to safe values. +/*..........................................................................*/ +/* Initialize the exception priorities and IRQ priorities to safe values. * * Description: -* On Cortex-M3/M4/M7, this QV port disables interrupts by means of the +* On ARMv7-M or higher, this QK port disables interrupts by means of the * BASEPRI register. However, this method cannot disable interrupt * priority zero, which is the default for all interrupts out of reset. * The following code changes the SysTick priority and all IRQ priorities -* to the safe value QF_BASEPRI, wich the QF critical section can disable. +* to the safe value QF_BASEPRI, which the QF critical section can disable. * This avoids breaching of the QF critical sections in case the * application programmer forgets to explicitly set priorities of all * "kernel aware" interrupts. @@ -91,29 +55,75 @@ uint_fast8_t QF_qlog2(uint32_t x) { * changed by the application-level code. */ void QV_init(void) { - uint32_t n; + +#if (__ARM_ARCH != 6) /*--------- if ARMv7-M and higher... */ /* set exception priorities to QF_BASEPRI... * SCB_SYSPRI1: Usage-fault, Bus-fault, Memory-fault */ SCB_SYSPRI[1] = (SCB_SYSPRI[1] - | (QF_BASEPRI << 16) | (QF_BASEPRI << 8) | QF_BASEPRI); + | (QF_BASEPRI << 16U) | (QF_BASEPRI << 8U) | QF_BASEPRI); /* SCB_SYSPRI2: SVCall */ - SCB_SYSPRI[2] = (SCB_SYSPRI[2] | (QF_BASEPRI << 24)); + SCB_SYSPRI[2] = (SCB_SYSPRI[2] | (QF_BASEPRI << 24U)); /* SCB_SYSPRI3: SysTick, PendSV, Debug */ SCB_SYSPRI[3] = (SCB_SYSPRI[3] - | (QF_BASEPRI << 24) | (QF_BASEPRI << 16) | QF_BASEPRI); + | (QF_BASEPRI << 24U) | (QF_BASEPRI << 16U) | QF_BASEPRI); /* set all implemented IRQ priories to QF_BASEPRI... */ - n = 8U + ((*SCnSCB_ICTR & 0x7U) << 3); /* (# NVIC_PRIO registers)/4 */ - do { - --n; - NVIC_IP[n] = (QF_BASEPRI << 24) | (QF_BASEPRI << 16) - | (QF_BASEPRI << 8) | QF_BASEPRI; - } while (n != 0); + uint8_t nprio = (8U + ((*SCnSCB_ICTR & 0x7U) << 3U)) * 4U; + for (uint8_t n = 0U; n < nprio; ++n) { + NVIC_IP[n] = QF_BASEPRI; + } + +#endif /*--------- ARMv7-M or higher */ + + /* SCB_SYSPRI3: PendSV set to priority 0xFF (lowest) */ + SCB_SYSPRI[3] = (SCB_SYSPRI[3] | (0xFFU << 16U)); + +#if (__ARM_FP != 0) /*--------- if VFP available... */ + /* configure the FPU for QK */ + FPU_FPCCR |= (1U << 30U) /* automatic FPU state preservation (ASPEN) */ + | (1U << 31U); /* lazy stacking (LSPEN) */ +#endif /*--------- VFP available */ } -#endif /* ARMv7-M or higher */ +/*==========================================================================*/ +#if (__ARM_ARCH == 6) /* if ARMv6-M... */ + +/* hand-optimized quick LOG2 in assembly (no CLZ instruction in ARMv6-M) */ +uint_fast8_t QF_qlog2(uint32_t x) { + static uint8_t const log2LUT[16] = { + 0U, 1U, 2U, 2U, 3U, 3U, 3U, 3U, + 4U, 4U, 4U, 4U, 4U, 4U, 4U, 4U + }; + uint_fast8_t n; + +__asm volatile ( + " MOVS %[n],#0 \n" +#if (QF_MAX_ACTIVE > 16U) + " LSRS r2,r0,#16 \n" + " BEQ QF_qlog2_1 \n" + " MOVS %[n],#16 \n" + " MOVS r0,r2 \n" + "QF_qlog2_1: \n" +#endif +#if (QF_MAX_ACTIVE > 8U) + " LSRS r2,r0,#8 \n" + " BEQ QF_qlog2_2 \n" + " ADDS %[n],%[n],#8 \n" + " MOVS r0,r2 \n" + "QF_qlog2_2: \n" +#endif + " LSRS r2,r0,#4 \n" + " BEQ.N QF_qlog2_3 \n" + " ADDS %[n],%[n],#4 \n" + " MOVS r0,r2 \n" + "QF_qlog2_3:" : [n]"=r"(n) +); + return n + log2LUT[x]; +} + +#endif /* ARMv6-M */ diff --git a/ports/arm-cm/qv/iar/qv_port.h b/ports/arm-cm/qv/iar/qv_port.h index 629a6cd5..ddd28754 100644 --- a/ports/arm-cm/qv/iar/qv_port.h +++ b/ports/arm-cm/qv/iar/qv_port.h @@ -23,8 +23,8 @@ * ============================================================================*/ /*! -* @date Last updated on: 2022-06-12 -* @version Last updated for: @ref qpc_7_0_1 +* @date Last updated on: 2022-12-18 +* @version Last updated for: @ref qpc_7_2_0 * * @file * @brief QV/C port to ARM Cortex-M, IAR-ARM toolset @@ -32,7 +32,7 @@ #ifndef QV_PORT_H #define QV_PORT_H -#if (__CORE__ == __ARM6M__) /* Cortex-M0/M0+/M1 ? */ +#if (__ARM_ARCH == 6) /* ARMv6-M? */ /* macro to put the CPU to sleep inside QV_onIdle() */ #define QV_CPU_SLEEP() do { \ @@ -42,7 +42,7 @@ #define QV_ARM_ERRATUM_838869() ((void)0) -#else /* Cortex-M3/M4/M7(v7-M) */ +#else /* ARMv7-M or higher */ /* macro to put the CPU to sleep inside QV_onIdle() */ #define QV_CPU_SLEEP() do { \ @@ -52,10 +52,6 @@ QF_PRIMASK_ENABLE(); \ } while (false) - /* initialization of the QV kernel for Cortex-M3/M4/M4F */ - #define QV_INIT() QV_init() - void QV_init(void); - /* The following macro implements the recommended workaround for the * ARM Erratum 838869. Specifically, for Cortex-M3/M4/M7 the DSB * (memory barrier) instruction needs to be added before exiting an ISR. @@ -65,6 +61,17 @@ #endif +/* initialization of the QV kernel */ +#define QV_INIT() QV_init() +void QV_init(void); + +#if (__ARM_FP != 0) /* if VFP available... */ +/* When the FPU is configured, clear the FPCA bit in the CONTROL register +* to prevent wasting the stack space for the FPU context. +*/ +#define QV_START() __set_CONTROL(0U) +#endif + #include "qv.h" /* QV platform-independent public interface */ #endif /* QV_PORT_H */ diff --git a/ports/arm-cm/qxk/armclang/qxk_port.c b/ports/arm-cm/qxk/armclang/qxk_port.c index ec3edcf2..fc005235 100644 --- a/ports/arm-cm/qxk/armclang/qxk_port.c +++ b/ports/arm-cm/qxk/armclang/qxk_port.c @@ -23,8 +23,8 @@ * ============================================================================*/ /*! -* @date Last updated on: 2022-10-04 -* @version Last updated for: @ref qpc_7_1_2 +* @date Last updated on: 2022-12-18 +* @version Last updated for: @ref qpc_7_2_0 * * @file * @brief QXK/C port to ARM Cortex-M, ARM-CLANG toolset @@ -49,11 +49,12 @@ void NMI_Handler(void); #define SCB_SYSPRI ((uint32_t volatile *)0xE000ED14) #define NVIC_EN ((uint32_t volatile *)0xE000E100) #define NVIC_IP ((uint8_t volatile *)0xE000E400) +#define FPU_FPCCR *((uint32_t volatile *)0xE000EF34) #define NVIC_PEND 0xE000E200 #define NVIC_ICSR 0xE000ED04 -/* -* Initialize the exception priorities and IRQ priorities to safe values. +/*..........................................................................*/ +/* Initialize the exception priorities and IRQ priorities to safe values. * * Description: * On ARMv7-M or higher, this QXK port disables interrupts by means of the @@ -70,39 +71,45 @@ void NMI_Handler(void); */ void QXK_init(void) { -#if (__ARM_ARCH != 6) /* if ARMv7-M or higher... */ +#if (__ARM_ARCH != 6) /*--------- if ARMv7-M and higher... */ /* set exception priorities to QF_BASEPRI... * SCB_SYSPRI1: Usage-fault, Bus-fault, Memory-fault */ SCB_SYSPRI[1] = (SCB_SYSPRI[1] - | (QF_BASEPRI << 16) | (QF_BASEPRI << 8) | QF_BASEPRI); + | (QF_BASEPRI << 16U) | (QF_BASEPRI << 8U) | QF_BASEPRI); /* SCB_SYSPRI2: SVCall */ - SCB_SYSPRI[2] = (SCB_SYSPRI[2] | (QF_BASEPRI << 24)); + SCB_SYSPRI[2] = (SCB_SYSPRI[2] | (QF_BASEPRI << 24U)); /* SCB_SYSPRI3: SysTick, PendSV, Debug */ SCB_SYSPRI[3] = (SCB_SYSPRI[3] - | (QF_BASEPRI << 24) | (QF_BASEPRI << 16) | QF_BASEPRI); + | (QF_BASEPRI << 24U) | (QF_BASEPRI << 16U) | QF_BASEPRI); /* set all implemented IRQ priories to QF_BASEPRI... */ - uint8_t nprio = (8U + ((*SCnSCB_ICTR & 0x7U) << 3U))*4; + uint8_t nprio = (8U + ((*SCnSCB_ICTR & 0x7U) << 3U)) * 4U; for (uint8_t n = 0U; n < nprio; ++n) { NVIC_IP[n] = QF_BASEPRI; } -#endif /* ARMv7-M or higher */ +#endif /*--------- ARMv7-M or higher */ /* SCB_SYSPRI3: PendSV set to priority 0xFF (lowest) */ SCB_SYSPRI[3] = (SCB_SYSPRI[3] | (0xFFU << 16U)); -#ifdef QXK_USE_IRQ_NUM +#ifdef QXK_USE_IRQ_NUM /*--------- QXK IRQ specified? */ /* The QXK port is configured to use a given ARM Cortex-M IRQ # * to return to thread mode (default is to use the NMI exception) */ NVIC_IP[QXK_USE_IRQ_NUM] = 0U; /* priority 0 (highest) */ NVIC_EN[QXK_USE_IRQ_NUM / 32U] = (1U << (QXK_USE_IRQ_NUM % 32U)); -#endif +#endif /*--------- QXK IRQ specified */ + +#if (__ARM_FP != 0) /*--------- if VFP available... */ + /* configure the FPU for QK */ + FPU_FPCCR |= (1U << 30U) /* automatic FPU state preservation (ASPEN) */ + | (1U << 31U); /* lazy stacking (LSPEN) */ +#endif /*--------- VFP available */ } /*==========================================================================*/ @@ -363,14 +370,14 @@ __asm volatile ( " STR r0,[r3,#" STRINGIFY(QXK_CURR) "]\n" /* QXK_attr_.curr := 0 */ " STR r0,[r3,#" STRINGIFY(QXK_NEXT) "]\n" /* QXK_attr_.next := 0 */ -#if defined(Q_SPY) || defined(QXK_ON_CONTEXT_SW) +#if defined(Q_SPY) || defined(QF_ON_CONTEXT_SW) " MOVS r0,#0 \n" /* r0 := 0 (next is basic) */ " PUSH {r3,lr} \n" /* save QXK_attr_ + exception lr */ " LDR r3,=QXK_contextSw \n" " BLX r3 \n" /* call QXK_contextSw() */ " POP {r0,r1} \n" /* restore the aligner + lr into r1 */ " MOV lr,r1 \n" /* restore the exception lr */ -#endif /* defined(Q_SPY) || defined(QXK_ON_CONTEXT_SW) */ +#endif /* defined(Q_SPY) || defined(QF_ON_CONTEXT_SW) */ /* re-enable interrupts and return from PendSV */ "PendSV_return: \n" @@ -436,7 +443,7 @@ __asm volatile ( * r12 -> QXK_attr_.next / basic-thread */ "PendSV_restore_ex: \n" -#if defined(Q_SPY) || defined(QXK_ON_CONTEXT_SW) +#if defined(Q_SPY) || defined(QF_ON_CONTEXT_SW) " MOV r0,r12 \n" /* r0 := next */ " PUSH {r3,lr} \n" /* save QXK_attr_ + exception lr */ " LDR r3,=QXK_contextSw \n" @@ -448,7 +455,7 @@ __asm volatile ( /* restore the AAPCS-clobbered registers after a functin call... */ " LDR r0,[r3,#" STRINGIFY(QXK_NEXT) "]\n" /* r0 := QXK_attr_.next */ " LDR r2,[r0,#" STRINGIFY(QACTIVE_OSOBJ) "]\n" /* r2 := QXK_attr_.curr->osObject */ -#endif /* defined(Q_SPY) || defined(QXK_ON_CONTEXT_SW) */ +#endif /* defined(Q_SPY) || defined(QF_ON_CONTEXT_SW) */ " STR r0,[r3,#" STRINGIFY(QXK_CURR) "]\n" /* QXK_attr_.curr := r0 (QXK_attr_.next) */ " MOVS r0,#0 \n" @@ -501,7 +508,7 @@ __asm volatile ( * NOTE: QXK_thread_ret does not execute in the PendSV context! * NOTE: QXK_thread_ret is entered with interrupts DISABLED. */ -__attribute__ ((naked)) +__attribute__ ((naked, used)) void QXK_thread_ret(void) { __asm volatile ( @@ -592,7 +599,7 @@ __asm volatile ( /*==========================================================================*/ #if (__ARM_ARCH == 6) /* if ARMv6-M... */ -/* hand-optimized quick LOG2 in assembly (No CLZ instruction in ARMv6-M) */ +/* hand-optimized quick LOG2 in assembly (no CLZ instruction in ARMv6-M) */ __attribute__ ((naked)) uint_fast8_t QF_qlog2(uint32_t x) { __asm volatile ( diff --git a/ports/arm-cm/qxk/armclang/qxk_port.h b/ports/arm-cm/qxk/armclang/qxk_port.h index d07251f7..1211ac52 100644 --- a/ports/arm-cm/qxk/armclang/qxk_port.h +++ b/ports/arm-cm/qxk/armclang/qxk_port.h @@ -23,8 +23,8 @@ * ============================================================================*/ /*! -* @date Last updated on: 2022-09-25 -* @version Last updated for: @ref qpc_7_1_1 +* @date Last updated on: 2022-12-18 +* @version Last updated for: @ref qpc_7_2_0 * * @file * @brief QXK/C port to ARM Cortex-M, ARM-CLANG compiler @@ -86,6 +86,13 @@ static inline uint32_t QXK_get_IPSR(void) { void QXK_init(void); void QXK_thread_ret(void); +#if (__ARM_FP != 0) /* if VFP available... */ +/* When the FPU is configured, clear the FPCA bit in the CONTROL register +* to prevent wasting the stack space for the FPU context. +*/ +#define QXK_START() __asm volatile ("msr CONTROL,%0" :: "r" (0) : ) +#endif + #include "qxk.h" /* QXK platform-independent public interface */ #endif /* QXK_PORT_H */ diff --git a/ports/arm-cm/qxk/gnu/qxk_port.c b/ports/arm-cm/qxk/gnu/qxk_port.c index 32b12447..31e98726 100644 --- a/ports/arm-cm/qxk/gnu/qxk_port.c +++ b/ports/arm-cm/qxk/gnu/qxk_port.c @@ -23,8 +23,8 @@ * ============================================================================*/ /*! -* @date Last updated on: 2022-10-04 -* @version Last updated for: @ref qpc_7_1_2 +* @date Last updated on: 2022-12-18 +* @version Last updated for: @ref qpc_7_2_0 * * @file * @brief QXK/C port to ARM Cortex-M, GNU-ARM toolset @@ -45,18 +45,19 @@ void QXK_USE_IRQ_HANDLER(void); void NMI_Handler(void); #endif -#define SCnSCB_ICTR ((uint32_t volatile *)0xE000E004) -#define SCB_SYSPRI ((uint32_t volatile *)0xE000ED14) -#define NVIC_EN ((uint32_t volatile *)0xE000E100) -#define NVIC_IP ((uint8_t volatile *)0xE000E400) +#define SCnSCB_ICTR ((uint32_t volatile *)0xE000E004U) +#define SCB_SYSPRI ((uint32_t volatile *)0xE000ED14U) +#define NVIC_EN ((uint32_t volatile *)0xE000E100U) +#define NVIC_IP ((uint8_t volatile *)0xE000E400U) +#define FPU_FPCCR *((uint32_t volatile *)0xE000EF34U) #define NVIC_PEND 0xE000E200 #define NVIC_ICSR 0xE000ED04 -/* -* Initialize the exception priorities and IRQ priorities to safe values. +/*..........................................................................*/ +/* Initialize the exception priorities and IRQ priorities to safe values. * * Description: -* On Cortex-M3/M4/M7, this QXK port disables interrupts by means of the +* On ARMv7-M or higher, this QXK port disables interrupts by means of the * BASEPRI register. However, this method cannot disable interrupt * priority zero, which is the default for all interrupts out of reset. * The following code changes the SysTick priority and all IRQ priorities @@ -70,39 +71,45 @@ void NMI_Handler(void); */ void QXK_init(void) { -#if (__ARM_ARCH != 6) /* if ARMv7-M or higher... */ +#if (__ARM_ARCH != 6) /*--------- if ARMv7-M and higher... */ /* set exception priorities to QF_BASEPRI... * SCB_SYSPRI1: Usage-fault, Bus-fault, Memory-fault */ SCB_SYSPRI[1] = (SCB_SYSPRI[1] - | (QF_BASEPRI << 16) | (QF_BASEPRI << 8) | QF_BASEPRI); + | (QF_BASEPRI << 16U) | (QF_BASEPRI << 8U) | QF_BASEPRI); /* SCB_SYSPRI2: SVCall */ - SCB_SYSPRI[2] = (SCB_SYSPRI[2] | (QF_BASEPRI << 24)); + SCB_SYSPRI[2] = (SCB_SYSPRI[2] | (QF_BASEPRI << 24U)); /* SCB_SYSPRI3: SysTick, PendSV, Debug */ SCB_SYSPRI[3] = (SCB_SYSPRI[3] - | (QF_BASEPRI << 24) | (QF_BASEPRI << 16) | QF_BASEPRI); + | (QF_BASEPRI << 24U) | (QF_BASEPRI << 16U) | QF_BASEPRI); /* set all implemented IRQ priories to QF_BASEPRI... */ - uint8_t nprio = (8U + ((*SCnSCB_ICTR & 0x7U) << 3U))*4; + uint8_t nprio = (8U + ((*SCnSCB_ICTR & 0x7U) << 3U)) * 4U; for (uint8_t n = 0U; n < nprio; ++n) { NVIC_IP[n] = QF_BASEPRI; } -#endif /* ARMv7-M or higher */ +#endif /*--------- ARMv7-M or higher */ /* SCB_SYSPRI3: PendSV set to priority 0xFF (lowest) */ SCB_SYSPRI[3] = (SCB_SYSPRI[3] | (0xFFU << 16U)); -#ifdef QXK_USE_IRQ_NUM +#ifdef QXK_USE_IRQ_NUM /*--------- QXK IRQ specified? */ /* The QXK port is configured to use a given ARM Cortex-M IRQ # * to return to thread mode (default is to use the NMI exception) */ NVIC_IP[QXK_USE_IRQ_NUM] = 0U; /* priority 0 (highest) */ NVIC_EN[QXK_USE_IRQ_NUM / 32U] = (1U << (QXK_USE_IRQ_NUM % 32U)); -#endif +#endif /*--------- QXK IRQ specified */ + +#if (__ARM_FP != 0) /*--------- if VFP available... */ + /* configure the FPU for QK */ + FPU_FPCCR |= (1U << 30U) /* automatic FPU state preservation (ASPEN) */ + | (1U << 31U); /* lazy stacking (LSPEN) */ +#endif /*--------- VFP available */ } /*==========================================================================*/ @@ -368,14 +375,14 @@ __asm volatile ( " STR r0,[r3,#" STRINGIFY(QXK_CURR) "]\n" /* QXK_attr_.curr := 0 */ " STR r0,[r3,#" STRINGIFY(QXK_NEXT) "]\n" /* QXK_attr_.next := 0 */ -#if defined(Q_SPY) || defined(QXK_ON_CONTEXT_SW) +#if defined(Q_SPY) || defined(QF_ON_CONTEXT_SW) " MOV r0,#0 \n" /* r0 := 0 (next is basic) */ " PUSH {r3,lr} \n" /* save QXK_attr_ + exception lr */ " LDR r3,=QXK_contextSw \n" " BLX r3 \n" /* call QXK_contextSw() */ " POP {r0,r1} \n" /* restore the aligner + lr into r1 */ " MOV lr,r1 \n" /* restore the exception lr */ -#endif /* defined(Q_SPY) || defined(QXK_ON_CONTEXT_SW) */ +#endif /* defined(Q_SPY) || defined(QF_ON_CONTEXT_SW) */ /* re-enable interrupts and return from PendSV */ "PendSV_return: \n" @@ -441,7 +448,7 @@ __asm volatile ( * r12 -> QXK_attr_.next / basic-thread */ "PendSV_restore_ex: \n" -#if defined(Q_SPY) || defined(QXK_ON_CONTEXT_SW) +#if defined(Q_SPY) || defined(QF_ON_CONTEXT_SW) " MOV r0,r12 \n" /* r0 := next */ " PUSH {r3,lr} \n" /* save QXK_attr_ + exception lr */ " LDR r3,=QXK_contextSw \n" @@ -453,7 +460,7 @@ __asm volatile ( /* restore the AAPCS-clobbered registers after a functin call... */ " LDR r0,[r3,#" STRINGIFY(QXK_NEXT) "]\n" /* r0 := QXK_attr_.next */ " LDR r2,[r0,#" STRINGIFY(QACTIVE_OSOBJ) "]\n" /* r2 := QXK_attr_.curr->osObject */ -#endif /* defined(Q_SPY) || defined(QXK_ON_CONTEXT_SW) */ +#endif /* defined(Q_SPY) || defined(QF_ON_CONTEXT_SW) */ " STR r0,[r3,#" STRINGIFY(QXK_CURR) "]\n" /* QXK_attr_.curr := r0 (QXK_attr_.next) */ " MOV r0,#0 \n" @@ -506,7 +513,7 @@ __asm volatile ( * NOTE: QXK_thread_ret does not execute in the PendSV context! * NOTE: QXK_thread_ret is entered with interrupts DISABLED. */ -__attribute__ ((naked, optimize("-fno-stack-protector"))) +__attribute__ ((naked, used, optimize("-fno-stack-protector"))) void QXK_thread_ret(void) { __asm volatile ( @@ -597,12 +604,12 @@ __asm volatile ( /*==========================================================================*/ #if (__ARM_ARCH == 6) /* if ARMv6-M... */ -/* hand-optimized quick LOG2 in assembly (No CLZ instruction in ARMv6-M) */ +/* hand-optimized quick LOG2 in assembly (no CLZ instruction in ARMv6-M) */ /* * NOTE: * The inline GNU assembler does not accept mnemonics MOVS, LSRS and ADDS, -* but for Cortex-M0/M0+/M1 the mnemonics MOV, LSR and ADD always set the -* condition flags in the PSR. +* but for ARMv6-M the mnemonics MOV, LSR and ADD always set the condition +* flags in the PSR. */ __attribute__ ((naked, optimize("-fno-stack-protector"))) uint_fast8_t QF_qlog2(uint32_t x) { @@ -638,3 +645,4 @@ __asm volatile ( } #endif /* ARMv6-M */ + diff --git a/ports/arm-cm/qxk/gnu/qxk_port.h b/ports/arm-cm/qxk/gnu/qxk_port.h index 5ced18b2..d6c2bdf6 100644 --- a/ports/arm-cm/qxk/gnu/qxk_port.h +++ b/ports/arm-cm/qxk/gnu/qxk_port.h @@ -23,8 +23,8 @@ * ============================================================================*/ /*! -* @date Last updated on: 2022-09-25 -* @version Last updated for: @ref qpc_7_1_1 +* @date Last updated on: 2022-12-18 +* @version Last updated for: @ref qpc_7_2_0 * * @file * @brief QXK/C port to ARM Cortex-M, GNU-ARM compiler @@ -86,6 +86,13 @@ static inline uint32_t QXK_get_IPSR(void) { void QXK_init(void); void QXK_thread_ret(void); +#if (__ARM_FP != 0) /* if VFP available... */ +/* When the FPU is configured, clear the FPCA bit in the CONTROL register +* to prevent wasting the stack space for the FPU context. +*/ +#define QXK_START() __asm volatile ("msr CONTROL,%0" :: "r" (0) : ) +#endif + #include "qxk.h" /* QXK platform-independent public interface */ #endif /* QXK_PORT_H */ diff --git a/ports/arm-cm/qxk/iar/qxk_port.c b/ports/arm-cm/qxk/iar/qxk_port.c index fcdfc748..e89ec87d 100644 --- a/ports/arm-cm/qxk/iar/qxk_port.c +++ b/ports/arm-cm/qxk/iar/qxk_port.c @@ -23,8 +23,8 @@ * ============================================================================*/ /*! -* @date Last updated on: 2022-10-04 -* @version Last updated for: @ref qpc_7_1_2 +* @date Last updated on: 2022-12-18 +* @version Last updated for: @ref qpc_7_2_0 * * @file * @brief QXK/C port to ARM Cortex-M, IAR-ARM toolset @@ -45,18 +45,19 @@ void QXK_USE_IRQ_HANDLER(void); void NMI_Handler(void); #endif -#define SCnSCB_ICTR ((uint32_t volatile *)0xE000E004) -#define SCB_SYSPRI ((uint32_t volatile *)0xE000ED14) -#define NVIC_EN ((uint32_t volatile *)0xE000E100) -#define NVIC_IP ((uint8_t volatile *)0xE000E400) +#define SCnSCB_ICTR ((uint32_t volatile *)0xE000E004U) +#define SCB_SYSPRI ((uint32_t volatile *)0xE000ED14U) +#define NVIC_EN ((uint32_t volatile *)0xE000E100U) +#define NVIC_IP ((uint8_t volatile *)0xE000E400U) +#define FPU_FPCCR *((uint32_t volatile *)0xE000EF34U) #define NVIC_PEND 0xE000E200 #define NVIC_ICSR 0xE000ED04 -/* -* Initialize the exception priorities and IRQ priorities to safe values. +/*..........................................................................*/ +/* Initialize the exception priorities and IRQ priorities to safe values. * * Description: -* On Cortex-M3/M4/M7, this QXK port disables interrupts by means of the +* On ARMv7-M or higher, this QXK port disables interrupts by means of the * BASEPRI register. However, this method cannot disable interrupt * priority zero, which is the default for all interrupts out of reset. * The following code changes the SysTick priority and all IRQ priorities @@ -70,39 +71,45 @@ void NMI_Handler(void); */ void QXK_init(void) { -#if (__ARM_ARCH != 6) /* if ARMv7-M or higher... */ +#if (__ARM_ARCH != 6) /*--------- if ARMv7-M and higher... */ /* set exception priorities to QF_BASEPRI... * SCB_SYSPRI1: Usage-fault, Bus-fault, Memory-fault */ SCB_SYSPRI[1] = (SCB_SYSPRI[1] - | (QF_BASEPRI << 16) | (QF_BASEPRI << 8) | QF_BASEPRI); + | (QF_BASEPRI << 16U) | (QF_BASEPRI << 8U) | QF_BASEPRI); /* SCB_SYSPRI2: SVCall */ - SCB_SYSPRI[2] = (SCB_SYSPRI[2] | (QF_BASEPRI << 24)); + SCB_SYSPRI[2] = (SCB_SYSPRI[2] | (QF_BASEPRI << 24U)); /* SCB_SYSPRI3: SysTick, PendSV, Debug */ SCB_SYSPRI[3] = (SCB_SYSPRI[3] - | (QF_BASEPRI << 24) | (QF_BASEPRI << 16) | QF_BASEPRI); + | (QF_BASEPRI << 24U) | (QF_BASEPRI << 16U) | QF_BASEPRI); /* set all implemented IRQ priories to QF_BASEPRI... */ - uint8_t nprio = (8U + ((*SCnSCB_ICTR & 0x7U) << 3U))*4; + uint8_t nprio = (8U + ((*SCnSCB_ICTR & 0x7U) << 3U)) * 4U; for (uint8_t n = 0U; n < nprio; ++n) { NVIC_IP[n] = QF_BASEPRI; } -#endif /* ARMv7-M or higher */ +#endif /*--------- ARMv7-M or higher */ /* SCB_SYSPRI3: PendSV set to priority 0xFF (lowest) */ SCB_SYSPRI[3] = (SCB_SYSPRI[3] | (0xFFU << 16U)); -#ifdef QXK_USE_IRQ_NUM +#ifdef QXK_USE_IRQ_NUM /*--------- QXK IRQ specified? */ /* The QXK port is configured to use a given ARM Cortex-M IRQ # * to return to thread mode (default is to use the NMI exception) */ NVIC_IP[QXK_USE_IRQ_NUM] = 0U; /* priority 0 (highest) */ NVIC_EN[QXK_USE_IRQ_NUM / 32U] = (1U << (QXK_USE_IRQ_NUM % 32U)); -#endif +#endif /*--------- QXK IRQ specified */ + +#if (__ARM_FP != 0) /*--------- if VFP available... */ + /* configure the FPU for QK */ + FPU_FPCCR |= (1U << 30U) /* automatic FPU state preservation (ASPEN) */ + | (1U << 31U); /* lazy stacking (LSPEN) */ +#endif /*--------- VFP available */ } /*==========================================================================*/ @@ -363,14 +370,14 @@ __asm volatile ( " STR r0,[r3,#" STRINGIFY(QXK_CURR) "]\n" /* QXK_attr_.curr := 0 */ " STR r0,[r3,#" STRINGIFY(QXK_NEXT) "]\n" /* QXK_attr_.next := 0 */ -#if defined(Q_SPY) || defined(QXK_ON_CONTEXT_SW) +#if defined(Q_SPY) || defined(QF_ON_CONTEXT_SW) " MOVS r0,#0 \n" /* r0 := 0 (next is basic) */ " PUSH {r3,lr} \n" /* save QXK_attr_ + exception lr */ " LDR r3,=QXK_contextSw \n" " BLX r3 \n" /* call QXK_contextSw() */ " POP {r0,r1} \n" /* restore the aligner + lr into r1 */ " MOV lr,r1 \n" /* restore the exception lr */ -#endif /* defined(Q_SPY) || defined(QXK_ON_CONTEXT_SW) */ +#endif /* defined(Q_SPY) || defined(QF_ON_CONTEXT_SW) */ /* re-enable interrupts and return from PendSV */ "PendSV_return: \n" @@ -436,7 +443,7 @@ __asm volatile ( * r12 -> QXK_attr_.next / basic-thread */ "PendSV_restore_ex: \n" -#if defined(Q_SPY) || defined(QXK_ON_CONTEXT_SW) +#if defined(Q_SPY) || defined(QF_ON_CONTEXT_SW) " MOV r0,r12 \n" /* r0 := next */ " PUSH {r3,lr} \n" /* save QXK_attr_ + exception lr */ " LDR r3,=QXK_contextSw \n" @@ -448,7 +455,7 @@ __asm volatile ( /* restore the AAPCS-clobbered registers after a functin call... */ " LDR r0,[r3,#" STRINGIFY(QXK_NEXT) "]\n" /* r0 := QXK_attr_.next */ " LDR r2,[r0,#" STRINGIFY(QACTIVE_OSOBJ) "]\n" /* r2 := QXK_attr_.curr->osObject */ -#endif /* defined(Q_SPY) || defined(QXK_ON_CONTEXT_SW) */ +#endif /* defined(Q_SPY) || defined(QF_ON_CONTEXT_SW) */ " STR r0,[r3,#" STRINGIFY(QXK_CURR) "]\n" /* QXK_attr_.curr := r0 (QXK_attr_.next) */ " MOVS r0,#0 \n" @@ -596,36 +603,36 @@ __asm volatile ( /*==========================================================================*/ #if (__ARM_ARCH == 6) /* if ARMv6-M... */ -/* hand-optimized quick LOG2 in assembly (No CLZ instruction in ARMv6-M) */ +/* hand-optimized quick LOG2 in assembly (no CLZ instruction in ARMv6-M) */ uint_fast8_t QF_qlog2(uint32_t x) { static uint8_t const log2LUT[16] = { 0U, 1U, 2U, 2U, 3U, 3U, 3U, 3U, 4U, 4U, 4U, 4U, 4U, 4U, 4U, 4U }; uint_fast8_t n; - __asm ( - "MOVS %[n],#0\n" + +__asm volatile ( + " MOVS %[n],#0 \n" #if (QF_MAX_ACTIVE > 16U) - "LSRS r2,r0,#16\n" - "BEQ.N QF_qlog2_1\n" - "MOVS %[n],#16\n" - "MOVS r0,r2\n" - "QF_qlog2_1:\n" + " LSRS r2,r0,#16 \n" + " BEQ QF_qlog2_1 \n" + " MOVS %[n],#16 \n" + " MOVS r0,r2 \n" + "QF_qlog2_1: \n" #endif #if (QF_MAX_ACTIVE > 8U) - "LSRS r2,r0,#8\n" - "BEQ.N QF_qlog2_2\n" - "ADDS %[n],%[n],#8\n" - "MOVS r0,r2\n" - "QF_qlog2_2:\n" + " LSRS r2,r0,#8 \n" + " BEQ QF_qlog2_2 \n" + " ADDS %[n],%[n],#8 \n" + " MOVS r0,r2 \n" + "QF_qlog2_2: \n" #endif - "LSRS r2,r0,#4\n" - "BEQ.N QF_qlog2_3\n" - "ADDS %[n],%[n],#4\n" - "MOVS r0,r2\n" - "QF_qlog2_3:" - : [n]"=r"(n) - ); + " LSRS r2,r0,#4 \n" + " BEQ.N QF_qlog2_3 \n" + " ADDS %[n],%[n],#4 \n" + " MOVS r0,r2 \n" + "QF_qlog2_3:" : [n]"=r"(n) +); return n + log2LUT[x]; } diff --git a/ports/arm-cm/qxk/iar/qxk_port.h b/ports/arm-cm/qxk/iar/qxk_port.h index 6374a203..ff5ce794 100644 --- a/ports/arm-cm/qxk/iar/qxk_port.h +++ b/ports/arm-cm/qxk/iar/qxk_port.h @@ -23,8 +23,8 @@ * ============================================================================*/ /*! -* @date Last updated on: 2022-09-25 -* @version Last updated for: @ref qpc_7_1_1 +* @date Last updated on: 2022-12-18 +* @version Last updated for: @ref qpc_7_2_0 * * @file * @brief QXK/C port to ARM Cortex-M, IAR-ARM compiler @@ -78,6 +78,13 @@ void QXK_init(void); void QXK_thread_ret(void); +#if (__ARM_FP != 0) /* if VFP available... */ +/* When the FPU is configured, clear the FPCA bit in the CONTROL register +* to prevent wasting the stack space for the FPU context. +*/ +#define QXK_START() __set_CONTROL(0U) +#endif + #include "qxk.h" /* QXK platform-independent public interface */ #endif /* QXK_PORT_H */ diff --git a/ports/esp-idf/qf_port.c b/ports/esp-idf/qf_port.c index 9a284439..73140247 100644 --- a/ports/esp-idf/qf_port.c +++ b/ports/esp-idf/qf_port.c @@ -23,8 +23,8 @@ * ============================================================================*/ /*! -* @date Last updated on: 2022-11-22 -* @version Last updated for: @ref qpc_7_1_3 +* @date Last updated on: 2022-12-20 +* @version Last updated for: @ref qpc_7_2_0 * * @file * @brief "Experimental" QF/C port to Espressif ESP-IDF (version 4.x) @@ -616,7 +616,7 @@ void IRAM_ATTR QMPool_putFromISR(QMPool * const me, void *b, * the block pointer must be from this pool. */ Q_REQUIRE_ID(900, (me->nFree < me->nTot) - && QF_PTR_RANGE_(b, me->start, me->end)); + && (me->start <= b) && (b <= me->end)); (void)qs_id; /* unused parameter (outside Q_SPY build configuration) */ @@ -668,7 +668,7 @@ void *QMPool_getFromISR(QMPool * const me, uint_fast16_t const margin, * when the client code writes past the memory block, thus * corrupting the next block. */ - Q_ASSERT_ID(930, QF_PTR_RANGE_(fb_next, me->start, me->end)); + Q_ASSERT_ID(930, (me->start <= fb_next) && (fb_next <= me->end)); /* is the number of free blocks the new minimum so far? */ if (me->nMin > me->nFree) { diff --git a/ports/esp-idf/qf_port.h b/ports/esp-idf/qf_port.h index e819a9bf..301c3861 100644 --- a/ports/esp-idf/qf_port.h +++ b/ports/esp-idf/qf_port.h @@ -23,8 +23,8 @@ * ============================================================================*/ /*! -* @date Last updated on: 2022-10-19 -* @version Last updated for: @ref qpc_7_1_3 +* @date Last updated on: 2022-12-27 +* @version Last updated for: @ref qpc_7_2_0 * * @file * @brief "Experimental" QF/C port to Espressif ESP-IDF (version 4.x) @@ -132,11 +132,11 @@ void IRAM_ATTR QTimeEvt_tickFromISR_(uint_fast8_t const tickRate, #define Q_NEW_FROM_ISR(evtT_, sig_, ...) \ (evtT_##_ctor((evtT_ *)QF_newXFromISR_(sizeof(evtT_), \ - QF_NO_MARGIN, 0), (sig_), ##__VA_ARGS__)) + QF_NO_MARGIN, (sig_)), (sig_), ##__VA_ARGS__)) #define Q_NEW_X_FROM_ISR(e_, evtT_, margin_, sig_, ...) do { \ (e_) = (evtT_ *)QF_newXFromISR_(sizeof(evtT_), \ - (margin_), 0); \ + (margin_), (sig_)); \ if ((e_) != (evtT_ *)0) { \ evtT_##_ctor((e_), (sig_), ##__VA_ARGS__); \ } \ diff --git a/ports/freertos/qf_port.h b/ports/freertos/qf_port.h index 985cfbca..bf0d1af6 100644 --- a/ports/freertos/qf_port.h +++ b/ports/freertos/qf_port.h @@ -23,8 +23,8 @@ * ============================================================================*/ /*! -* @date Last updated on: 2022-07-30 -* @version Last updated for: @ref qpc_7_0_1 +* @date Last updated on: 2022-12-27 +* @version Last updated for: @ref qpc_7_2_0 * * @file * @brief QF/C port to FreeRTOS 10.x @@ -120,17 +120,17 @@ void QTimeEvt_tickFromISR_(uint_fast8_t const tickRate, #define Q_NEW_FROM_ISR(evtT_, sig_, ...) \ (evtT_##_ctor((evtT_ *)QF_newXFromISR_(sizeof(evtT_), \ - QF_NO_MARGIN, 0), (sig_), ##__VA_ARGS__)) + QF_NO_MARGIN, (sig_)), (sig_), ##__VA_ARGS__)) #define Q_NEW_X_FROM_ISR(e_, evtT_, margin_, sig_, ...) do { \ (e_) = (evtT_ *)QF_newXFromISR_(sizeof(evtT_), \ - (margin_), 0); \ + (margin_), (sig_)); \ if ((e_) != (evtT_ *)0) { \ evtT_##_ctor((e_), (sig_), ##__VA_ARGS__); \ } \ } while (false) -#else +#else /* no ::QEvt ctor */ #define Q_NEW_FROM_ISR(evtT_, sig_) \ ((evtT_ *)QF_newXFromISR_((uint_fast16_t)sizeof(evtT_), \ diff --git a/ports/lint-plus/qk/qk_port.h b/ports/lint-plus/qk/qk_port.h index 8d5aa01b..d6c8309b 100644 --- a/ports/lint-plus/qk/qk_port.h +++ b/ports/lint-plus/qk/qk_port.h @@ -23,8 +23,8 @@ * ============================================================================*/ /*! -* @date Last updated on: 2022-10-02 -* @version Last updated for: @ref qpc_7_1_2 +* @date Last updated on: 2022-12-13 +* @version Last updated for: @ref qpc_7_2_0 * * @file * @brief QK/C port example for a generic C compiler. @@ -35,7 +35,7 @@ /****************************************************************************/ /*! enable the context-switch callback */ -#define QK_ON_CONTEXT_SW 1 +#define QF_ON_CONTEXT_SW 1 /*! determination if the code executes in the ISR context (ARM Cortex-M) */ #define QK_ISR_CONTEXT_() (get_IPSR() != 0U) diff --git a/ports/lint-plus/qpc.lnt b/ports/lint-plus/qpc.lnt index bfee18a6..c87de4c7 100644 --- a/ports/lint-plus/qpc.lnt +++ b/ports/lint-plus/qpc.lnt @@ -22,8 +22,8 @@ // // //============================================================================ -//! @date Last updated on: 2022-10-13 -//! @version Last updated for version: 7.1.3 +//! @date Last updated on: 2022-11-29 +//! @version Last updated for version: 7.2.0 //! //! @file //! @brief PC-Lint-Plus option file for linting **QP/C Applications** @@ -322,10 +322,12 @@ QS_OBJ_ARR_DICTIONARY, QS_FUN_DICTIONARY, QS_USR_DICTIONARY, + QS_ENUM_DICTIONARY, QS_ASSERTION, QS_FLUSH, QS_MEM, QS_SIG, + QS_ENUM, QS_PTR_AT_, QS_RX_PUT, QS_OUTPUT, @@ -375,7 +377,8 @@ QS_OBJ_ARR_DICTIONARY, QS_FUN_DICTIONARY, QS_SIG_DICTIONARY, - QS_USR_DICTIONARY) + QS_USR_DICTIONARY, + QS_ENUM_DICTIONARY) // M3-R10.3(R) cannot assign enum to different essential type -emacro(9034, diff --git a/ports/lint-plus/qxk/qxk_port.h b/ports/lint-plus/qxk/qxk_port.h index 9a31220d..c16de180 100644 --- a/ports/lint-plus/qxk/qxk_port.h +++ b/ports/lint-plus/qxk/qxk_port.h @@ -23,8 +23,8 @@ * ============================================================================*/ /*! -* @date Last updated on: 2022-07-29 -* @version Last updated for: @ref qpc_7_0_1 +* @date Last updated on: 2022-12-13 +* @version Last updated for: @ref qpc_7_2_0 * * @file * @brief QXK/C port example for a generic C99 compiler. @@ -41,10 +41,10 @@ #define QXK_ISR_CONTEXT_() (getSR() != 0U) /*! activate the context-switch callback */ -#define QXK_ON_CONTEXT_SW 1 +#define QF_ON_CONTEXT_SW 1 /*! trigger context switch (used internally in QXK only) */ -#define QXK_CONTEXT_SWITCH_() (trigSWI()) +#define QXK_CONTEXT_SWITCH_() (trigPendSV()) /* QXK interrupt entry and exit... */ /*! Define the ISR entry sequence, if the compiler supports writing @@ -76,7 +76,7 @@ } while (false) uint32_t getSR(void); -void trigSWI(void); +void trigPendSV(void); #include "qxk.h" /* QXK platform-independent public interface */ diff --git a/ports/posix-qutest/qs_port.h b/ports/posix-qutest/qs_port.h index 8229b0e9..26686a2f 100644 --- a/ports/posix-qutest/qs_port.h +++ b/ports/posix-qutest/qs_port.h @@ -23,8 +23,8 @@ * ============================================================================*/ /*! -* @date Last updated on: 2022-06-12 -* @version Last updated for: @ref qpc_7_0_1 +* @date Last updated on: 2023-01-04 +* @version Last updated for: @ref qpc_7_2.0 * * @file * @brief QS/C port to POSIX with GNU compiler @@ -33,6 +33,7 @@ #ifndef QS_PORT_H #define QS_PORT_H +#define QS_CTR_SIZE 4U #define QS_TIME_SIZE 4U #if defined(__LP64__) || defined(_LP64) /* 64-bit architecture? */ @@ -46,8 +47,8 @@ /* flush the QS output buffer after each QS record */ #define QS_REC_DONE() QS_onFlush() -/***************************************************************************** -* NOTE: QS might be used with or without other QP components, in which +/*==========================================================================*/ +/* NOTE: QS might be used with or without other QP components, in which * case the separate definitions of the macros QF_CRIT_STAT_TYPE, * 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 "qf_port.h" diff --git a/ports/posix-qutest/qutest_port.c b/ports/posix-qutest/qutest_port.c index ac0911f0..9352876a 100644 --- a/ports/posix-qutest/qutest_port.c +++ b/ports/posix-qutest/qutest_port.c @@ -23,8 +23,8 @@ * ============================================================================*/ /*! -* @date Last updated on: 2022-07-30 -* @version Last updated for: @ref qpc_7_0_1 +* @date Last updated on: 2022-12-19 +* @version Last updated for: @ref qpc_7_2_0 * * @file * @brief QS/C QUTest port to POSIX @@ -56,19 +56,25 @@ #include #include -/*Q_DEFINE_THIS_MODULE("qutest_port")*/ - #define QS_TX_SIZE (8*1024) #define QS_RX_SIZE (2*1024) #define QS_TX_CHUNK QS_TX_SIZE -#define QS_TIMEOUT_MS 10 +#define QS_TIMEOUT_MS 10L #define INVALID_SOCKET -1 #define SOCKET_ERROR -1 +/*Q_DEFINE_THIS_MODULE("qutest_port")*/ + /* local variables .........................................................*/ static int l_sock = INVALID_SOCKET; -static void sigIntHandler(int dummy); +static void sigIntHandler(int dummy); /* prototype */ +static void sigIntHandler(int dummy) { + (void)dummy; /* unused parameter */ + QS_onCleanup(); + /*PRINTF_S("\n disconnecting from QSPY\n");*/ + exit(-1); +} /*..........................................................................*/ uint8_t QS_onStartup(void const *arg) { @@ -108,6 +114,8 @@ uint8_t QS_onStartup(void const *arg) { if (*src == ':') { serviceName = src + 1; } + //PRINTF_S(" Connecting to QSPY on Host=%s:%s...\n", + // hostName, serviceName); memset(&hints, 0, sizeof(hints)); hints.ai_family = AF_INET; @@ -117,7 +125,7 @@ uint8_t QS_onStartup(void const *arg) { if (status != 0) { FPRINTF_S(stderr, " ERROR cannot resolve host Name=%s:%s,Err=%d\n", - hostName, serviceName, status); + hostName, serviceName, status); goto error; } @@ -167,6 +175,9 @@ uint8_t QS_onStartup(void const *arg) { sockopt_bool = 0; /* negative option */ setsockopt(l_sock, SOL_SOCKET, SO_LINGER, &sockopt_bool, sizeof(sockopt_bool)); + + //PRINTF_S(" Connected to QSPY at Host=%s:%d\n", + // hostName, port_remote); QS_onFlush(); /* install the SIGINT (Ctrl-C) signal handler */ @@ -181,6 +192,8 @@ error: } /*..........................................................................*/ void QS_onCleanup(void) { + static struct timespec const c_timeout = {0, 10L*QS_TIMEOUT_MS*1000000L }; + nanosleep(&c_timeout, NULL); /* allow the last QS output to come out */ if (l_sock != INVALID_SOCKET) { close(l_sock); l_sock = INVALID_SOCKET; @@ -194,16 +207,14 @@ void QS_onReset(void) { } /*..........................................................................*/ void QS_onFlush(void) { - uint16_t nBytes; - uint8_t const *data; - static struct timespec const c_timeout = { 0, QS_TIMEOUT_MS*1000000L }; - if (l_sock == INVALID_SOCKET) { /* socket NOT initialized? */ FPRINTF_S(stderr, "%s\n", " ERROR invalid TCP socket"); return; } - nBytes = QS_TX_CHUNK; + uint8_t const *data; + static struct timespec const c_timeout = { 0, QS_TIMEOUT_MS*1000000L }; + uint16_t nBytes = QS_TX_CHUNK; while ((data = QS_getBlock(&nBytes)) != (uint8_t *)0) { for (;;) { /* for-ever until break or return */ int nSent = send(l_sock, (char const *)data, (int)nBytes, 0); @@ -239,28 +250,27 @@ void QS_onTestLoop() { fd_set readSet; FD_ZERO(&readSet); + struct timeval timeout = { + (long)0, (long)(QS_TIMEOUT_MS * 1000) + }; + QS_rxPriv_.inTestLoop = true; while (QS_rxPriv_.inTestLoop) { - struct timeval timeout = { - (long)0, (long)(QS_TIMEOUT_MS * 1000) - }; - int nrec; - FD_SET(l_sock, &readSet); /* selective, timed blocking on the TCP/IP socket... */ timeout.tv_usec = (long)(QS_TIMEOUT_MS * 1000); - nrec = select(l_sock + 1, &readSet, + int status = select(l_sock + 1, &readSet, (fd_set *)0, (fd_set *)0, &timeout); - if (nrec < 0) { + if (status < 0) { FPRINTF_S(stderr, " ERROR socket select,errno=%d\n", - errno); + errno); QS_onCleanup(); exit(-2); } - else if (FD_ISSET(l_sock, &readSet)) { /* socket ready to read? */ - int status = recv(l_sock, - (char *)QS_rxPriv_.buf, (int)QS_rxPriv_.end, 0); + else if ((status > 0) && FD_ISSET(l_sock, &readSet)) { /* socket ready */ + status = recv(l_sock, + (char *)QS_rxPriv_.buf, (int)QS_rxPriv_.end, 0); if (status > 0) { /* any data received? */ QS_rxPriv_.tail = 0U; QS_rxPriv_.head = status; /* # bytes received */ @@ -268,7 +278,6 @@ void QS_onTestLoop() { } } - /* flush the QS TX buffer */ QS_onFlush(); } /* set inTestLoop to true in case calls to QS_onTestLoop() nest, @@ -276,11 +285,4 @@ void QS_onTestLoop() { */ QS_rxPriv_.inTestLoop = true; } -/*..........................................................................*/ -static void sigIntHandler(int dummy) { - (void)dummy; /* unused parameter */ - QS_onCleanup(); - /*PRINTF_S("\n disconnecting from QSPY\n");*/ - exit(-1); -} diff --git a/ports/posix-qv/qs_port.h b/ports/posix-qv/qs_port.h index 3aa99639..94b5db93 100644 --- a/ports/posix-qv/qs_port.h +++ b/ports/posix-qv/qs_port.h @@ -23,8 +23,8 @@ * ============================================================================*/ /*! -* @date Last updated on: 2022-06-12 -* @version Last updated for: @ref qpc_7_0_1 +* @date Last updated on: 2023-01-04 +* @version Last updated for: @ref qpc_7_2.0 * * @file * @brief QS/C port to POSIX with GNU compiler @@ -33,6 +33,7 @@ #ifndef QS_PORT_H #define QS_PORT_H +#define QS_CTR_SIZE 4U #define QS_TIME_SIZE 4U #if defined(__LP64__) || defined(_LP64) /* 64-bit architecture? */ @@ -60,3 +61,4 @@ void QS_rx_input(void); /* handle the QS-RX input */ #include "qs.h" /* QS platform-independent public interface */ #endif /* QS_PORT_H */ + diff --git a/ports/posix/qs_port.h b/ports/posix/qs_port.h index 64be8230..94b5db93 100644 --- a/ports/posix/qs_port.h +++ b/ports/posix/qs_port.h @@ -23,8 +23,8 @@ * ============================================================================*/ /*! -* @date Last updated on: 2022-06-12 -* @version Last updated for: @ref qpc_7_0_1 +* @date Last updated on: 2023-01-04 +* @version Last updated for: @ref qpc_7_2.0 * * @file * @brief QS/C port to POSIX with GNU compiler @@ -33,6 +33,7 @@ #ifndef QS_PORT_H #define QS_PORT_H +#define QS_CTR_SIZE 4U #define QS_TIME_SIZE 4U #if defined(__LP64__) || defined(_LP64) /* 64-bit architecture? */ diff --git a/ports/sample/README.md b/ports/sample/README.md new file mode 100644 index 00000000..dd61b5ce --- /dev/null +++ b/ports/sample/README.md @@ -0,0 +1,3 @@ +# Sample QP/C Port +This direcctory contains a typical QP/C port with documented configuration +options. diff --git a/ports/sample/qep_port.h b/ports/sample/qep_port.h new file mode 100644 index 00000000..da5536c8 --- /dev/null +++ b/ports/sample/qep_port.h @@ -0,0 +1,62 @@ +/*============================================================================ +* QP/C Real-Time Embedded Framework +* 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: 2022-12-23 +* @version Last updated for: @ref qpc_7_2_0 +* +* @file +* @brief QEP/C sample port with all configurable options +*/ +#ifndef QEP_PORT_H_ +#define QEP_PORT_H_ + +/*! The size (in bytes) of the signal of an event. Valid values: +* 1U, 2U, or 4U; default 2U +* +* @details +* This macro can be defined in the QEP port file (qep_port.h) to +* configure the ::QSignal type. When the macro is not defined, the +* default of 2 bytes is applied in the `qep.h` header file. +*/ +#define Q_SIGNAL_SIZE 2U + +/*! No-return function specifier for the Q_onAssert() callback function. +* +* The `Q_NORETURN` macro is supposed to be defined in the QP/C port +* (file `qep_port.h`). If such definition is NOT provided, the default +* definition is provided in the `qassert.h` header file, where +* it assumes only `void` type returned from Q_onAssert(). +* +* @trace +* @tr{PQA01_4} +*/ +#define Q_NORETURN __attribute__ ((noreturn)) void + +#include /* Exact-width types. WG14/N843 C99 Standard */ +#include /* Boolean type. WG14/N843 C99 Standard */ + +#include "qep.h" /* QEP platform-independent public interface */ + +#endif /* QEP_PORT_H_ */ diff --git a/ports/sample/qf_port.h b/ports/sample/qf_port.h new file mode 100644 index 00000000..281eebc1 --- /dev/null +++ b/ports/sample/qf_port.h @@ -0,0 +1,255 @@ +/*============================================================================ +* QP/C Real-Time Embedded Framework +* 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: 2022-11-23 +* @version Last updated for: @ref qpc_7_2_0 +* +* @file +* @brief QF/C sample port with all configurable options +*/ +#ifndef QF_PORT_H_ +#define QF_PORT_H_ + +/*! This macro defines the type of the thread handle used for AOs */ +#define QF_THREAD_TYPE void* + +/*! This macro defines the type of the event-queue used for AOs */ +#define QF_EQUEUE_TYPE QEQueue + +/*! This macro defines the type of the OS-Object used for blocking +* the native ::QEQueue when the queue is empty +* +* @description +* This macro is used when ::QEQueue is used as the event-queue for AOs +* but also the AO queue must *block* when the queue is empty. +* In that case, #QF_OS_OBJECT_TYPE specifies the blocking mechanism. +* For example, in the POSIX port, the blocking mechanism is a condition +* variable. +*/ +#define QF_OS_OBJECT_TYPE pthread_cond_t + +/*! This macro defines the type of the event pool used in the port. +* +* @description +* This is a specific implementation for the QK-port of QF. +* In other QF ports you need to define the macro appropriately for +* the underlying kernel/OS you're using. +*/ +#define QF_EPOOL_TYPE_ QMPool + +/*! The maximum number of active objects in the application. +* +* @description +* This macro *must* be defined in the `qf_port.h` header file and should be +* in range of 1U..64U, inclusive. The value of this macro determines the +* maximum priority level of an active object in the system. Not all priority +* levels must be used, but the maximum priority cannot exceed `QF_MAX_ACTIVE`. +* Defining the value below the maximum limit of 64 saves some memory (RAM). +*/ +#define QF_MAX_ACTIVE 64U + +/*! The maximum number of clock tick rates in the application. +* +* @description +* This macro can be defined in the `qf_port.h` header file and should be +* in range of 1U..15U, inclusive. The value of this macro determines the +* maximum number of clock tick rates for time events (::QTimeEvt). +* +* If the macro is not defined, the `qf.h` header file sets the default +* value to 1U. +*/ +#define QF_MAX_TICK_RATE 1U + +/*! The size (in bytes) of the time event-counter representation +* in the ::QTimeEvt struct. Valid values: 1U, 2U, or 4U; default 2U. +* +* @description +* This macro can be defined in the `qf_port.h` header file to configure the +* internal tick counters of Time Events. If the macro is not defined, the +* default of 4 bytes will be chosen in `qf.h`. The valid #QF_TIMEEVT_CTR_SIZE +* values of 1, 2, or 4, correspond to tick counters of uint8_t, uint16_t, +* and uint32_t, respectively. The tick counter representation determines the +* dynamic range of time delays that a Time Event can handle. +* @sa ::QTimeEvt +*/ +#define QF_TIMEEVT_CTR_SIZE 4U + +/*! The maximum number of event pools in the application. +* +* @description +* This macro can be defined in the `qf_port.h` header file and should be +* in range of 1U..255U, inclusive. The value of this macro determines the +* maximum number of event pools in the system. Not all event pools must be +* actually used, but the maximum number of pools cannot exceed `QF_MAX_EPOOL`. +* +* If the macro is not defined, the `qf.h` header file sets the default +* value to 3U. Defining `QF_MAX_EPOOL` below the maximum limit of 255 +* saves some memory (RAM). +*/ +#define QF_MAX_EPOOL 3U + +/*! The size (in bytes) of the event-size representation in the QF. +* Valid values: 1U, 2U, or 4U; default 2U +* +* @description +* This macro can be defined in the QF ports to configure the size +* of the event-size. +*/ +#define QF_EVENT_SIZ_SIZE 2U + +/*! The size (in bytes) of the ring-buffer counters used in the native QF +* event queue implementation. Valid values: 1U, 2U, or 4U; default 1U +* +* @description +* This macro can be defined in the `qf_port.h` header file to configure +* the ::QEQueueCtr type. If the macro is not defined, the default of 1 byte +* will be chosen in `qequeue.h`. The valid #QF_EQUEUE_CTR_SIZE values of +* 1U, 2U, or 4U, correspond to ::QEQueueCtr of uint8_t, uint16_t, and +* uint32_t, respectively. The::QEQueueCtr data type determines the dynamic +* range of numerical values of ring-buffer counters inside event queues, or, +* in other words, the maximum number of events that the native QF event +* queue can manage. +* @sa ::QEQueue +*/ +#define QF_EQUEUE_CTR_SIZE 1U + +/*! The size (in bytes) of the block-size representation in the native QF +* event pool. Valid values: 1U, 2U, or 4U; default #QF_EVENT_SIZ_SIZE. +* +* @description +* This macro can be defined in the `qf_port.h` header file to configure the +* ::QMPoolSize type. If the macro is not defined, the default of +* #QF_EVENT_SIZ_SIZE will be chosen in `qmpool.h`, because the memory pool +* is primarily used for implementing event pools. +* +* The valid #QF_MPOOL_SIZ_SIZE values of 1U, 2U, or 4U, correspond to +* ::QMPoolSize of uint8_t, uint16_t, and uint32_t, respectively. The +* ::QMPoolSize data type determines the dynamic range of block-sizes that +* the native ::QMPool can handle. +* @sa #QF_EVENT_SIZ_SIZE, ::QMPool +*/ +#define QF_MPOOL_SIZ_SIZE 2U + +/*! The size (in bytes) of the block-counter representation in the +* native QF event pool. Valid values: 1U, 2U, or 4U; default 2U. +* +* @description +* This macro can be defined in the `qf_port.h` header file to configure the +* ::QMPoolCtr type. If the macro is not defined, the default of 2 bytes will +* be chosen in `qmpool.h`. The valid #QF_MPOOL_CTR_SIZE values of 1U, 2U, +* or 4U, correspond to ::QMPoolSize of uint8_t, uint16_t, and uint32_t, +* respectively. The ::QMPoolCtr data type determines the dynamic range of +* block-counters that the native ::QMPool can handle, or, in other words, +* the maximum number of blocks that the native QF event pool can manage. +* @sa ::QMPool +*/ +#define QF_MPOOL_CTR_SIZE 2U + +/*! Define the interrupt disabling policy. +* +* @description +* This macro encapsulates platform-specific way of disabling interrupts +* from "C" for a given CPU and compiler. +* +* @note +* the #QF_INT_DISABLE macro should always be used in pair with the +* macro #QF_INT_ENABLE. +*/ +#define QF_INT_DISABLE() intDisable() + +/*! Define the interrupt enabling policy. +* +* @description +* This macro encapsulates platform-specific way of enabling interrupts +* from "C" for a given CPU and compiler. +* +* @note the #QF_INT_DISABLE macro should always be used in pair with the +* macro #QF_INT_ENABLE. +*/ +#define QF_INT_ENABLE() intEnable() + +/*! Define the type of the critical section status. +* +* @description +* Defining this macro configures the "saving and restoring critical section +* status" policy. Conversely, if this macro is not defined, the simple +* "unconditional critical section exit" is used. +*/ +#define QF_CRIT_STAT_TYPE crit_stat_t + +/*! Define the critical section entry policy. +* +* @description +* This macro enters a critical section (often by means of disabling +* interrupts). When the "saving and restoring critical section status" +* policy is used, the macro sets the @a status_ argument to the critical +* section status just before the entry. When the policy of "unconditional +* critical section exit" is used, the macro does not use the @a status_ +* argument. +* +* @note the #QF_CRIT_ENTRY macro should always be used in pair with the +* macro #QF_CRIT_EXIT. +*/ +#define QF_CRIT_ENTRY(stat_) ((stat_) = critEntry()) + +/*! Define the critical section exit policy. +* +* @description +* This macro enters a critical section (often by means of disabling +* interrupts). When the "saving and restoring critical section status" +* policy is used, the macro restores the critical section status from the +* @a status_ argument. When the policy of "unconditional critical section +* exit" is used, the macro does not use the @a status argument and +* exits the critical section unconditionally (often by means of enabling +* interrupts). +* +* @note the #QF_CRIT_ENTRY macro should always be used in pair with the +* macro #QF_CRIT_EXIT. +*/ +#define QF_CRIT_EXIT(stat_) critExit(stat_) + +/*! Define No-Operation (NOP) implementation to prevent joining +* adjacent critical sections. +*/ +#define QF_CRIT_EXIT_NOP() __asm volatile ("isb") + +/*! Define integer log-base-2 implementation strategy +* +* @description +* This macro can be defined in the `qf_port.h` header file to speed up +* the integer log-base-2 computation, which is used internally in QP to +* quickly find the highest-priority AO to execute or to find the +* highest-priority subscriber AO to a given event signal. The QF_LOG2() +* macro allows the port to specify a fast, hardware-supported computation +* (e.g., based on the count-leading-zeros instruction available in some CPUs). +* +* If this macros is NOT defined a default, reasonably fast algorithm is used. +*/ +#define QF_LOG2(n_) ((uint_fast8_t)(32U - __builtin_clz((unsigned)(n_)))) + +#include "qk_port.h" /* underlying real-time kernel port */ +#include "qf.h" /* QF platform-independent public interface */ + +#endif /* QF_PORT_H */ diff --git a/ports/win32-quit/quit.h b/ports/sample/qk_port.h similarity index 55% rename from ports/win32-quit/quit.h rename to ports/sample/qk_port.h index 20024aeb..d0398d40 100644 --- a/ports/win32-quit/quit.h +++ b/ports/sample/qk_port.h @@ -23,38 +23,30 @@ * ============================================================================*/ /*! -* @date Last updated on: 2022-11-14 -* @version Last updated for: @ref qpc_7_1_3 +* @date Last updated on: 2022-10-02 +* @version Last updated for: @ref qpc_7_1_2 * * @file -* @brief "QUIT" QP Unit Internal Test +* @brief QK/C sample port with all configurable options */ -#ifndef QUIT_H -#define QUIT_H +#ifndef QK_PORT_H_ +#define QK_PORT_H_ -/* macro to verify an expectation */ -#define VERIFY(cond_) \ - ((cond_) ? (void)0 : QUIT_fail_(#cond_, &Q_this_module_[0], __LINE__)) +/* QK interrupt entry and exit... */ +#define QK_ISR_ENTRY() (++QF_intNest_) -#ifdef __cplusplus -extern "C" { -#endif +#define QK_ISR_EXIT() do { \ + --QF_intNest_; \ + if (QF_intNest_ == 0U) { \ + if (QK_sched_() != 0U) { \ + QK_activate_(); \ + } \ + } \ + else { \ + Q_ERROR(); \ + } \ +} while (false) -void TEST(char const *title); -void QUIT_fail_(char const *cond, char const *module, int line); -void onRunTests(void); /* user-defined callback to run the tests */ +#include "qk.h" /* QK platform-independent public interface */ -#include "qf_port.h" /* QF/C port from the port directory */ -#include "qassert.h" /* QP embedded systems-friendly assertions */ - -#ifdef Q_SPY /* software tracing enabled? */ -#include "qs_port.h" /* QS/C port from the port directory */ -#else -#include "qs_dummy.h" /* QS/C dummy (inactive) interface */ -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* QUIT_H */ +#endif /* QK_PORT_H_ */ diff --git a/ports/win32-quit/qs_port.h b/ports/sample/qs_port.h similarity index 66% rename from ports/win32-quit/qs_port.h rename to ports/sample/qs_port.h index 68d62e42..d40ad4a7 100644 --- a/ports/win32-quit/qs_port.h +++ b/ports/sample/qs_port.h @@ -23,31 +23,29 @@ * ============================================================================*/ /*! -* @date Last updated on: 2022-06-12 -* @version Last updated for: @ref qpc_7_0_1 +* @date Last updated on: 2023-01-05 +* @version Last updated for: @ref qpc_7_2_0 * * @file -* @brief QS/C port to Win32 with GNU or Visual C++ compilers -* @ingroup ports +* @brief QS/C sample port with all configurable options */ -#ifndef QS_PORT_H -#define QS_PORT_H +#ifndef QS_PORT_H_ +#define QS_PORT_H_ -#define QS_TIME_SIZE 4U +/*! QS buffer counter size in bytes */ +#define QS_CTR_SIZE 2U -#ifdef _WIN64 /* 64-bit architecture? */ - #define QS_OBJ_PTR_SIZE 8U - #define QS_FUN_PTR_SIZE 8U -#else /* 32-bit architecture */ - #define QS_OBJ_PTR_SIZE 4U - #define QS_FUN_PTR_SIZE 4U -#endif +/*! QS time-stamp size in bytes */ +#define QS_TIME_SIZE 4U -void QS_output(void); /* handle the QS output */ -void QS_rx_input(void); /* handle the QS-RX input */ +/*! object pointer size in bytes */ +#define QS_OBJ_PTR_SIZE 4U -/***************************************************************************** -* NOTE: QS might be used with or without other QP components, in which +/*! 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_TYPE, * 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 "qf_port.h" @@ -59,5 +57,4 @@ void QS_rx_input(void); /* handle the QS-RX input */ #include "qs.h" /* QS platform-independent public interface */ -#endif /* QS_PORT_H */ - +#endif /* QS_PORT_H_ */ diff --git a/ports/win32-quit/qep_port.h b/ports/win32-quit/qep_port.h deleted file mode 100644 index a68b88b2..00000000 --- a/ports/win32-quit/qep_port.h +++ /dev/null @@ -1,71 +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: 2022-06-12 -* @version Last updated for: @ref qpc_7_0_1 -* -* @file -* @brief QEP/C port to Win32 with GNU or Visual Studio C/C++ compilers -*/ -#ifndef QEP_PORT_H -#define QEP_PORT_H - -#include /* Exact-width types. WG14/N843 C99 Standard */ -#include /* Boolean type. WG14/N843 C99 Standard */ - -#ifdef __GNUC__ - - /*! no-return function specifier (GCC-ARM compiler) */ - #define Q_NORETURN __attribute__ ((noreturn)) void - -#elif (defined _MSC_VER) && (defined __cplusplus) - - /* no-return function specifier (Microsoft Visual Studio C++ compiler) */ - #define Q_NORETURN [[ noreturn ]] void - - /* - * This is the case where QP/C is compiled by the Microsoft Visual C++ - * compiler in the C++ mode, which can happen when qep_port.h is included - * in a C++ module, or the compilation is forced to C++ by the option /TP. - * - * The following pragma suppresses the level-4 C++ warnings C4510, C4512, and - * C4610, which warn that default constructors and assignment operators could - * not be generated for structures QMState and QMTranActTable. - * - * The QP/C source code cannot be changed to avoid these C++ warnings, because - * the structures QMState and QMTranActTable must remain PODs (Plain Old - * Datatypes) to be initializable statically with constant initializers. - */ - #pragma warning (disable: 4510 4512 4610) - -#endif - -#include "qep.h" /* QEP platform-independent public interface */ - -#if (defined __cplusplus) && (defined _MSC_VER) - #pragma warning (default: 4510 4512 4610) -#endif - -#endif /* QEP_PORT_H */ diff --git a/ports/win32-quit/qf_port.h b/ports/win32-quit/qf_port.h deleted file mode 100644 index 8312a34b..00000000 --- a/ports/win32-quit/qf_port.h +++ /dev/null @@ -1,95 +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: 2022-11-11 -* @version Last updated for: @ref qpc_7_1_3 -* -* @file -* @brief QF/C "port" for QUIT unit internal test, Win32 with GNU or VisualC++ -* @ingroup ports -*/ -#ifndef QF_PORT_H -#define QF_PORT_H - -/* QUIT event queue and thread types */ -#define QF_EQUEUE_TYPE QEQueue -/* QF_OS_OBJECT_TYPE not used */ -/* QF_THREAD_TYPE not used */ - -/* The maximum number of active objects in the application */ -#define QF_MAX_ACTIVE 64U - -/* The number of system clock tick rates */ -#define QF_MAX_TICK_RATE 2U - -/* Activate the QF QActive_stop() API */ -#define QF_ACTIVE_STOP 1 - -/* QF interrupt disable/enable */ -#define QF_INT_DISABLE() (++QF_intLock_) -#define QF_INT_ENABLE() (--QF_intLock_) - -/* QUIT critical section */ -/* QF_CRIT_STAT_TYPE not defined */ -#define QF_CRIT_ENTRY(dummy) QF_INT_DISABLE() -#define QF_CRIT_EXIT(dummy) QF_INT_ENABLE() - -/* QF_LOG2 not defined -- use the internal LOG2() implementation */ - -#include "qep_port.h" /* QEP port */ -#include "qequeue.h" /* QUIT port uses QEQueue event-queue */ -#include "qmpool.h" /* QUIT port uses QMPool memory-pool */ -#include "qf.h" /* QF platform-independent public interface */ - -/****************************************************************************/ -/* interface used only inside QP implementation, but not in applications */ -#ifdef QP_IMPL - - /* QUIT scheduler locking (not used) */ - #define QF_SCHED_STAT_ - #define QF_SCHED_LOCK_(dummy) ((void)0) - #define QF_SCHED_UNLOCK_() ((void)0) - - /* native event queue operations */ - #define QACTIVE_EQUEUE_WAIT_(me_) \ - Q_ASSERT_ID(110, (me_)->eQueue.frontEvt != (QEvt *)0) - #define QACTIVE_EQUEUE_SIGNAL_(me_) \ - QPSet_insert(&QF_readySet_, (uint_fast8_t)(me_)->prio) - - /* native QF event pool operations */ - #define QF_EPOOL_TYPE_ QMPool - #define QF_EPOOL_INIT_(p_, poolSto_, poolSize_, evtSize_) \ - (QMPool_init(&(p_), (poolSto_), (poolSize_), (evtSize_))) - #define QF_EPOOL_EVENT_SIZE_(p_) ((uint_fast16_t)(p_).blockSize) - #define QF_EPOOL_GET_(p_, e_, m_, qs_id_) \ - ((e_) = (QEvt *)QMPool_get(&(p_), (m_), (qs_id_))) - #define QF_EPOOL_PUT_(p_, e_, qs_id_) \ - (QMPool_put(&(p_), (e_), (qs_id_))) - - #include "qf_pkg.h" /* internal QF interface */ - -#endif /* QP_IMPL */ - -#endif /* QF_PORT_H */ diff --git a/ports/win32-quit/quit_port.c b/ports/win32-quit/quit_port.c deleted file mode 100644 index 1b48bb74..00000000 --- a/ports/win32-quit/quit_port.c +++ /dev/null @@ -1,120 +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: 2022-07-24 -* @version Last updated for: @ref qpc_7_0_1 -* -* @file -* @brief QUIT (QP Unit Internal Test) port to Win32 with GNU or VisualC++ -*/ -#include "quit.h" - -#include /* for printf_s() */ -#include /* for exit() */ - -#ifndef NDEBUG -#define WIN32_LEAN_AND_MEAN -#include /* for DebugBreak */ -#endif - -//Q_DEFINE_THIS_MODULE("quit_port") - -/*..........................................................................*/ -uint_fast8_t volatile QF_intLock_; - -/*..........................................................................*/ -static int l_test_count; - -/*..........................................................................*/ -void QUIT_fail_(char const *cond, char const *file, int line) { - printf_s(" FAILED in %s:%d\n" - "%s\n" - "---------------------------------------------\n" - "%d test(s)\n" - "FAILED\n", - file, line, cond, l_test_count); - -#ifndef NDEBUG - DebugBreak(); -#endif - - exit(l_test_count); -} -/*..........................................................................*/ -void TEST(char const *title) { - if (l_test_count > 0) { - printf_s(" PASSED\n"); - } - printf_s("test: \"%s\" ...", title); - ++l_test_count; -} -/*..........................................................................*/ -int main(void) { - printf_s("\n%s\n", "QP Unit Internal Testing -- QUIT"); - - onRunTests(); - - if (l_test_count > 0) { - printf_s("%s\n", " PASSED"); - } - printf_s("---------------------------------------------\n" - "%d test(s)\nOK\n", l_test_count); - - return 0; /* success */ -} - -/*==========================================================================*/ -Q_NORETURN Q_onAssert(char const * const module, int_t const location) { - QUIT_fail_("Q_onAssert", module, location); - for (;;) { /* explicitly make it "noreturn" */ - } -} - -/*==========================================================================*/ -#ifdef Q_SPY -/*..........................................................................*/ -void QS_onCleanup(void) { -} -/*..........................................................................*/ -void QS_onReset(void) { -} -/*..........................................................................*/ -void QS_onFlush(void) { -} -/*..........................................................................*/ -QSTimeCtr QS_onGetTime(void) { - return (QSTimeCtr)0U; -} -/*..........................................................................*/ -void QS_onCommand(uint8_t cmdId, uint32_t param1, - uint32_t param2, uint32_t param3) -{ - (void)cmdId; - (void)param1; - (void)param2; - (void)param3; -} - -#endif diff --git a/ports/win32-qutest/qs_port.h b/ports/win32-qutest/qs_port.h index 38708843..f72720b1 100644 --- a/ports/win32-qutest/qs_port.h +++ b/ports/win32-qutest/qs_port.h @@ -23,8 +23,8 @@ * ============================================================================*/ /*! -* @date Last updated on: 2022-06-12 -* @version Last updated for: @ref qpc_7_0_1 +* @date Last updated on: 2023-01-04 +* @version Last updated for: @ref qpc_7_2.0 * * @file * @brief QS/C port to Win32 with GNU or Visual C++ compilers @@ -33,21 +33,22 @@ #ifndef QS_PORT_H #define QS_PORT_H -#define QS_TIME_SIZE 4 +#define QS_CTR_SIZE 4U +#define QS_TIME_SIZE 4U #ifdef _WIN64 /* 64-bit architecture? */ - #define QS_OBJ_PTR_SIZE 8 - #define QS_FUN_PTR_SIZE 8 + #define QS_OBJ_PTR_SIZE 8U + #define QS_FUN_PTR_SIZE 8U #else /* 32-bit architecture */ - #define QS_OBJ_PTR_SIZE 4 - #define QS_FUN_PTR_SIZE 4 + #define QS_OBJ_PTR_SIZE 4U + #define QS_FUN_PTR_SIZE 4U #endif /* flush the QS output buffer after each QS record */ #define QS_REC_DONE() QS_onFlush() -/***************************************************************************** -* NOTE: QS might be used with or without other QP components, in which +/*==========================================================================*/ +/* NOTE: QS might be used with or without other QP components, in which * case the separate definitions of the macros QF_CRIT_STAT_TYPE, * 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 "qf_port.h" diff --git a/ports/win32-qutest/qutest_port.c b/ports/win32-qutest/qutest_port.c index 6ed0bba0..1ddd49a5 100644 --- a/ports/win32-qutest/qutest_port.c +++ b/ports/win32-qutest/qutest_port.c @@ -23,8 +23,8 @@ * ============================================================================*/ /*! -* @date Last updated on: 2022-06-12 -* @version Last updated for: @ref qpc_7_0_1 +* @date Last updated on: 2022-12-19 +* @version Last updated for: @ref qpc_7_2_0 * * @file * @brief QS/C QUTest port for Win32 @@ -63,7 +63,7 @@ #define QS_TX_SIZE (8*1024) #define QS_RX_SIZE (2*1024) #define QS_TX_CHUNK QS_TX_SIZE -#define QS_TIMEOUT_MS 10 +#define QS_TIMEOUT_MS 10U /* local variables .........................................................*/ static SOCKET l_sock = INVALID_SOCKET; @@ -113,6 +113,8 @@ uint8_t QS_onStartup(void const *arg) { if (*src == ':') { serviceName = src + 1; } + //printf(" Connecting to QSPY on Host=%s:%s...\n", + // hostName, serviceName); memset(&hints, 0, sizeof(hints)); hints.ai_family = AF_INET; @@ -164,6 +166,9 @@ uint8_t QS_onStartup(void const *arg) { sockopt_bool = TRUE; setsockopt(l_sock, SOL_SOCKET, SO_DONTLINGER, (const char *)&sockopt_bool, sizeof(sockopt_bool)); + + //PRINTF_S(" Connected to QSPY at Host=%s:%d\n", + // hostName, port_remote); QS_onFlush(); return 1U; /* success */ @@ -173,29 +178,29 @@ error: } /*..........................................................................*/ void QS_onCleanup(void) { + Sleep(QS_TIMEOUT_MS * 10U); /* allow the last QS output to come out */ if (l_sock != INVALID_SOCKET) { closesocket(l_sock); l_sock = INVALID_SOCKET; } WSACleanup(); - /*PRINTF_S(" Disconnected from QSPY\n");*/ + //PRINTF_S("\n%s\n", "QS_onCleanup"); } /*..........................................................................*/ void QS_onReset(void) { QS_onCleanup(); + //PRINTF_S("\n%s\n", "QS_onReset"); exit(0); } /*..........................................................................*/ void QS_onFlush(void) { - uint16_t nBytes; - uint8_t const *data; - if (l_sock == INVALID_SOCKET) { /* socket NOT initialized? */ FPRINTF_S(stderr, " ERROR %s\n", "invalid TCP socket"); return; } - nBytes = QS_TX_CHUNK; + uint16_t nBytes = QS_TX_CHUNK; + uint8_t const *data; while ((data = QS_getBlock(&nBytes)) != (uint8_t *)0) { for (;;) { /* for-ever until break or return */ int nSent = send(l_sock, (char const *)data, (int)nBytes, 0); @@ -215,6 +220,7 @@ void QS_onFlush(void) { } else if (nSent < (int)nBytes) { /* sent fewer than requested? */ Sleep(QS_TIMEOUT_MS); /* sleep for the timeout */ + /* adjust the data and loop back to send() the rest */ data += nSent; nBytes -= (uint16_t)nSent; @@ -237,13 +243,11 @@ void QS_onTestLoop() { struct timeval timeout = { (long)0, (long)(QS_TIMEOUT_MS * 1000) }; - int status; - wint_t ch; FD_SET(l_sock, &readSet); /* selective, timed blocking on the TCP/IP socket... */ - status = select(0, &readSet, (fd_set *)0, (fd_set *)0, &timeout); + int status = select(0, &readSet, (fd_set *)0, (fd_set *)0, &timeout); if (status == SOCKET_ERROR) { FPRINTF_S(stderr, " ERROR socket select,WSAErr=%d", @@ -261,10 +265,9 @@ void QS_onTestLoop() { } } - /* flush the QS TX buffer */ QS_onFlush(); - ch = 0; + wint_t ch = 0; while (_kbhit()) { /* any key pressed? */ ch = _getwch(); } diff --git a/ports/win32-qv/qs_port.h b/ports/win32-qv/qs_port.h index fd484c47..302fc60e 100644 --- a/ports/win32-qv/qs_port.h +++ b/ports/win32-qv/qs_port.h @@ -23,8 +23,8 @@ * ============================================================================*/ /*! -* @date Last updated on: 2022-06-12 -* @version Last updated for: @ref qpc_7_0_1 +* @date Last updated on: 2023-01-04 +* @version Last updated for: @ref qpc_7_2.0 * * @file * @brief QS/C port to Win32 with GNU or Visual C++ compilers @@ -33,21 +33,22 @@ #ifndef QS_PORT_H #define QS_PORT_H -#define QS_TIME_SIZE 4 +#define QS_CTR_SIZE 4U +#define QS_TIME_SIZE 4U #ifdef _WIN64 /* 64-bit architecture? */ - #define QS_OBJ_PTR_SIZE 8 - #define QS_FUN_PTR_SIZE 8 + #define QS_OBJ_PTR_SIZE 8U + #define QS_FUN_PTR_SIZE 8U #else /* 32-bit architecture */ - #define QS_OBJ_PTR_SIZE 4 - #define QS_FUN_PTR_SIZE 4 + #define QS_OBJ_PTR_SIZE 4U + #define QS_FUN_PTR_SIZE 4U #endif void QS_output(void); /* handle the QS output */ void QS_rx_input(void); /* handle the QS-RX input */ -/***************************************************************************** -* NOTE: QS might be used with or without other QP components, in which +/*==========================================================================*/ +/* NOTE: QS might be used with or without other QP components, in which * case the separate definitions of the macros QF_CRIT_STAT_TYPE, * 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 "qf_port.h" diff --git a/ports/win32/qs_port.h b/ports/win32/qs_port.h index fd484c47..302fc60e 100644 --- a/ports/win32/qs_port.h +++ b/ports/win32/qs_port.h @@ -23,8 +23,8 @@ * ============================================================================*/ /*! -* @date Last updated on: 2022-06-12 -* @version Last updated for: @ref qpc_7_0_1 +* @date Last updated on: 2023-01-04 +* @version Last updated for: @ref qpc_7_2.0 * * @file * @brief QS/C port to Win32 with GNU or Visual C++ compilers @@ -33,21 +33,22 @@ #ifndef QS_PORT_H #define QS_PORT_H -#define QS_TIME_SIZE 4 +#define QS_CTR_SIZE 4U +#define QS_TIME_SIZE 4U #ifdef _WIN64 /* 64-bit architecture? */ - #define QS_OBJ_PTR_SIZE 8 - #define QS_FUN_PTR_SIZE 8 + #define QS_OBJ_PTR_SIZE 8U + #define QS_FUN_PTR_SIZE 8U #else /* 32-bit architecture */ - #define QS_OBJ_PTR_SIZE 4 - #define QS_FUN_PTR_SIZE 4 + #define QS_OBJ_PTR_SIZE 4U + #define QS_FUN_PTR_SIZE 4U #endif void QS_output(void); /* handle the QS output */ void QS_rx_input(void); /* handle the QS-RX input */ -/***************************************************************************** -* NOTE: QS might be used with or without other QP components, in which +/*==========================================================================*/ +/* NOTE: QS might be used with or without other QP components, in which * case the separate definitions of the macros QF_CRIT_STAT_TYPE, * 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 "qf_port.h" diff --git a/qpc.qm b/qpc.qm index 86dfa534..4acd03e2 100644 --- a/qpc.qm +++ b/qpc.qm @@ -1,5 +1,5 @@ - + QP/C Real-Time Embedded Framework (RTEF) The model is used to generate the whole QP/C source code. @@ -479,10 +479,9 @@ Contact information: /*! Virtual call to the top-most initial transition in a HSM. * -* @param[in,out] me_ pointer (see @ref oop) -* @param[in] e_ constant pointer the ::QEvt or a class derived from -* ::QEvt (see @ref oop) -* @param[in] qs_id_ QS local filter ID (used only when Q_SPY is defined) +* @param[in,out] me_ current instance pointer (see @ref oop) +* @param[in] par_ pointer the optional initialization parameter +* @param[in] qs_id_ QS local filter ID (used only when Q_SPY is defined) * * @note Must be called only ONCE after the SM "constructor". * @@ -524,7 +523,7 @@ Contact information: * @details * Processes one event at a time in Run-to-Completion fashion. * -* @param[in,out] me_ pointer (see @ref oop) +* @param[in,out] me_ current instance pointer (see @ref oop) * @param[in] e_ constant pointer the ::QEvt or a class * derived from ::QEvt (see @ref oop) * @param[in] qs_id_ QS local filter ID (used only when Q_SPY is defined) @@ -867,8 +866,6 @@ Contact information: /*! Macro to call in a QM state-handler when it designates the * superstate to handle an event. Applicable only to QMSMs. */ - - (Q_RET_SUPER) @@ -959,7 +956,8 @@ Contact information: /*! Custom event constructor * @public @memberof QEvt -* +* @note +* Available only when the macro #Q_EVT_CTOR is defined * @tr{RQP005} */ @@ -1152,7 +1150,7 @@ Contact information: * @note For a HSM, to "be in a state" means also to be in a superstate of * of the state. * -* @param[in] me pointer (see @ref oop) +* @param[in] me current instance pointer (see @ref oop) * @param[in] state pointer to the state-handler function to be tested * * @returns @@ -1189,7 +1187,7 @@ return inState; /* return the status */ /*! Obtain the current active state from a HSM (read only). * @public @memberof QHsm * -* @param[in] me pointer (see @ref oop) +* @param[in] me current instance pointer (see @ref oop) * * @returns the current active state of the QHsm class * @@ -1209,7 +1207,7 @@ return inState; /* return the status */ * function is to support **shallow history** transitions in state machines * derived from QHsm. * -* @param[in] me pointer (see @ref oop) +* @param[in] me current instance pointer (see @ref oop) * @param[in] parent pointer to the state-handler function * * @returns @@ -1264,7 +1262,7 @@ return child; /* return the child */ * Performs the first step of HSM initialization by assigning the initial * pseudostate to the currently active state of the state machine. * -* @param[in,out] me pointer (see @ref oop) +* @param[in,out] me current instance pointer (see @ref oop) * @param[in] initial pointer to the top-most initial state-handler * function in the derived state machine * @@ -1303,7 +1301,7 @@ me->temp.fun = initial; * QHsm_top() is the ultimate root of state hierarchy in all HSMs derived * from ::QHsm. * -* @param[in] me pointer (see @ref oop) +* @param[in] me current instance pointer (see @ref oop) * @param[in] e pointer to the event to be dispatched to the FSM * * @returns @@ -1329,7 +1327,7 @@ return Q_RET_IGNORED; /* the top state ignores all events */ * @details * Executes the top-most initial transition in a HSM. * -* @param[in,out] me pointer (see @ref oop) +* @param[in,out] me current instance pointer (see @ref oop) * @param[in] e pointer to an extra parameter (might be NULL) * @param[in] qs_id QS-id of this state machine (for QS local filter) * @@ -1341,7 +1339,12 @@ return Q_RET_IGNORED; /* the top state ignores all events */ - #ifndef Q_SPY + #ifdef Q_SPY +if ((QS_priv_.flags & 0x01U) == 0U) { + QS_priv_.flags |= 0x01U; + QS_FUN_DICTIONARY(&QHsm_top); +} +#else Q_UNUSED_PAR(qs_id); #endif @@ -1423,7 +1426,7 @@ me->temp.fun = t; /* mark the configuration as stable */ * Dispatches an event for processing to a hierarchical state machine (HSM). * The processing of an event represents one run-to-completion (RTC) step. * -* @param[in,out] me pointer (see @ref oop) +* @param[in,out] me current instance pointer (see @ref oop) * @param[in] e pointer to the event to be dispatched to the HSM * @param[in] qs_id QS-id of this state machine (for QS local filter) * @@ -1866,7 +1869,7 @@ return (*state)(me, &l_reservedEvt_[Q_EXIT_SIG]) == Q_RET_HANDLED; * For a MSM, to "be-in" a state means also to "be-in" a superstate of * of the state. * -* @param[in] me pointer (see @ref oop) +* @param[in] me current instance pointer (see @ref oop) * @param[in] state pointer to the QMState object that corresponds to the * tested state. * @returns @@ -1892,7 +1895,7 @@ return inState; /*! Obtain the current active state from a MSM (read only) * @public @memberof QMsm * -* @param[in] me pointer (see @ref oop) +* @param[in] me current instance pointer (see @ref oop) * * @returns the current active state-object * @@ -1914,7 +1917,7 @@ return inState; * function is to support **shallow history** transitions in state machines * derived from QMsm. * -* @param[in] me pointer (see @ref oop) +* @param[in] me current instance pointer (see @ref oop) * @param[in] parent pointer to the state-handler object * * @returns @@ -1930,11 +1933,9 @@ return inState; QMState const *child = me->state.obj; bool isFound = false; /* start with the child not found */ +QMState const *s; -for (QMState const *s = me->state.obj; - s != (QMState *)0; - s = s->superstate) -{ +for (s = me->state.obj; s != (QMState *)0; s = s->superstate) { if (s == parent) { isFound = true; /* child is found */ break; @@ -1943,12 +1944,23 @@ for (QMState const *s = me->state.obj; child = s; } } +if (!isFound) { /* still not found? */ + for (s = me->temp.obj; s != (QMState *)0; s = s->superstate) { + if (s == parent) { + isFound = true; /* child is found */ + break; + } + else { + child = s; + } + } +} /*! @post the child must be found */ Q_ENSURE_ID(810, isFound); #ifdef Q_NASSERT -(void)isFound; /* avoid compiler warning about unused variable */ +Q_UNUSED_PAR(isFound); #endif return child; /* return the child */ @@ -1962,7 +1974,7 @@ return child; /* return the child */ * Performs the first step of QMsm initialization by assigning the initial * pseudostate to the currently active state of the state machine. * -* @param[in,out] me pointer (see @ref oop) +* @param[in,out] me current instance pointer (see @ref oop) * @param[in] initial the top-most initial transition for the MSM. * * @note @@ -2003,7 +2015,7 @@ me->super.temp.fun = initial; /* the initial transition handler */ #ifndef Q_SPY -(void)qs_id; /* unused parameter */ +Q_UNUSED_PAR(qs_id); #endif /*! @pre the virtual pointer must be initialized, the top-most initial @@ -2066,7 +2078,7 @@ QS_END_PRE_() * Dispatches an event for processing to a meta state machine (MSM). * The processing of an event represents one run-to-completion (RTC) step. * -* @param[in,out] me pointer (see @ref oop) +* @param[in,out] me current instance pointer (see @ref oop) * @param[in] e pointer to the event to be dispatched to the MSM * @param[in] qs_id QS-id of this state machine (for QS local filter) * @@ -2081,7 +2093,7 @@ QS_END_PRE_() #ifndef Q_SPY -(void)qs_id; /* unused parameter */ +Q_UNUSED_PAR(qs_id); #endif QMState const *s = me->state.obj; /* store the current state */ @@ -2149,6 +2161,7 @@ if (r >= Q_RET_TRAN) { /* was TRAN, TRAN_INIT, or TRAN_EP taken? */ if (r <= Q_RET_TRAN_EP) { + me->temp.obj = (QMState *)0; /* clear */ QMsm_exitToTranSource_(me, s, t, qs_id); r = QMsm_execTatbl_(me, tatbl, qs_id); s = me->state.obj; @@ -2260,7 +2273,7 @@ else { * @details * Helper function to execute transition sequence in a transition-action table. * -* @param[in,out] me pointer (see @ref oop) +* @param[in,out] me current instance pointer (see @ref oop) * @param[in] tatbl pointer to the transition-action table * @param[in] qs_id QS-id of this state machine (for QS local filter) * @@ -2277,7 +2290,9 @@ else { - Q_UNUSED_PAR(qs_id); /* when Q_SPY undefined */ + #ifndef Q_SPY +Q_UNUSED_PAR(qs_id); +#endif QState r = Q_RET_NULL; QS_CRIT_STAT_ @@ -2350,7 +2365,7 @@ return r; * transition source, which in a hierarchical state machine might be a * superstate of the current state. * -* @param[in,out] me pointer (see @ref oop) +* @param[in,out] me current instance pointer (see @ref oop) * @param[in] cs pointer to the current state * @param[in] ts pointer to the transition source state * @param[in] qs_id QS-id of this state machine (for QS local filter) @@ -2363,11 +2378,12 @@ return r; - Q_UNUSED_PAR(qs_id); /* when Q_SPY undefined */ - -QMState const *s = cs; + #ifndef Q_SPY +Q_UNUSED_PAR(qs_id); +#endif /* exit states from the current state to the tran. source state */ +QMState const *s = cs; while (s != ts) { /* exit action provided in state 's'? */ if (s->exitAction != Q_ACTION_CAST(0)) { @@ -2398,7 +2414,7 @@ while (s != ts) { * Static helper function to execute the segment of transition to history * after entering the composite state and * -* @param[in,out] me pointer (see @ref oop) +* @param[in,out] me current instance pointer (see @ref oop) * @param[in] hist pointer to the history substate * @param[in] qs_id QS-id of this state machine (for QS local filter) * @@ -2412,7 +2428,9 @@ while (s != ts) { - Q_UNUSED_PAR(qs_id); /* when Q_SPY undefined */ + #ifndef Q_SPY +Q_UNUSED_PAR(qs_id); +#endif QMState const *s = hist; QMState const *ts = me->state.obj; /* transition source */ @@ -2808,8 +2826,7 @@ return n + log2LUT[x]; \ (evtT_##_ctor((evtT_ *)QF_newX_((uint_fast16_t)sizeof(evtT_), \ - QF_NO_MARGIN, 0), (enum_t)(sig_), ##__VA_ARGS__)) - + QF_NO_MARGIN, (sig_)), (enum_t)(sig_), ##__VA_ARGS__)) @@ -2869,7 +2886,7 @@ return n + log2LUT[x]; do { \ (e_) = (evtT_ *)QF_newX_((uint_fast16_t)sizeof(evtT_), \ - (margin_), 0);\ + (margin_), (enum_t)(sig_));\ if ((e_) != (evtT_ *)0) { \ evtT_##_ctor((e_), (enum_t)(sig_), ##__VA_ARGS__); \ } \ @@ -2935,7 +2952,7 @@ return n + log2LUT[x]; * @details * Starts execution of the AO and registers the AO with the framework. * -* @param[in,out] me_ pointer (see @ref oop) +* @param[in,out] me_ current instance pointer (see @ref oop) * @param[in] prioSpec_ priority specification for the Active Object * @param[in] qSto_ pointer to the storage for the ring buffer of the * event queue (used only with the built-in ::QEQueue) @@ -2976,7 +2993,7 @@ return n + log2LUT[x]; * @details * This macro asserts if the queue overflows and cannot accept the event. * -* @param[in,out] me_ pointer (see @ref oop) +* @param[in,out] me_ current instance pointer (see @ref oop) * @param[in] e_ pointer to the event to post * @param[in] sender_ pointer to the sender object. * @@ -3025,7 +3042,7 @@ return n + log2LUT[x]; * This macro does not assert if the queue overflows and cannot accept * the event with the specified margin of free slots remaining. * -* @param[in,out] me_ pointer (see @ref oop) +* @param[in,out] me_ current instance pointer (see @ref oop) * @param[in] e_ pointer to the event to post * @param[in] margin_ the minimum free slots in the queue, which * must still be available after posting the event. @@ -3084,7 +3101,7 @@ return n + log2LUT[x]; /*! Virtual call to post an event to an active object using the * Last-In-First-Out (LIFO) policy. * -* @param[in,out] me_ pointer (see @ref oop) +* @param[in,out] me_ current instance pointer (see @ref oop) * @param[in] e_ pointer to the event to post */ @@ -3462,7 +3479,9 @@ me->super.vptr = &vtable.super; /* hook the vptr to QActive vtable */ - Q_UNUSED_PAR(sender); /* when Q_SPY undefined */ + #ifndef Q_SPY +Q_UNUSED_PAR(sender); +#endif /*! @pre event pointer must be valid */ Q_REQUIRE_ID(100, e != (QEvt *)0); @@ -3938,8 +3957,10 @@ QF_bzero(subscrSto, (uint_fast16_t)maxSignal * sizeof(QSubscrList)); - Q_UNUSED_PAR(sender); /* when Q_SPY undefined */ -Q_UNUSED_PAR(qs_id); /* when Q_SPY undefined */ + #ifndef Q_SPY +Q_UNUSED_PAR(sender); +Q_UNUSED_PAR(qs_id); +#endif /*! @pre the published signal must be within the configured range */ Q_REQUIRE_ID(200, e->sig < (QSignal)QActive_maxPubSignal_); @@ -4162,14 +4183,6 @@ for (QEvt const *e = QEQueue_get(eq, me->prio); } return n; - - - const - /*! Get the priority of the active object. -* @public @memberof QActive -*/ - return (QPrioSpec)me->prio | (me->pthre << 8U); - /*! Generic setting of additional attributes (useful in QP ports) @@ -4372,7 +4385,7 @@ QF_CRIT_X_(); * Performs the first step of active object initialization by assigning * the virtual pointer and calling the superclass constructor. * -* @param[in,out] me pointer (see @ref oop) +* @param[in,out] me current instance pointer (see @ref oop) * @param[in] initial pointer to the event to be dispatched to the MSM * * @note Must be called only ONCE before QHSM_INIT(). @@ -4516,7 +4529,7 @@ me->super.super.vptr = &vtable.super; /* hook vptr to QMActive vtable */< * `act`, tick rate `tickRate` and event signal `sig`. You cannot change * these attributes later. * -* @param[in,out] me pointer (see @ref oop) +* @param[in,out] me current instance pointer (see @ref oop) * @param[in] act pointer to the active object associated with this * time event. The time event will post itself to this AO. * @param[in] sig signal to associate with this time event. @@ -4578,7 +4591,7 @@ me->super.refCtr_ = (uint8_t)tickRate; * Also, a time event can be re-armed to fire in a different number of clock * ticks by calling the QTimeEvt_rearm(). * -* @param[in,out] me pointer (see @ref oop) +* @param[in,out] me current instance pointer (see @ref oop) * @param[in] nTicks number of clock ticks (at the associated rate) * to rearm the time event with. * @param[in] interval interval (in clock ticks) for periodic time event. @@ -4613,7 +4626,7 @@ Q_REQUIRE_ID(400, (me->act != (void *)0) && (tickRate < (uint_fast8_t)QF_MAX_TICK_RATE) && (me->super.sig >= (QSignal)Q_USER_SIG)); #ifdef Q_NASSERT -(void)ctr; /* avoid compiler warning about unused variable */ +Q_UNUSED_PAR(ctr); #endif QF_CRIT_STAT_ @@ -4660,7 +4673,7 @@ QF_CRIT_X_(); * @details * Disarm the time event so it can be safely reused. * -* @param[in,out] me pointer (see @ref oop) +* @param[in,out] me current instance pointer (see @ref oop) * * @returns * 'true' if the time event was truly disarmed, that is, it was running. @@ -4726,7 +4739,7 @@ return wasArmed; * Rearming a periodic timer leaves the interval unchanged and is a convenient * method to adjust the phasing of a periodic time event. * -* @param[in,out] me pointer (see @ref oop) +* @param[in,out] me current instance pointer (see @ref oop) * @param[in] nTicks number of clock ticks (at the associated rate) * to rearm the time event with. * @@ -4810,7 +4823,7 @@ return wasArmed; * Useful for checking whether a one-shot time event was disarmed in the * QTimeEvt_disarm() operation. * -* @param[in,out] me pointer (see @ref oop) +* @param[in,out] me current instance pointer (see @ref oop) * * @returns * 'true' if the time event was truly disarmed in the last QTimeEvt_disarm() @@ -4840,7 +4853,7 @@ return wasDisarmed != 0U; * Useful for checking how many clock ticks (at the tick rate associated * with the time event) remain until the time event expires. * -* @param[in,out] me pointer (see @ref oop) +* @param[in,out] me current instance pointer (see @ref oop) * * @returns * For an armed time event, the function returns the current value of the @@ -4887,7 +4900,9 @@ return ret; - Q_UNUSED_PAR(sender); /* when Q_SPY undefined */ + #ifndef Q_SPY +Q_UNUSED_PAR(sender); +#endif QTimeEvt *prev = &QTimeEvt_timeEvtHead_[tickRate]; @@ -5091,7 +5106,7 @@ me->super.eQueue.head = (QEQueueCtr)tickRate; Q_UNUSED_PAR(me); Q_UNUSED_PAR(par); -Q_UNUSED_PAR(qs_id); /* when Q_SPY undefined */ +Q_UNUSED_PAR(qs_id); QTICKER_CAST_(me)->eQueue.tail = 0U; @@ -5106,15 +5121,13 @@ QTICKER_CAST_(me)->eQueue.tail = 0U; - QEQueueCtr nTicks; /* # ticks since the last call */ + Q_UNUSED_PAR(e); +Q_UNUSED_PAR(qs_id); + QF_CRIT_STAT_ - -Q_UNUSED_PAR(e); -Q_UNUSED_PAR(qs_id); /* when Q_SPY undefined */ - QF_CRIT_E_(); -nTicks = QTICKER_CAST_(me)->eQueue.tail; /* save the # of ticks */ -QTICKER_CAST_(me)->eQueue.tail = 0U; /* clear the # ticks */ +QEQueueCtr nTicks = QTICKER_CAST_(me)->eQueue.tail; /* save # of ticks */ +QTICKER_CAST_(me)->eQueue.tail = 0U; /* clear # ticks */ QF_CRIT_X_(); for (; nTicks > 0U; --nTicks) { @@ -5136,7 +5149,9 @@ for (; nTicks > 0U; --nTicks) { Q_UNUSED_PAR(e); Q_UNUSED_PAR(margin); -Q_UNUSED_PAR(sender); /* when Q_SPY undefined */ +#ifndef Q_SPY +Q_UNUSED_PAR(sender); +#endif QF_CRIT_STAT_ QF_CRIT_E_(); @@ -5292,7 +5307,7 @@ Q_ERROR_ID(900); * @details * Initialize the event queue by giving it the storage for the ring buffer. * -* @param[in,out] me pointer (see @ref oop) +* @param[in,out] me current instance pointer (see @ref oop) * @param[in] qSto an array of pointers to ::QEvt to sereve as the * ring buffer for the event queue * @param[in] qLen the length of the `qSto` buffer (in ::QEvt pointers) @@ -5328,7 +5343,7 @@ me->nMin = me->nFree; * Post an event to the "raw" thread-safe event queue using the * First-In-First-Out (FIFO) order. * -* @param[in,out] me pointer (see @ref oop) +* @param[in,out] me current instance pointer (see @ref oop) * @param[in] e pointer to the event to be posted to the queue * @param[in] margin number of required free slots in the queue after * posting the event. The special value #QF_NO_MARGIN @@ -5352,10 +5367,12 @@ me->nMin = me->nFree; - /* @pre event must be valid */ -Q_REQUIRE_ID(200, e != (QEvt *)0); + #ifndef Q_SPY +Q_UNUSED_PAR(qs_id); +#endif -(void)qs_id; /* unused parameter (outside Q_SPY build configuration) */ +/* @pre event must be valid */ +Q_REQUIRE_ID(200, e != (QEvt *)0); QF_CRIT_STAT_ QF_CRIT_E_(); @@ -5432,7 +5449,7 @@ return status; * Post an event to the "raw" thread-safe event queue using the * Last-In-First-Out (LIFO) order. * -* @param[in,out] me pointer (see @ref oop) +* @param[in,out] me current instance pointer (see @ref oop) * @param[in] e pointer to the event to be posted to the queue * * @attention @@ -5453,7 +5470,9 @@ return status; - (void)qs_id; /* unused parameter, if Q_SPY not defined */ + #ifndef Q_SPY +Q_UNUSED_PAR(qs_id); +#endif QF_CRIT_STAT_ QF_CRIT_E_(); @@ -5504,7 +5523,7 @@ QF_CRIT_X_(); * Retrieves an event from the front of the "raw" thread-safe queue and * returns a pointer to this event to the caller. * -* @param[in,out] me pointer (see @ref oop) +* @param[in,out] me current instance pointer (see @ref oop) * * @returns * pointer to event at the front of the queue, if the queue is @@ -5519,7 +5538,9 @@ QF_CRIT_X_(); */ - (void)qs_id; /* unused parameter (outside Q_SPY build configuration) */ + #ifndef Q_SPY +Q_UNUSED_PAR(qs_id); +#endif QF_CRIT_STAT_ QF_CRIT_E_(); @@ -5578,7 +5599,7 @@ return e; * only from a single thread (by a single AO), so the number of free * entries cannot change unexpectedly. * -* @param[in] me pointer (see @ref oop) +* @param[in] me current instance pointer (see @ref oop) * * @returns the current number of free slots in the queue. */ @@ -5596,7 +5617,7 @@ return e; * can change unexpectedly. The main intent for using this operation is to * get an idea of queue usage to size the queue adequately. * -* @param[in] me pointer (see @ref oop) +* @param[in] me current instance pointer (see @ref oop) * * @returns the minimum number of free entries ever in the queue since init. */ @@ -5616,7 +5637,7 @@ return e; * from a single thread (by a single AO), so no other entity can post * events to the queue. * -* @param[in] me_ pointer (see @ref oop) +* @param[in] me_ current instance pointer (see @ref oop) * * @returns 'true' if the queue is current empty and 'false' otherwise. */ @@ -5703,7 +5724,7 @@ return e; * Initialize a fixed block-size memory pool by providing it with the pool * memory to manage, size of this memory, and the block size. * -* @param[in,out] me pointer (see @ref oop) +* @param[in,out] me current instance pointer (see @ref oop) * @param[in] poolSto pointer to the memory buffer for pool storage * @param[in] poolSize size of the storage buffer in bytes * @param[in] blockSize fixed-size of the memory blocks in bytes @@ -5793,7 +5814,7 @@ me->end = fb; /* the last block in this pool */ * The function allocates a memory block from the pool and returns a pointer * to the block back to the caller. * -* @param[in,out] me pointer (see @ref oop) +* @param[in,out] me current instance pointer (see @ref oop) * @param[in] margin the minimum number of unused blocks still available * in the pool after the allocation. * @@ -5824,7 +5845,9 @@ me->end = fb; /* the last block in this pool */ - Q_UNUSED_PAR(qs_id); /* when Q_SPY undefined */ + #ifndef Q_SPY +Q_UNUSED_PAR(qs_id); +#endif QF_CRIT_STAT_ QF_CRIT_E_(); @@ -5900,7 +5923,7 @@ return fb; /* return the block or NULL pointer to the caller */ * @details * Recycle a memory block to the fixed block-size memory pool. * -* @param[in,out] me pointer (see @ref oop) +* @param[in,out] me current instance pointer (see @ref oop) * @param[in] b pointer to the memory block that is being recycled * * @attention @@ -5921,7 +5944,9 @@ return fb; /* return the block or NULL pointer to the caller */ - Q_UNUSED_PAR(qs_id); /* when Q_SPY undefined */ + #ifndef Q_SPY +Q_UNUSED_PAR(qs_id); +#endif /*! @pre number of free blocks cannot exceed the total # blocks and * the block pointer must be in range for this pool. @@ -6072,9 +6097,13 @@ return min; * @static @public @memberof QF * * @details -* The timeline for calling QF_onStartup() depends on the particular -* QF port. In most cases, QF_onStartup() is called from QF_run(), right -* before starting any multitasking kernel or the background loop. +* The purpose of the QF_onStartup() callback is to configure and enable +* hardware interrupts. The callback is invoked from QF_run(), right before +* starting the underlying real-time kernel. By that time, the application +* is considered ready to receive and service interrupts. +* +* This function is application-specific and is not implemented in QF, but +* rather in the Board Support Package (BSP) for the given application. */ @@ -6084,7 +6113,7 @@ return min; * * @details * QF_onCleanup() is called in some QF ports before QF returns to the -* underlying operating system or RTOS. +* underlying real-time kernel or operating system. * * This function is strongly platform-specific and is not implemented in * the QF, but either in the QF port or in the Board Support Package (BSP) @@ -6385,7 +6414,9 @@ if (e->poolId_ != 0U) { - Q_UNUSED_PAR(evtRef); /* in case Q_NASSERT is defined */ + #ifdef Q_NASSERT +Q_UNUSED_PAR(evtRef); +#endif /*! @pre the event must be dynamic and the provided event reference * must not be already in use */ @@ -6484,6 +6515,37 @@ for (uint_fast16_t n = len; n > 0U; --n) { } + + + + + /*! QF context switch callback used in built-in kernels (QV, QK, QXK) +* @static @public @memberof QF +* +* @details +* This callback function provides a mechanism to perform additional +* custom operations when one of the built-in kernels switches context +* from one thread to another. +* +* @param[in] prev pointer to the previous thread (active object) +* (prev==0 means that `prev` was the idle loop) +* @param[in] next pointer to the next thread (active object) +* (next==0) means that `next` is the idle loop) +* @attention +* QF_onContextSw() is invoked with interrupts **disabled** and must also +* return with interrupts **disabled**. +* +* @note +* This callback is enabled by defining the macro #QF_ON_CONTEXT_SW. +* +* @include qf_oncontextsw.c +*/ + + + + + + @@ -6542,6 +6604,20 @@ for (uint_fast16_t n = len; n > 0U; --n) { + + + /*! The size [bytes] of the internal QS buffer-counters. Valid values: 2U or 4U; +* default 2U. +* +* @details +* This macro can be defined in the QS port file (qs_port.h) to +* configure the ::QSCtr type. Here the macro is not defined so the +* default of 2 byte is chosen. +*/ + 2U + + + /*! The size [bytes] of the QS time stamp. Valid values: 1U, 2U, or 4U; @@ -6611,8 +6687,8 @@ for (uint_fast16_t n = len; n > 0U; --n) { * if #Q_SPY is defined, or do nothing if #Q_SPY is not defined. * * @sa -* - ::QSpyRecordGroups - QS record groups that can be used as `rec_` -* - ::QSpyRecords - individual QS records that can be used as `rec_` +* - enum QSpyGroups - QS record groups that can be used as `rec_` +* - enum QSpyPre - predefined QS records that can be used as `rec_` * * @usage * The following example shows how to use QS filters: @@ -6631,8 +6707,8 @@ for (uint_fast16_t n = len; n > 0U; --n) { * if #Q_SPY is defined, or do nothing if #Q_SPY is not defined. * * @sa -* - ::QSpyIdGroups - QS ID groups that can be used as `qs_id_` -* - ::QSpyIdOffsets - QS ID offsets for `qs_id_` (e.g., QS_AP_IDS + 5) +* - enum QSpyIdGroups - QS ID groups that can be used as `qs_id_` +* - enum QSpyIdOffsets - QS ID offsets for `qs_id_` (e.g., QS_AP_IDS + 5) * * The following example shows how to use QS filters: * @include qs_filter.c @@ -6653,7 +6729,7 @@ for (uint_fast16_t n = len; n > 0U; --n) { * @note * Must always be used in pair with QS_END() * -* @include qs_user.c +* @include qs_ap.c */ @@ -6744,7 +6820,8 @@ if (QS_GLB_CHECK_(rec_) && QS_LOC_CHECK_(qs_id_)) { \ \ - (QS_u8_fmt_((uint8_t)(((width_) << 4)) | (uint8_t)QS_I8_T, (data_))) + (QS_u8_fmt_((uint8_t)(((width_) << 4U) & 0x7U) | (uint8_t)QS_I8_ENUM_T, \ + (data_))) @@ -6852,6 +6929,17 @@ if (QS_GLB_CHECK_(rec_) && QS_LOC_CHECK_(qs_id_)) { \ (QS_mem_fmt_((mem_), (size_))) + + + /*! Output formatted enumeration to the QS record */ + + + + + \ + (QS_u8_fmt_((uint8_t)(0x80U | ((group_) << 4U)) | (uint8_t)QS_I8_ENUM_T,\ + (uint8_t)(value_))) + /*! Output time stamp to a QS record (used in predefined @@ -7077,6 +7165,21 @@ if (QS_GLB_CHECK_(rec_) && QS_LOC_CHECK_(qs_id_)) { \ \ (QS_usr_dict_pre_((rec_), #rec_)) + + + /*! Output enumeration dictionary record +* +* @details +* An enum QS record dictionary record associates the numerical value of +* an enumeration with the human-readable identifier. +*/ + + + + + \ + (QS_enum_dict_pre_((value_), (group_), #value_)) + /*! Output the critical section entry record */ @@ -7116,9 +7219,37 @@ QS_END_NOCRIT_PRE_() (act_) + + + /*! Constant representing End-Of-Data condition returned from the +* QS_getByte() function. +*/ + ((uint16_t)0xFFFFU) + + + + /*! Constant representing command enumeration group +* in QS_ENUM_DICTIONARY() and QS_ENUM() +* @sa QS_onCommand() +*/ + ((uint8_t)7U) + + + + /*! Constant representing HEX format for the "width" filed +* in QS_U8(), QS_U16(), QS_U32(), and QS_U64(). +*/ + ((uint8_t)0x0FU) + + + + /*! QS ring buffer counter and offset type */ + + + /*! QS time stamp type, which determines the dynamic range of QS time stamps */ @@ -7137,10 +7268,6 @@ QS_END_NOCRIT_PRE_() - - - /*! QS ring buffer counter and offset type */ - /*! QS pre-defined record types (TX channel) @@ -7238,7 +7365,9 @@ QS_END_NOCRIT_PRE_() QS_SCHED_UNLOCK, /*!< scheduler was unlocked */ QS_SCHED_NEXT, /*!< scheduler started new task */ QS_SCHED_IDLE, /*!< scheduler restored the idle task */ - QS_SCHED_RESUME, /*!< scheduler resumed a (blocked) task */ + + /* [54] Miscellaneous QS records (not maskable) */ + QS_ENUM_DICT, /*!< enumeration dictionary entry */ /* [55] Additional QEP records */ QS_QEP_TRAN_HIST, /*!< a tran to history was taken */ @@ -7348,14 +7477,6 @@ QS_END_NOCRIT_PRE_() */ )(void); - - - /*! Constant representing End-Of-Data condition returned from the -* QS_getByte() function. -* @static @public @memberof QS_tx -*/ - ((uint16_t)0xFFFFU) - /*! @brief QS ID type for applying local filtering @@ -7415,32 +7536,30 @@ QS_END_NOCRIT_PRE_() /*! critical section nesting level */ + + + /* flags for internal use */ + - /*! Enumerates data formats recognized by QS -* -* @details -* QS uses this enumeration is used only internally for the formatted -* user data elements. -*/ + /*! Enumerates data elements for app-specific trace records */ { - QS_I8_T, /*!< signed 8-bit integer format */ - QS_U8_T, /*!< unsigned 8-bit integer format */ - QS_I16_T, /*!< signed 16-bit integer format */ - QS_U16_T, /*!< unsigned 16-bit integer format */ - QS_I32_T, /*!< signed 32-bit integer format */ - QS_U32_T, /*!< unsigned 32-bit integer format */ - QS_F32_T, /*!< 32-bit floating point format */ - QS_F64_T, /*!< 64-bit floating point format */ - QS_STR_T, /*!< zero-terminated ASCII string format */ - QS_MEM_T, /*!< up to 255-bytes memory block format */ - QS_SIG_T, /*!< event signal format */ - QS_OBJ_T, /*!< object pointer format */ - QS_FUN_T, /*!< function pointer format */ - QS_I64_T, /*!< signed 64-bit integer format */ - QS_U64_T, /*!< unsigned 64-bit integer format */ - QS_HEX_FMT /*!< HEX format for the "width" filed */ + QS_I8_ENUM_T, /*!< signed 8-bit integer or enum format */ + QS_U8_T, /*!< unsigned 8-bit integer format */ + QS_I16_T, /*!< signed 16-bit integer format */ + QS_U16_T, /*!< unsigned 16-bit integer format */ + QS_I32_T, /*!< signed 32-bit integer format */ + QS_U32_T, /*!< unsigned 32-bit integer format */ + QS_F32_T, /*!< 32-bit floating point format */ + QS_F64_T, /*!< 64-bit floating point format */ + QS_STR_T, /*!< zero-terminated ASCII string format */ + QS_MEM_T, /*!< up to 255-bytes memory block format */ + QS_SIG_T, /*!< event signal format */ + QS_OBJ_T, /*!< object pointer format */ + QS_FUN_T, /*!< function pointer format */ + QS_I64_T, /*!< signed 64-bit integer format */ + QS_U64_T, /*!< unsigned 64-bit integer format */ }; @@ -7479,7 +7598,7 @@ QS_END_NOCRIT_PRE_() - + /* the provided buffer must be at least 8 bytes long */ Q_REQUIRE_ID(100, stoSize > 8U); @@ -7635,9 +7754,11 @@ uint8_t const rec = isRemove ? (uint8_t)(-filter) : (uint8_t)filter; switch (rec) { case QS_ALL_RECORDS: { uint8_t const tmp = (isRemove ? 0x00U : 0xFFU); - uint_fast8_t i; /* set all global filters (partially unrolled loop) */ - for (i = 0U; i < Q_DIM(QS_priv_.glbFilter); i += 4U) { + for (uint_fast8_t i = 0U; + i < Q_DIM(QS_priv_.glbFilter); + i += 4U) + { QS_priv_.glbFilter[i ] = tmp; QS_priv_.glbFilter[i + 1U] = tmp; QS_priv_.glbFilter[i + 2U] = tmp; @@ -7648,6 +7769,7 @@ switch (rec) { * see qs.h, Miscellaneous QS records (not maskable) */ QS_priv_.glbFilter[0] = 0x01U; + QS_priv_.glbFilter[6] = 0x40U; QS_priv_.glbFilter[7] = 0xFCU; QS_priv_.glbFilter[8] = 0x7FU; } @@ -7727,10 +7849,10 @@ switch (rec) { break; case QS_SC_RECORDS: if (isRemove) { - QS_priv_.glbFilter[6] &= (uint8_t)(~0x7FU & 0xFFU); + QS_priv_.glbFilter[6] &= (uint8_t)(~0x3FU & 0xFFU); } else { - QS_priv_.glbFilter[6] |= 0x7FU; + QS_priv_.glbFilter[6] |= 0x3FU; } break; case QS_SEM_RECORDS: @@ -8409,6 +8531,29 @@ QS_u8_raw_((uint8_t)rec); QS_str_raw_(name); QS_endRec_(); QS_CRIT_X_(); +QS_onFlush(); + + + + /*! Output predefined enum-dictionary record +* @static @private @memberof QS_tx +* +* @note This function is only to be used through macro QS_ENUM_DICTIONARY() +*/ + + + + + + + QS_CRIT_STAT_ + +QS_CRIT_E_(); +QS_beginRec_((uint_fast8_t)QS_ENUM_DICT); +QS_2U8_PRE_((uint8_t)value, group); +QS_str_raw_(name); +QS_endRec_(); +QS_CRIT_X_(); QS_onFlush(); @@ -9559,6 +9704,7 @@ QS_CRIT_STAT_ QS_BEGIN_PRE_(QS_QF_RUN, 0U) QS_END_PRE_() +QS_processTestEvts_(); /* process all events posted so far */ QS_onTestLoop(); /* run the test loop */ QS_onCleanup(); /* application cleanup */ return 0; /* return no error */ @@ -9755,6 +9901,13 @@ me->super.vptr = &vtable; /* hook the vptr */ Q_UNUSED_PAR(par); +#ifdef Q_SPY +if ((QS_priv_.flags & 0x01U) == 0U) { + QS_priv_.flags |= 0x01U; + QS_FUN_DICTIONARY(&QHsm_top); +} +#endif + QS_CRIT_STAT_ QS_BEGIN_PRE_(QS_QEP_STATE_INIT, qs_id) QS_OBJ_PRE_(me); /* this state machine object */ @@ -9823,7 +9976,7 @@ me->super.super.vptr = &vtable.super; /* hook the vptr */ - (void)qs_id; /* unused parameter */ + Q_UNUSED_PAR(qs_id); QHsmDummy_init_(me, par, ((QActive const *)me)->prio); @@ -9838,7 +9991,7 @@ QHsmDummy_init_(me, par, ((QActive const *)me)->prio); - (void)qs_id; /* unused parameter */ + Q_UNUSED_PAR(qs_id); QHsmDummy_dispatch_(me, e, ((QActive const *)me)->prio); @@ -10059,39 +10212,53 @@ QV_INIT(); /* port-specific initialization of the QV kernel */ /*! QF_run() customization for QV kernel */ #ifdef Q_SPY -uint_fast8_t pprev = 0U; /* previously used priority */ -#endif +/* produce the QS_QF_RUN trace record */ +QF_INT_DISABLE(); +QS_beginRec_((uint_fast8_t)QS_QF_RUN); +QS_endRec_(); +QF_INT_ENABLE(); +#endif /* Q_SPY */ QF_onStartup(); /* application-specific startup callback */ -/* the combined event-loop and background-loop of the QV kernel... */ QF_INT_DISABLE(); -/* produce the QS_QF_RUN trace record */ -QS_BEGIN_NOCRIT_PRE_(QS_QF_RUN, 0U) -QS_END_NOCRIT_PRE_() +#ifdef QV_START +QV_START(); /* port-specific startup of the QV kernel */ +#endif + +#if (defined QF_ON_CONTEXT_SW) || (defined Q_SPY) +uint8_t pprev = 0U; /* previously used priority */ +#endif /* (defined QF_ON_CONTEXT_SW) || (defined Q_SPY) */ + +for (;;) { /* QV event loop... */ -for (;;) { /* find the maximum priority AO ready to run */ if (QPSet_notEmpty(&QF_readySet_)) { - uint_fast8_t const p = QPSet_findMax(&QF_readySet_); + uint8_t const p = (uint8_t)QPSet_findMax(&QF_readySet_); QActive * const a = QActive_registry_[p]; -#ifdef Q_SPY - QS_BEGIN_NOCRIT_PRE_(QS_SCHED_NEXT, a->prio) +#if (defined QF_ON_CONTEXT_SW) || (defined Q_SPY) + QS_BEGIN_NOCRIT_PRE_(QS_SCHED_NEXT, p) QS_TIME_PRE_(); /* timestamp */ QS_2U8_PRE_(p, /* priority of the scheduled AO */ pprev); /* previous priority */ QS_END_NOCRIT_PRE_() +#ifdef QF_ON_CONTEXT_SW + QF_onContextSw(((pprev != 0U) + ? QActive_registry_[pprev] + : (QActive *)0), a); +#endif /* QF_ON_CONTEXT_SW */ + pprev = p; /* update previous priority */ -#endif /* Q_SPY */ +#endif /* (defined QF_ON_CONTEXT_SW) || (defined Q_SPY) */ QF_INT_ENABLE(); /* perform the run-to-completion (RTC) step... - * 1. retrieve the event from the AO's event queue, which by this - * time must be non-empty and The "Vanialla" kernel asserts it. + * 1. retrieve the event from the AO's event queue, which + * by this time must be non-empty (and QV asserts it). * 2. dispatch the event to the AO's state machine. * 3. determine if event is garbage and collect it if so */ @@ -10107,27 +10274,33 @@ for (;;) { } } else { /* no AO ready to run --> idle */ -#ifdef Q_SPY +#if (defined QF_ON_CONTEXT_SW) || (defined Q_SPY) if (pprev != 0U) { - QS_BEGIN_NOCRIT_PRE_(QS_SCHED_IDLE, 0U) + QS_BEGIN_NOCRIT_PRE_(QS_SCHED_IDLE, pprev) QS_TIME_PRE_(); /* timestamp */ QS_U8_PRE_(pprev); /* previous priority */ QS_END_NOCRIT_PRE_() +#ifdef QF_ON_CONTEXT_SW + QF_onContextSw(QActive_registry_[pprev], (QActive *)0); +#endif /* QF_ON_CONTEXT_SW */ + pprev = 0U; /* update previous priority */ } -#endif /* Q_SPY */ +#endif /* (defined QF_ON_CONTEXT_SW) || (defined Q_SPY) */ - /* QV_onIdle() must be called with interrupts DISABLED because - * the determination of the idle condition (no events in the - * queues) can change at any time by an interrupt posting events - * to a queue. QV_onIdle() MUST enable interrupts internally, - * perhaps at the same time as putting the CPU into a power-saving - * mode. + /* QV_onIdle() must be called with interrupts DISABLED + * because the determination of the idle condition (all event + * queues empty) can change at any time by an interrupt posting + * events to a queue. + * + * NOTE: QV_onIdle() MUST enable interrupts internally, + * ideally at the same time as putting the CPU into a power- + * saving mode. */ QV_onIdle(); - QF_INT_DISABLE(); + QF_INT_DISABLE(); /* disable interrupts before looping back */ } } #ifdef __GNUC__ /* GNU compiler? */ @@ -10390,31 +10563,39 @@ QK_INIT(); /* port-specific initialization of the QK kernel */ * @sa QF_onCleanup() */ QF_onCleanup(); /* application-specific cleanup callback */ -/* nothing else to do for the cooperative QK kernel */ +/* nothing else to do for the preemptive QK kernel */ /*! QF_run() customization for QK kernel */ - QF_INT_DISABLE(); -QK_attr_.lockCeil = 0U; /* scheduler unlocked */ - -/* any active objects need to be scheduled before starting event loop? */ -if (QK_sched_() != 0U) { - QK_activate_(); /* activate AOs to process events posted so far */ -} + #ifdef Q_SPY +/* produce the QS_QF_RUN trace record */ +QF_INT_DISABLE(); +QS_beginRec_((uint_fast8_t)QS_QF_RUN); +QS_endRec_(); +QF_INT_ENABLE(); +#endif /* Q_SPY */ QF_onStartup(); /* application-specific startup callback */ -/* produce the QS_QF_RUN trace record (no nested critical section) */ -QS_BEGIN_NOCRIT_PRE_(QS_QF_RUN, 0U) -QS_END_NOCRIT_PRE_() +QF_INT_DISABLE(); + +QK_attr_.lockCeil = 0U; /* unlock the QK scheduler */ + +/* activate AOs to process events posted so far */ +if (QK_sched_() != 0U) { + QK_activate_(); +} + +#ifdef QK_START +QK_START(); /* port-specific startup of the QK kernel */ +#endif QF_INT_ENABLE(); - -/* the QK idle loop... */ -for (;;) { +for (;;) { /* QK idle loop... */ QK_onIdle(); /* application-specific QK on-idle callback */ } + #ifdef __GNUC__ return 0; #endif @@ -10525,16 +10706,16 @@ return p; * returns with interrupts **disabled**. */ uint8_t const prio_in = QK_attr_.actPrio; /* saved initial priority */ -uint_fast8_t p = QK_attr_.nextPrio; /* next prio to run */ +uint8_t p = QK_attr_.nextPrio; /* next prio to run */ QK_attr_.nextPrio = 0U; /* clear for the next time */ /* QK_attr_.actPrio and QK_attr_.nextPrio must be in range */ Q_REQUIRE_ID(500, (prio_in <= QF_MAX_ACTIVE) && (0U < p) && (p <= QF_MAX_ACTIVE)); -#if (defined QK_ON_CONTEXT_SW) || (defined Q_SPY) -uint_fast8_t pprev = prio_in; -#endif /* QK_ON_CONTEXT_SW || Q_SPY */ +#if (defined QF_ON_CONTEXT_SW) || (defined Q_SPY) +uint8_t pprev = prio_in; +#endif /* QF_ON_CONTEXT_SW || Q_SPY */ /* loop until no more ready-to-run AOs of higher pthre than the initial */ QActive *a; @@ -10542,27 +10723,27 @@ do { a = QActive_registry_[p]; /* obtain the pointer to the AO */ /* set new active priority and preemption-threshold */ - QK_attr_.actPrio = (uint8_t)p; + QK_attr_.actPrio = p; QK_attr_.actThre = QActive_registry_[p]->pthre; -#if (defined QK_ON_CONTEXT_SW) || (defined Q_SPY) - if (p != pprev) { /* changing threads? */ +#if (defined QF_ON_CONTEXT_SW) || (defined Q_SPY) + if (p != pprev) { /* changing threads? */ - QS_BEGIN_NOCRIT_PRE_(QS_SCHED_NEXT, a->prio) + QS_BEGIN_NOCRIT_PRE_(QS_SCHED_NEXT, p) QS_TIME_PRE_(); /* timestamp */ QS_2U8_PRE_(p, /* priority of the scheduled AO */ pprev); /* previous priority */ QS_END_NOCRIT_PRE_() -#ifdef QK_ON_CONTEXT_SW - QK_onContextSw(((pprev != 0U) +#ifdef QF_ON_CONTEXT_SW + QF_onContextSw(((pprev != 0U) ? QActive_registry_[pprev] : (QActive *)0), a); -#endif /* QK_ON_CONTEXT_SW */ +#endif /* QF_ON_CONTEXT_SW */ pprev = p; /* update previous priority */ } -#endif /* QK_ON_CONTEXT_SW || Q_SPY */ +#endif /* QF_ON_CONTEXT_SW || Q_SPY */ QF_INT_ENABLE(); /* unconditionally enable interrupts */ @@ -10573,7 +10754,7 @@ do { * 3. determine if event is garbage and collect it if so */ QEvt const * const e = QActive_get_(a); - QHSM_DISPATCH(&a->super, e, a->prio); + QHSM_DISPATCH(&a->super, e, p); #if (QF_MAX_EPOOL > 0U) QF_gc(e); #endif @@ -10590,7 +10771,7 @@ do { } else { /* find new highest-prio AO ready to run... */ - p = QPSet_findMax(&QF_readySet_); + p = (uint8_t)QPSet_findMax(&QF_readySet_); /* is the new priority below the initial preemption-threshold? */ if (p <= (uint_fast8_t)QActive_registry_[prio_in]->pthre) { @@ -10610,11 +10791,11 @@ do { QK_attr_.actPrio = prio_in; QK_attr_.actThre = QActive_registry_[prio_in]->pthre; -#if (defined QK_ON_CONTEXT_SW) || (defined Q_SPY) +#if (defined QF_ON_CONTEXT_SW) || (defined Q_SPY) if (prio_in != 0U) { /* resuming an active object? */ a = QActive_registry_[prio_in]; /* pointer to the preempted AO */ - QS_BEGIN_NOCRIT_PRE_(QS_SCHED_NEXT, a->prio) + QS_BEGIN_NOCRIT_PRE_(QS_SCHED_NEXT, prio_in) QS_TIME_PRE_(); /* timestamp */ /* priority of the resumed AO, previous priority */ QS_2U8_PRE_(prio_in, pprev); @@ -10623,45 +10804,17 @@ if (prio_in != 0U) { /* resuming an active object? */ else { /* resuming priority==0 --> idle */ a = (QActive *)0; /* QK idle loop */ - QS_BEGIN_NOCRIT_PRE_(QS_SCHED_IDLE, 0U) + QS_BEGIN_NOCRIT_PRE_(QS_SCHED_IDLE, pprev) QS_TIME_PRE_(); /* timestamp */ QS_U8_PRE_(pprev); /* previous priority */ QS_END_NOCRIT_PRE_() } -#ifdef QK_ON_CONTEXT_SW -QK_onContextSw(QActive_registry_[pprev], a); -#endif /* QK_ON_CONTEXT_SW */ +#ifdef QF_ON_CONTEXT_SW +QF_onContextSw(QActive_registry_[pprev], a); +#endif /* QF_ON_CONTEXT_SW */ -#endif /* QK_ON_CONTEXT_SW || Q_SPY */ - - - - /*! QK context switch callback (customized in BSPs for QK) -* @static @public @memberof QK -* -* @details -* This callback function provides a mechanism to perform additional -* custom operations when QK switches context from one thread to -* another. -* -* @param[in] prev pointer to the previous thread (active object) -* (prev==0 means that `prev` was the QK idle loop) -* @param[in] next pointer to the next thread (active object) -* (next==0) means that `next` is the QK idle loop) -* @attention -* QK_onContextSw() is invoked with interrupts **disabled** and must also -* return with interrupts **disabled**. -* -* @note -* This callback is enabled by defining the macro #QK_ON_CONTEXT_SW. -* -* @include qk_oncontextsw.c -*/ - - - - +#endif /* QF_ON_CONTEXT_SW || Q_SPY */ @@ -10903,6 +11056,7 @@ static QActive const idle_ao = { (struct QHsmVtable const *)0 }; /* register the idle AO object (cast 'const' away) */ QActive_registry_[0] = (QActive *)&idle_ao; +QXK_attr_.prev = QActive_registry_[0]; #ifdef QXK_INIT QXK_INIT(); /* port-specific initialization of the QXK kernel */ @@ -10915,33 +11069,38 @@ QXK_INIT(); /* port-specific initialization of the QXK kernel */ * @sa QF_onCleanup() */ QF_onCleanup(); /* application-specific cleanup callback */ -/* nothing else to do for the cooperative QXK kernel */ +/* nothing else to do for the dual-mode QXK kernel */ /*! QF_run() customization for QXK kernel */ - QF_INT_DISABLE(); -QXK_attr_.prev = QActive_registry_[0]; /* the QXK idle thread */ -QXK_attr_.lockCeil = 0U; /* unlock the scheduler */ - -/* any active objects need to be scheduled before starting event loop? */ -if (QXK_sched_() != 0U) { /* activation needed? */ - QXK_activate_(); /* synchronously activate basic-thred(s) */ -} - -QF_onStartup(); /* application-specific startup callback */ - -/* produce the QS_QF_RUN trace record (no nested critical section) */ -QS_BEGIN_NOCRIT_PRE_(QS_QF_RUN, 0U) -QS_END_NOCRIT_PRE_() - -QF_INT_ENABLE(); - + #ifdef Q_SPY QS_SIG_DICTIONARY(QXK_DELAY_SIG, (void *)0); QS_SIG_DICTIONARY(QXK_TIMEOUT_SIG, (void *)0); -/* the QXK idle loop... */ -for (;;) { +/* produce the QS_QF_RUN trace record */ +QF_INT_DISABLE(); +QS_beginRec_((uint_fast8_t)QS_QF_RUN); +QS_endRec_(); +QF_INT_ENABLE(); +#endif /* Q_SPY */ + +QF_onStartup(); /* application-specific startup callback */ + +QF_INT_DISABLE(); + +QXK_attr_.lockCeil = 0U; /* unlock the QXK scheduler */ +/* activate AOs to process events posted so far */ +if (QXK_sched_() != 0U) { + QXK_activate_(); +} + +#ifdef QXK_START +QXK_START(); /* port-specific startup of the QXK kernel */ +#endif + +QF_INT_ENABLE(); +for (;;) { /* QXK idle loop... */ QXK_onIdle(); /* application-specific QXK idle callback */ } @@ -10989,7 +11148,7 @@ return 0; * thread-handler function and the tick rate at which it will handle * the timeouts. * -* @param[in,out] me pointer (see @ref oop) +* @param[in,out] me current instance pointer (see @ref oop) * @param[in] handler the thread-handler function * @param[in] tickRate the ticking rate for timeouts in this thread * (see QXThread_delay() and QTIMEEVT_TICK_X()) @@ -11234,7 +11393,7 @@ return e; Q_UNUSED_PAR(me); Q_UNUSED_PAR(par); -Q_UNUSED_PAR(qs_id); /* when Q_SPY undefined */ +Q_UNUSED_PAR(qs_id); Q_ERROR_ID(110); @@ -11263,7 +11422,7 @@ Q_ERROR_ID(120); * The extended thread becomes ready-to-run immediately and is scheduled * if the QXK is already running. * -* @param[in,out] me pointer (see @ref oop) +* @param[in,out] me current instance pointer (see @ref oop) * @param[in] prio QF-priority of the thread, but no preemption- * threshold. See also ::QPrioSpec. * @param[in] qSto pointer to the storage for the ring buffer of the @@ -11358,7 +11517,7 @@ QF_CRIT_X_(); * returns 1 (success) if the posting succeeded (with the provided margin) * and 0 (failure) when the posting fails. * -* @param[in,out] me pointer (see @ref oop) +* @param[in,out] me current instance pointer (see @ref oop) * @param[in] e pointer to the event to be posted * @param[in] margin number of required free slots in the queue after * posting the event. The special value #QF_NO_MARGIN @@ -11392,7 +11551,9 @@ QF_CRIT_X_(); - Q_UNUSED_PAR(sender); /* when Q_SPY undefined */ + #ifndef Q_SPY +Q_UNUSED_PAR(sender); +#endif QF_CRIT_STAT_ QS_TEST_PROBE_DEF(&QXThread_post_) @@ -11532,8 +11693,8 @@ return status; * @details * Last-In-First-Out (LIFO) policy is not supported for extened threads. * -* @param[in] me pointer (see @ref oop) -* @param[in] e pointer to the event to post to the queue +* @param[in] me current instance pointer (see @ref oop) +* @param[in] e pointer to the event to post to the queue * * @sa * QActive_postLIFO_() @@ -11766,7 +11927,7 @@ QF_CRIT_X_(); * mechanism, the initial count should set to 0 and maximum count to 1 * (binary semaphore). * -* @param[in,out] me pointer (see @ref oop) +* @param[in,out] me current instance pointer (see @ref oop) * @param[in] count initial value of the semaphore counter * @param[in] max_count maximum value of the semaphore counter. * The purpose of the max_count is to limit the counter @@ -11803,11 +11964,11 @@ QPSet_setEmpty(&me->waitSet); * expires. If the semaphore is signaled before the timeout expires, QXK * resumes the highest-priority extended thread waiting for the semaphore. * -* @param[in,out] me pointer (see @ref oop) -* @param[in] nTicks number of clock ticks (at the associated rate) -* to wait for the semaphore. The value of -* ::QXTHREAD_NO_TIMEOUT indicates that no timeout will -* occur and the semaphore will wait indefinitely. +* @param[in,out] me current instance pointer (see @ref oop) +* @param[in] nTicks number of clock ticks (at the associated rate) +* to wait for the semaphore. The value of +* ::QXTHREAD_NO_TIMEOUT indicates that no timeout will +* occur and the semaphore will wait indefinitely. * * @returns * 'true' if the semaphore has been signaled and 'false' if a timeout @@ -11908,7 +12069,7 @@ return signaled; * This function checks if the semaphore counter is greater than 0, * in which case the counter is decremented. * -* @param[in,out] me pointer (see @ref oop) +* @param[in,out] me current instance pointer (see @ref oop) * * @returns * 'true' if the semaphore has count available and 'false' NOT available. @@ -11968,7 +12129,7 @@ return isAvailable; * this thread ready-to-run. The QXK scheduler is then called to determine if * the awakened thread is now the highest-priority thread that is ready-to-run. * -* @param[in,out] me pointer (see @ref oop) +* @param[in,out] me current instance pointer (see @ref oop) * * @returns * 'true' when the semaphore signaled and 'false' when the semaphore count @@ -12094,7 +12255,7 @@ return signaled; * @details * Initialize the QXK priority ceiling mutex. * -* @param[in,out] me pointer (see @ref oop) +* @param[in,out] me current instance pointer (see @ref oop) * @param[in] prioSpec the priority specification for the mutex * (See also ::QPrioSpec). This value might * also be zero. @@ -12128,7 +12289,7 @@ if (prioSpec != 0U) { /* priority-ceiling protocol used? */ /*! lock the QXK priority-ceiling mutex ::QXMutex * @public @memberof QXMutex * -* @param[in,out] me pointer (see @ref oop) +* @param[in,out] me current instance pointer (see @ref oop) * @param[in] nTicks number of clock ticks (at the associated rate) * to wait for the mutex. The value of * ::QXTHREAD_NO_TIMEOUT indicates that no timeout will @@ -12286,7 +12447,7 @@ return locked; /*! try to lock the QXK priority-ceiling mutex ::QXMutex * @public @memberof QXMutex * -* @param[in,out] me pointer (see @ref oop) +* @param[in,out] me current instance pointer (see @ref oop) * * @returns * 'true' if the mutex was successfully locked and 'false' if the mutex was @@ -12403,7 +12564,7 @@ return curr != (QActive *)0; /*! unlock the QXK priority-ceiling mutex ::QXMutex * @public @memberof QXMutex *! -* @param[in,out] me pointer (see @ref oop) +* @param[in,out] me current instance pointer (see @ref oop) * * @note * This function **can** be called from both basic threads (active objects) @@ -12668,19 +12829,19 @@ QActive *next = QXK_attr_.next; /* the next AO (basic-thread) to run */ Q_REQUIRE_ID(700, (next != (QActive *)0) && (prio_in <= QF_MAX_ACTIVE)); /* QXK Context switch callback defined or QS tracing enabled? */ -#if (defined QXK_ON_CONTEXT_SW) || (defined Q_SPY) +#if (defined QF_ON_CONTEXT_SW) || (defined Q_SPY) QXK_contextSw(next); -#endif /* QXK_ON_CONTEXT_SW || Q_SPY */ +#endif /* QF_ON_CONTEXT_SW || Q_SPY */ QXK_attr_.next = (QActive *)0; /* clear the next AO */ QXK_attr_.curr = (QActive *)0; /* current is basic-thread */ /* priority of the next thread */ -uint_fast8_t p = (uint_fast8_t)next->prio; +uint8_t p = next->prio; /* loop until no more ready-to-run AOs of higher prio than the initial */ do { - QXK_attr_.actPrio = (uint8_t)p; /* next active prio */ + QXK_attr_.actPrio = p; /* next active prio */ QF_INT_ENABLE(); /* unconditionally enable interrupts */ @@ -12709,14 +12870,14 @@ do { } else { /* find new highest-prio AO ready to run... */ - p = QPSet_findMax(&QF_readySet_); + p = (uint8_t)QPSet_findMax(&QF_readySet_); next = QActive_registry_[p]; /* next thread must be registered in QF */ Q_ASSERT_ID(710, next != (QActive *)0); /* is the next priority below the lock-ceiling? */ - if (p <= (uint_fast8_t)QXK_attr_.lockCeil) { + if (p <= QXK_attr_.lockCeil) { p = QXK_attr_.lockHolder; /* thread holding lock */ if (p != 0U) { Q_ASSERT_ID(720, QPSet_hasElement(&QF_readySet_, p)); @@ -12727,11 +12888,11 @@ do { if (next->osObject == (void *)0) { /* is the next priority above the initial priority? */ if (p > QActive_registry_[prio_in]->prio) { -#if (defined QXK_ON_CONTEXT_SW) || (defined Q_SPY) - if (p != QXK_attr_.actPrio) { /* changing threads? */ +#if (defined QF_ON_CONTEXT_SW) || (defined Q_SPY) + if (p != QXK_attr_.actPrio) { /* changing threads? */ QXK_contextSw(next); } -#endif /* QXK_ON_CONTEXT_SW || Q_SPY */ +#endif /* QF_ON_CONTEXT_SW || Q_SPY */ QXK_attr_.next = next; } else { @@ -12750,13 +12911,13 @@ do { /* restore the active priority */ QXK_attr_.actPrio = prio_in; -#if (defined QXK_ON_CONTEXT_SW) || (defined Q_SPY) +#if (defined QF_ON_CONTEXT_SW) || (defined Q_SPY) if (next->osObject == (void *)0) { QXK_contextSw((prio_in == 0U) ? (QActive *)0 : QActive_registry_[prio_in]); } -#endif /* QXK_ON_CONTEXT_SW || Q_SPY */ +#endif /* QF_ON_CONTEXT_SW || Q_SPY */ @@ -12796,13 +12957,13 @@ return curr; - + /*! QXK context switch management * @static @public @memberof QXK * * @details * This function performs software tracing (if #Q_SPY is defined) -* and calls QXK_onContextSw() (if #QXK_ON_CONTEXT_SW is defined) +* and calls QF_onContextSw() (if #QF_ON_CONTEXT_SW is defined) * * @param[in] next pointer to the next thread (NULL for basic-thread) * @@ -12818,60 +12979,25 @@ uint8_t const prev_prio = (QXK_attr_.prev != (QActive *)0) : 0U; #endif /* Q_SPY */ -uint8_t const next_prio = (next != (QActive *)0) - ? next->prio - : QXK_attr_.actPrio; - -if (next_prio == 0U) { /* going to idle? */ - QS_BEGIN_NOCRIT_PRE_(QS_SCHED_IDLE, 0U) +if (next != (QActive *)0) { /* next is NOT idle? */ + QS_BEGIN_NOCRIT_PRE_(QS_SCHED_NEXT, next->prio) + QS_TIME_PRE_(); /* timestamp */ + QS_2U8_PRE_(next->prio, prev_prio); + QS_END_NOCRIT_PRE_() +} +else { /* going to idle */ + QS_BEGIN_NOCRIT_PRE_(QS_SCHED_IDLE, prev_prio) QS_TIME_PRE_(); /* timestamp */ QS_U8_PRE_(prev_prio); QS_END_NOCRIT_PRE_() - -#ifdef QXK_ON_CONTEXT_SW - QXK_onContextSw(QXK_attr_.prev, (QActive *)0); -#endif /* QXK_ON_CONTEXT_SW */ } -else { - QS_BEGIN_NOCRIT_PRE_(QS_SCHED_NEXT, next_prio) - QS_TIME_PRE_(); /* timestamp */ - QS_2U8_PRE_(next_prio, prev_prio); - QS_END_NOCRIT_PRE_() -#ifdef QXK_ON_CONTEXT_SW - QXK_onContextSw(QXK_attr_.prev, next); -#endif /* QXK_ON_CONTEXT_SW */ -} +#ifdef QF_ON_CONTEXT_SW + QF_onContextSw(QXK_attr_.prev, next); +#endif /* QF_ON_CONTEXT_SW */ QXK_attr_.prev = next; /* update the previous thread */ - - - /*! QXK context switch callback (customized in BSPs for QXK) -* @static @public @memberof QXK -* -* @details -* This callback function provides a mechanism to perform additional -* custom operations when QXK switches context from one thread to -* another. -* -* @param[in] prev pointer to the previous thread (NULL for idle thead) -* @param[in] next pointer to the next thread (NULL for idle thead) -* -* @attention -* QXK_onContextSw() is invoked with interrupts **disabled** and must also -* return with interrupts **disabled**. -* -* @note -* This callback is enabled by defining the macro #QXK_ON_CONTEXT_SW. -* -* @include qxk_oncontextsw.c -*/ - - - - - @@ -12883,7 +13009,7 @@ QXK_attr_.prev = next; /* update the previous thread */ * @details * Starts execution of the thread and registers the AO with the framework. * -* @param[in,out] me_ pointer (see @ref oop) +* @param[in,out] me_ current instance pointer (see @ref oop) * @param[in] prioSpec_ priority specification at which to start the * extended thread (see ::QPrioSpec) * @param[in] qSto_ pointer to the storage for the ring buffer of the @@ -12931,7 +13057,7 @@ do { \ * This macro does not assert if the queue overflows and cannot accept * the event with the specified margin of free slots remaining. * -* @param[in,out] me_ pointer (see @ref oop) +* @param[in,out] me_ current instance pointer (see @ref oop) * @param[in] e_ pointer to the event to post * @param[in] margin_ the minimum free slots in the queue, which * must still be available after posting the event. @@ -13154,7 +13280,7 @@ $declare ${DbC} * major version number, Y is a 1-digit minor version number, and Z is * a 1-digit release number. */ -#define QP_VERSION 713U +#define QP_VERSION 720U /*! The current QP version as a zero terminated string literal. * @@ -13163,10 +13289,10 @@ $declare ${DbC} * major version number, Y is a 1-digit minor version number, and Z is * a 1-digit release number. */ -#define QP_VERSION_STR "7.1.3" +#define QP_VERSION_STR "7.2.0" -/*! Encrypted current QP release (7.1.3) and date (2022-11-18) */ -#define QP_RELEASE 0x7C340F56U +/*! Encrypted current QP release (7.2.0) and date (2023-01-06) */ +#define QP_RELEASE 0x76D8998FU /*==========================================================================*/ $declare ${glob-types} @@ -13202,6 +13328,7 @@ $declare ${QF::QTicker} $declare ${QF::QF-base} $declare ${QF::QF-dyn} +$declare ${QF::QF-extern-C} /*==========================================================================*/ $declare ${QF-macros} @@ -13738,7 +13865,9 @@ $declare ${QUTest-stub::QActiveDummy} #define QS_U32(width_, data_) ((void)0) #define QS_F32(width_, data_) ((void)0) #define QS_F64(width_, data_) ((void)0) +#define QS_I64(width_, data_) ((void)0) #define QS_U64(width_, data_) ((void)0) +#define QS_ENUM(group_, value_) ((void)0) #define QS_STR(str_) ((void)0) #define QS_MEM(mem_, size_) ((void)0) #define QS_SIG(sig_, obj_) ((void)0) @@ -13750,6 +13879,7 @@ $declare ${QUTest-stub::QActiveDummy} #define QS_OBJ_ARR_DICTIONARY(obj_, idx_) ((void)0) #define QS_FUN_DICTIONARY(fun_) ((void)0) #define QS_USR_DICTIONARY(rec_) ((void)0) +#define QS_ENUM_DICTIONARY(value_, group_) ((void)0) #define QS_ASSERTION(module_, loc_, delay_) ((void)0) #define QS_FLUSH() ((void)0) @@ -14125,7 +14255,7 @@ typedef char char_t; /*! @deprecated Output formatted uint32_t to the QS record */ #define QS_U32_HEX(width_, data_) \ - (QS_u32_fmt_((uint8_t)(((width_) << 4)) | (uint8_t)0x0FU, (data_))) + (QS_u32_fmt_((uint8_t)(((width_) << 4)) | QS_HEX_FMT, (data_))) #else @@ -14153,34 +14283,6 @@ typedef char char_t; * instead use: QHSM_DISPATCH() */ #define QMSM_DISPATCH(me_, e_) QHSM_DISPATCH((me_), (e_), 0U) -/*==========================================================================*/ -#if (QP_API_VERSION < 540) - -/*! @deprecated QFsm state machine; -* instead use: ::QHsm. Legacy state machines coded in the "QFsm-style" will -* continue to work, but will use the ::QHsm implementation internally. -* There is no longer any efficiency advantage in using the "QFsm-style" -* state machines. -* -* @note -* For efficiency, the recommended migration path is to use the ::QMsm -* state machine and the QM modeling tool. -*/ -typedef QHsm QFsm; - -/*! @deprecated QFsm state machine constructor; instead use: QHsm_ctor() */ -#define QFsm_ctor QHsm_ctor - -/*! deprecated macro to call in QFsm state-handler when it -* ignores (does not handle) an event (instead use Q_SUPER()) -*/ -#define Q_IGNORED() (Q_SUPER(&QHsm_top)) - -/*! @deprecated macro for cooperativew "Vanilla" kernel; -* instead use: QV_onIdle() */ -#define QF_onIdle QV_onIdle - -#endif /* QP_API_VERSION < 540 */ #endif /* QP_API_VERSION < 580 */ #endif /* QP_API_VERSION < 660 */ #endif /* QP_API_VERSION < 691 */ @@ -15493,9 +15595,9 @@ Q_NORETURN Q_onAssert( QS_STR_PRE_((module != (char *)0) ? module : "?"); QS_END_NOCRIT_PRE_() - QS_onFlush(); /* flush the assertion record to the host */ - QS_onTestLoop(); /* loop to wait for commands (typically reset) */ - QS_onReset(); /* in case the QUTEST loop ever returns, reset manually */ + QS_onFlush(); /* flush the assertion record to the host */ + QS_onCleanup(); /* cleanup after the failure */ + QS_onReset(); /* reset the target to prevent the code from continuing */ for (;;) { /* QS_onReset() should not return, but to ensure no-return */ } } diff --git a/src/qf/qep_hsm.c b/src/qf/qep_hsm.c index 4efc58d5..275b9cfc 100644 --- a/src/qf/qep_hsm.c +++ b/src/qf/qep_hsm.c @@ -3,7 +3,7 @@ * Model: qpc.qm * File: ${src::qf::qep_hsm.c} * -* This code has been generated by QM 5.2.3 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This code is covered by the following QP license: @@ -56,8 +56,8 @@ Q_DEFINE_THIS_MODULE("qep_hsm") /*==========================================================================*/ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ @@ -188,7 +188,12 @@ void QHsm_init_(QHsm * const me, void const * const e, uint_fast8_t const qs_id) { - #ifndef Q_SPY + #ifdef Q_SPY + if ((QS_priv_.flags & 0x01U) == 0U) { + QS_priv_.flags |= 0x01U; + QS_FUN_DICTIONARY(&QHsm_top); + } + #else Q_UNUSED_PAR(qs_id); #endif diff --git a/src/qf/qep_msm.c b/src/qf/qep_msm.c index f78324c4..1d948c55 100644 --- a/src/qf/qep_msm.c +++ b/src/qf/qep_msm.c @@ -3,7 +3,7 @@ * Model: qpc.qm * File: ${src::qf::qep_msm.c} * -* This code has been generated by QM 5.2.3 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This code is covered by the following QP license: @@ -68,8 +68,8 @@ static struct QMState const l_msm_top_s = { /*==========================================================================*/ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ @@ -107,11 +107,9 @@ QMState const * QMsm_childStateObj( { QMState const *child = me->state.obj; bool isFound = false; /* start with the child not found */ + QMState const *s; - for (QMState const *s = me->state.obj; - s != (QMState *)0; - s = s->superstate) - { + for (s = me->state.obj; s != (QMState *)0; s = s->superstate) { if (s == parent) { isFound = true; /* child is found */ break; @@ -120,12 +118,23 @@ QMState const * QMsm_childStateObj( child = s; } } + if (!isFound) { /* still not found? */ + for (s = me->temp.obj; s != (QMState *)0; s = s->superstate) { + if (s == parent) { + isFound = true; /* child is found */ + break; + } + else { + child = s; + } + } + } /*! @post the child must be found */ Q_ENSURE_ID(810, isFound); #ifdef Q_NASSERT - (void)isFound; /* avoid compiler warning about unused variable */ + Q_UNUSED_PAR(isFound); #endif return child; /* return the child */ @@ -155,7 +164,7 @@ void QMsm_init_( uint_fast8_t const qs_id) { #ifndef Q_SPY - (void)qs_id; /* unused parameter */ + Q_UNUSED_PAR(qs_id); #endif /*! @pre the virtual pointer must be initialized, the top-most initial @@ -202,7 +211,7 @@ void QMsm_dispatch_( uint_fast8_t const qs_id) { #ifndef Q_SPY - (void)qs_id; /* unused parameter */ + Q_UNUSED_PAR(qs_id); #endif QMState const *s = me->state.obj; /* store the current state */ @@ -270,6 +279,7 @@ void QMsm_dispatch_( /* was TRAN, TRAN_INIT, or TRAN_EP taken? */ if (r <= Q_RET_TRAN_EP) { + me->temp.obj = (QMState *)0; /* clear */ QMsm_exitToTranSource_(me, s, t, qs_id); r = QMsm_execTatbl_(me, tatbl, qs_id); s = me->state.obj; @@ -378,7 +388,9 @@ QState QMsm_execTatbl_( QMTranActTable const * const tatbl, uint_fast8_t const qs_id) { - Q_UNUSED_PAR(qs_id); /* when Q_SPY undefined */ + #ifndef Q_SPY + Q_UNUSED_PAR(qs_id); + #endif QState r = Q_RET_NULL; QS_CRIT_STAT_ @@ -449,11 +461,12 @@ void QMsm_exitToTranSource_( QMState const * const ts, uint_fast8_t const qs_id) { - Q_UNUSED_PAR(qs_id); /* when Q_SPY undefined */ - - QMState const *s = cs; + #ifndef Q_SPY + Q_UNUSED_PAR(qs_id); + #endif /* exit states from the current state to the tran. source state */ + QMState const *s = cs; while (s != ts) { /* exit action provided in state 's'? */ if (s->exitAction != Q_ACTION_CAST(0)) { @@ -482,7 +495,9 @@ QState QMsm_enterHistory_( QMState const *const hist, uint_fast8_t const qs_id) { - Q_UNUSED_PAR(qs_id); /* when Q_SPY undefined */ + #ifndef Q_SPY + Q_UNUSED_PAR(qs_id); + #endif QMState const *s = hist; QMState const *ts = me->state.obj; /* transition source */ diff --git a/src/qf/qf_act.c b/src/qf/qf_act.c index fb3a0475..b064c9bc 100644 --- a/src/qf/qf_act.c +++ b/src/qf/qf_act.c @@ -3,7 +3,7 @@ * Model: qpc.qm * File: ${src::qf::qf_act.c} * -* This code has been generated by QM 5.2.3 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This code is covered by the following QP license: diff --git a/src/qf/qf_actq.c b/src/qf/qf_actq.c index a2a94c53..95fd1660 100644 --- a/src/qf/qf_actq.c +++ b/src/qf/qf_actq.c @@ -3,7 +3,7 @@ * Model: qpc.qm * File: ${src::qf::qf_actq.c} * -* This code has been generated by QM 5.2.3 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This code is covered by the following QP license: @@ -59,8 +59,8 @@ Q_DEFINE_THIS_MODULE("qf_actq") /*==========================================================================*/ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ @@ -72,7 +72,9 @@ bool QActive_post_(QActive * const me, uint_fast16_t const margin, void const * const sender) { - Q_UNUSED_PAR(sender); /* when Q_SPY undefined */ + #ifndef Q_SPY + Q_UNUSED_PAR(sender); + #endif /*! @pre event pointer must be valid */ Q_REQUIRE_ID(100, e != (QEvt *)0); @@ -368,7 +370,7 @@ void QTicker_init_( { Q_UNUSED_PAR(me); Q_UNUSED_PAR(par); - Q_UNUSED_PAR(qs_id); /* when Q_SPY undefined */ + Q_UNUSED_PAR(qs_id); QTICKER_CAST_(me)->eQueue.tail = 0U; } @@ -379,15 +381,13 @@ void QTicker_dispatch_( QEvt const * const e, uint_fast8_t const qs_id) { - QEQueueCtr nTicks; /* # ticks since the last call */ - QF_CRIT_STAT_ - Q_UNUSED_PAR(e); - Q_UNUSED_PAR(qs_id); /* when Q_SPY undefined */ + Q_UNUSED_PAR(qs_id); + QF_CRIT_STAT_ QF_CRIT_E_(); - nTicks = QTICKER_CAST_(me)->eQueue.tail; /* save the # of ticks */ - QTICKER_CAST_(me)->eQueue.tail = 0U; /* clear the # ticks */ + QEQueueCtr nTicks = QTICKER_CAST_(me)->eQueue.tail; /* save # of ticks */ + QTICKER_CAST_(me)->eQueue.tail = 0U; /* clear # ticks */ QF_CRIT_X_(); for (; nTicks > 0U; --nTicks) { @@ -404,7 +404,9 @@ bool QTicker_post_( { Q_UNUSED_PAR(e); Q_UNUSED_PAR(margin); - Q_UNUSED_PAR(sender); /* when Q_SPY undefined */ + #ifndef Q_SPY + Q_UNUSED_PAR(sender); + #endif QF_CRIT_STAT_ QF_CRIT_E_(); diff --git a/src/qf/qf_defer.c b/src/qf/qf_defer.c index c7a61377..0b939a16 100644 --- a/src/qf/qf_defer.c +++ b/src/qf/qf_defer.c @@ -3,7 +3,7 @@ * Model: qpc.qm * File: ${src::qf::qf_defer.c} * -* This code has been generated by QM 5.2.3 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This code is covered by the following QP license: @@ -54,8 +54,8 @@ Q_DEFINE_THIS_MODULE("qf_defer") /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/src/qf/qf_dyn.c b/src/qf/qf_dyn.c index a41eec3a..6f4d8fa8 100644 --- a/src/qf/qf_dyn.c +++ b/src/qf/qf_dyn.c @@ -3,7 +3,7 @@ * Model: qpc.qm * File: ${src::qf::qf_dyn.c} * -* This code has been generated by QM 5.2.3 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This code is covered by the following QP license: @@ -57,8 +57,8 @@ Q_DEFINE_THIS_MODULE("qf_dyn") //============================================================================ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ @@ -241,7 +241,9 @@ QEvt const * QF_newRef_( QEvt const * const e, void const * const evtRef) { - Q_UNUSED_PAR(evtRef); /* in case Q_NASSERT is defined */ + #ifdef Q_NASSERT + Q_UNUSED_PAR(evtRef); + #endif /*! @pre the event must be dynamic and the provided event reference * must not be already in use */ diff --git a/src/qf/qf_mem.c b/src/qf/qf_mem.c index 98eab8d0..7be0ab9a 100644 --- a/src/qf/qf_mem.c +++ b/src/qf/qf_mem.c @@ -3,7 +3,7 @@ * Model: qpc.qm * File: ${src::qf::qf_mem.c} * -* This code has been generated by QM 5.2.3 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This code is covered by the following QP license: @@ -54,8 +54,8 @@ Q_DEFINE_THIS_MODULE("qf_mem") /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ @@ -120,7 +120,9 @@ void * QMPool_get(QMPool * const me, uint_fast16_t const margin, uint_fast8_t const qs_id) { - Q_UNUSED_PAR(qs_id); /* when Q_SPY undefined */ + #ifndef Q_SPY + Q_UNUSED_PAR(qs_id); + #endif QF_CRIT_STAT_ QF_CRIT_E_(); @@ -194,7 +196,9 @@ void QMPool_put(QMPool * const me, void * const b, uint_fast8_t const qs_id) { - Q_UNUSED_PAR(qs_id); /* when Q_SPY undefined */ + #ifndef Q_SPY + Q_UNUSED_PAR(qs_id); + #endif /*! @pre number of free blocks cannot exceed the total # blocks and * the block pointer must be in range for this pool. diff --git a/src/qf/qf_ps.c b/src/qf/qf_ps.c index 7c3033b2..88469861 100644 --- a/src/qf/qf_ps.c +++ b/src/qf/qf_ps.c @@ -3,7 +3,7 @@ * Model: qpc.qm * File: ${src::qf::qf_ps.c} * -* This code has been generated by QM 5.2.3 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This code is covered by the following QP license: @@ -55,8 +55,8 @@ Q_DEFINE_THIS_MODULE("qf_ps") /*==========================================================================*/ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ @@ -92,8 +92,10 @@ void QActive_publish_( void const * const sender, uint_fast8_t const qs_id) { - Q_UNUSED_PAR(sender); /* when Q_SPY undefined */ - Q_UNUSED_PAR(qs_id); /* when Q_SPY undefined */ + #ifndef Q_SPY + Q_UNUSED_PAR(sender); + Q_UNUSED_PAR(qs_id); + #endif /*! @pre the published signal must be within the configured range */ Q_REQUIRE_ID(200, e->sig < (QSignal)QActive_maxPubSignal_); diff --git a/src/qf/qf_qact.c b/src/qf/qf_qact.c index bd0eea30..3d06c5a0 100644 --- a/src/qf/qf_qact.c +++ b/src/qf/qf_qact.c @@ -3,7 +3,7 @@ * Model: qpc.qm * File: ${src::qf::qf_qact.c} * -* This code has been generated by QM 5.2.3 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This code is covered by the following QP license: @@ -56,8 +56,8 @@ Q_DEFINE_THIS_MODULE("qf_qact") //============================================================================ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/src/qf/qf_qeq.c b/src/qf/qf_qeq.c index c746859c..d5bc0c4b 100644 --- a/src/qf/qf_qeq.c +++ b/src/qf/qf_qeq.c @@ -3,7 +3,7 @@ * Model: qpc.qm * File: ${src::qf::qf_qeq.c} * -* This code has been generated by QM 5.2.3 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This code is covered by the following QP license: @@ -54,8 +54,8 @@ Q_DEFINE_THIS_MODULE("qf_qeq") /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ @@ -85,11 +85,13 @@ bool QEQueue_post(QEQueue * const me, uint_fast16_t const margin, uint_fast8_t const qs_id) { + #ifndef Q_SPY + Q_UNUSED_PAR(qs_id); + #endif + /* @pre event must be valid */ Q_REQUIRE_ID(200, e != (QEvt *)0); - (void)qs_id; /* unused parameter (outside Q_SPY build configuration) */ - QF_CRIT_STAT_ QF_CRIT_E_(); QEQueueCtr nFree = me->nFree; /* get volatile into the temporary */ @@ -162,7 +164,9 @@ void QEQueue_postLIFO(QEQueue * const me, QEvt const * const e, uint_fast8_t const qs_id) { - (void)qs_id; /* unused parameter, if Q_SPY not defined */ + #ifndef Q_SPY + Q_UNUSED_PAR(qs_id); + #endif QF_CRIT_STAT_ QF_CRIT_E_(); @@ -209,7 +213,9 @@ void QEQueue_postLIFO(QEQueue * const me, QEvt const * QEQueue_get(QEQueue * const me, uint_fast8_t const qs_id) { - (void)qs_id; /* unused parameter (outside Q_SPY build configuration) */ + #ifndef Q_SPY + Q_UNUSED_PAR(qs_id); + #endif QF_CRIT_STAT_ QF_CRIT_E_(); diff --git a/src/qf/qf_qmact.c b/src/qf/qf_qmact.c index d6579af4..482f1fbb 100644 --- a/src/qf/qf_qmact.c +++ b/src/qf/qf_qmact.c @@ -3,7 +3,7 @@ * Model: qpc.qm * File: ${src::qf::qf_qmact.c} * -* This code has been generated by QM 5.2.3 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This code is covered by the following QP license: @@ -61,8 +61,8 @@ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/src/qf/qf_time.c b/src/qf/qf_time.c index 97f710b5..1cd4c293 100644 --- a/src/qf/qf_time.c +++ b/src/qf/qf_time.c @@ -3,7 +3,7 @@ * Model: qpc.qm * File: ${src::qf::qf_time.c} * -* This code has been generated by QM 5.2.3 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This code is covered by the following QP license: @@ -64,8 +64,8 @@ Q_DEFINE_THIS_MODULE("qf_time") /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ @@ -129,7 +129,7 @@ void QTimeEvt_armX(QTimeEvt * const me, && (tickRate < (uint_fast8_t)QF_MAX_TICK_RATE) && (me->super.sig >= (QSignal)Q_USER_SIG)); #ifdef Q_NASSERT - (void)ctr; /* avoid compiler warning about unused variable */ + Q_UNUSED_PAR(ctr); #endif QF_CRIT_STAT_ @@ -300,7 +300,9 @@ void QTimeEvt_tick_( uint_fast8_t const tickRate, void const * const sender) { - Q_UNUSED_PAR(sender); /* when Q_SPY undefined */ + #ifndef Q_SPY + Q_UNUSED_PAR(sender); + #endif QTimeEvt *prev = &QTimeEvt_timeEvtHead_[tickRate]; diff --git a/src/qk/qk.c b/src/qk/qk.c index a8400c40..ce1adc4e 100644 --- a/src/qk/qk.c +++ b/src/qk/qk.c @@ -3,7 +3,7 @@ * Model: qpc.qm * File: ${src::qk::qk.c} * -* This code has been generated by QM 5.2.3 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This code is covered by the following QP license: @@ -60,8 +60,8 @@ Q_DEFINE_THIS_MODULE("qk") /*==========================================================================*/ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ @@ -168,31 +168,39 @@ void QF_init(void) { /*${QK::QF-cust::stop} .....................................................*/ void QF_stop(void) { QF_onCleanup(); /* application-specific cleanup callback */ - /* nothing else to do for the cooperative QK kernel */ + /* nothing else to do for the preemptive QK kernel */ } /*${QK::QF-cust::run} ......................................................*/ int_t QF_run(void) { + #ifdef Q_SPY + /* produce the QS_QF_RUN trace record */ QF_INT_DISABLE(); - QK_attr_.lockCeil = 0U; /* scheduler unlocked */ - - /* any active objects need to be scheduled before starting event loop? */ - if (QK_sched_() != 0U) { - QK_activate_(); /* activate AOs to process events posted so far */ - } + QS_beginRec_((uint_fast8_t)QS_QF_RUN); + QS_endRec_(); + QF_INT_ENABLE(); + #endif /* Q_SPY */ QF_onStartup(); /* application-specific startup callback */ - /* produce the QS_QF_RUN trace record (no nested critical section) */ - QS_BEGIN_NOCRIT_PRE_(QS_QF_RUN, 0U) - QS_END_NOCRIT_PRE_() + QF_INT_DISABLE(); + + QK_attr_.lockCeil = 0U; /* unlock the QK scheduler */ + + /* activate AOs to process events posted so far */ + if (QK_sched_() != 0U) { + QK_activate_(); + } + + #ifdef QK_START + QK_START(); /* port-specific startup of the QK kernel */ + #endif QF_INT_ENABLE(); - - /* the QK idle loop... */ - for (;;) { + for (;;) { /* QK idle loop... */ QK_onIdle(); /* application-specific QK on-idle callback */ } + #ifdef __GNUC__ return 0; #endif @@ -269,16 +277,16 @@ uint_fast8_t QK_sched_(void) { /*${QK::QK-extern-C::activate_} ............................................*/ void QK_activate_(void) { uint8_t const prio_in = QK_attr_.actPrio; /* saved initial priority */ - uint_fast8_t p = QK_attr_.nextPrio; /* next prio to run */ + uint8_t p = QK_attr_.nextPrio; /* next prio to run */ QK_attr_.nextPrio = 0U; /* clear for the next time */ /* QK_attr_.actPrio and QK_attr_.nextPrio must be in range */ Q_REQUIRE_ID(500, (prio_in <= QF_MAX_ACTIVE) && (0U < p) && (p <= QF_MAX_ACTIVE)); - #if (defined QK_ON_CONTEXT_SW) || (defined Q_SPY) - uint_fast8_t pprev = prio_in; - #endif /* QK_ON_CONTEXT_SW || Q_SPY */ + #if (defined QF_ON_CONTEXT_SW) || (defined Q_SPY) + uint8_t pprev = prio_in; + #endif /* QF_ON_CONTEXT_SW || Q_SPY */ /* loop until no more ready-to-run AOs of higher pthre than the initial */ QActive *a; @@ -286,27 +294,27 @@ void QK_activate_(void) { a = QActive_registry_[p]; /* obtain the pointer to the AO */ /* set new active priority and preemption-threshold */ - QK_attr_.actPrio = (uint8_t)p; + QK_attr_.actPrio = p; QK_attr_.actThre = QActive_registry_[p]->pthre; - #if (defined QK_ON_CONTEXT_SW) || (defined Q_SPY) - if (p != pprev) { /* changing threads? */ + #if (defined QF_ON_CONTEXT_SW) || (defined Q_SPY) + if (p != pprev) { /* changing threads? */ - QS_BEGIN_NOCRIT_PRE_(QS_SCHED_NEXT, a->prio) + QS_BEGIN_NOCRIT_PRE_(QS_SCHED_NEXT, p) QS_TIME_PRE_(); /* timestamp */ QS_2U8_PRE_(p, /* priority of the scheduled AO */ pprev); /* previous priority */ QS_END_NOCRIT_PRE_() - #ifdef QK_ON_CONTEXT_SW - QK_onContextSw(((pprev != 0U) + #ifdef QF_ON_CONTEXT_SW + QF_onContextSw(((pprev != 0U) ? QActive_registry_[pprev] : (QActive *)0), a); - #endif /* QK_ON_CONTEXT_SW */ + #endif /* QF_ON_CONTEXT_SW */ pprev = p; /* update previous priority */ } - #endif /* QK_ON_CONTEXT_SW || Q_SPY */ + #endif /* QF_ON_CONTEXT_SW || Q_SPY */ QF_INT_ENABLE(); /* unconditionally enable interrupts */ @@ -317,7 +325,7 @@ void QK_activate_(void) { * 3. determine if event is garbage and collect it if so */ QEvt const * const e = QActive_get_(a); - QHSM_DISPATCH(&a->super, e, a->prio); + QHSM_DISPATCH(&a->super, e, p); #if (QF_MAX_EPOOL > 0U) QF_gc(e); #endif @@ -334,7 +342,7 @@ void QK_activate_(void) { } else { /* find new highest-prio AO ready to run... */ - p = QPSet_findMax(&QF_readySet_); + p = (uint8_t)QPSet_findMax(&QF_readySet_); /* is the new priority below the initial preemption-threshold? */ if (p <= (uint_fast8_t)QActive_registry_[prio_in]->pthre) { @@ -354,11 +362,11 @@ void QK_activate_(void) { QK_attr_.actPrio = prio_in; QK_attr_.actThre = QActive_registry_[prio_in]->pthre; - #if (defined QK_ON_CONTEXT_SW) || (defined Q_SPY) + #if (defined QF_ON_CONTEXT_SW) || (defined Q_SPY) if (prio_in != 0U) { /* resuming an active object? */ a = QActive_registry_[prio_in]; /* pointer to the preempted AO */ - QS_BEGIN_NOCRIT_PRE_(QS_SCHED_NEXT, a->prio) + QS_BEGIN_NOCRIT_PRE_(QS_SCHED_NEXT, prio_in) QS_TIME_PRE_(); /* timestamp */ /* priority of the resumed AO, previous priority */ QS_2U8_PRE_(prio_in, pprev); @@ -367,16 +375,16 @@ void QK_activate_(void) { else { /* resuming priority==0 --> idle */ a = (QActive *)0; /* QK idle loop */ - QS_BEGIN_NOCRIT_PRE_(QS_SCHED_IDLE, 0U) + QS_BEGIN_NOCRIT_PRE_(QS_SCHED_IDLE, pprev) QS_TIME_PRE_(); /* timestamp */ QS_U8_PRE_(pprev); /* previous priority */ QS_END_NOCRIT_PRE_() } - #ifdef QK_ON_CONTEXT_SW - QK_onContextSw(QActive_registry_[pprev], a); - #endif /* QK_ON_CONTEXT_SW */ + #ifdef QF_ON_CONTEXT_SW + QF_onContextSw(QActive_registry_[pprev], a); + #endif /* QF_ON_CONTEXT_SW */ - #endif /* QK_ON_CONTEXT_SW || Q_SPY */ + #endif /* QF_ON_CONTEXT_SW || Q_SPY */ } /*$enddef${QK::QK-extern-C} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/src/qs/qs.c b/src/qs/qs.c index a94a12b2..b2109b18 100644 --- a/src/qs/qs.c +++ b/src/qs/qs.c @@ -3,7 +3,7 @@ * Model: qpc.qm * File: ${src::qs::qs.c} * -* This code has been generated by QM 5.2.3 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This code is covered by the following QP license: @@ -55,8 +55,8 @@ Q_ASSERT_STATIC((enum_t)QS_PRE_MAX <= (enum_t)QS_USER); /*==========================================================================*/ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ @@ -68,7 +68,7 @@ QS_tx QS_priv_; /*${QS::QS-tx::initBuf} ....................................................*/ void QS_initBuf( uint8_t * const sto, - uint_fast16_t const stoSize) + uint_fast32_t const stoSize) { /* the provided buffer must be at least 8 bytes long */ Q_REQUIRE_ID(100, stoSize > 8U); @@ -157,9 +157,11 @@ void QS_glbFilter_(int_fast16_t const filter) { switch (rec) { case QS_ALL_RECORDS: { uint8_t const tmp = (isRemove ? 0x00U : 0xFFU); - uint_fast8_t i; /* set all global filters (partially unrolled loop) */ - for (i = 0U; i < Q_DIM(QS_priv_.glbFilter); i += 4U) { + for (uint_fast8_t i = 0U; + i < Q_DIM(QS_priv_.glbFilter); + i += 4U) + { QS_priv_.glbFilter[i ] = tmp; QS_priv_.glbFilter[i + 1U] = tmp; QS_priv_.glbFilter[i + 2U] = tmp; @@ -170,6 +172,7 @@ void QS_glbFilter_(int_fast16_t const filter) { * see qs.h, Miscellaneous QS records (not maskable) */ QS_priv_.glbFilter[0] = 0x01U; + QS_priv_.glbFilter[6] = 0x40U; QS_priv_.glbFilter[7] = 0xFCU; QS_priv_.glbFilter[8] = 0x7FU; } @@ -249,10 +252,10 @@ void QS_glbFilter_(int_fast16_t const filter) { break; case QS_SC_RECORDS: if (isRemove) { - QS_priv_.glbFilter[6] &= (uint8_t)(~0x7FU & 0xFFU); + QS_priv_.glbFilter[6] &= (uint8_t)(~0x3FU & 0xFFU); } else { - QS_priv_.glbFilter[6] |= 0x7FU; + QS_priv_.glbFilter[6] |= 0x3FU; } break; case QS_SEM_RECORDS: @@ -803,6 +806,23 @@ void QS_usr_dict_pre_( QS_onFlush(); } +/*${QS::QS-tx::enum_dict_pre_} .............................................*/ +void QS_enum_dict_pre_( + enum_t const value, + uint8_t const group, + char const * const name) +{ + QS_CRIT_STAT_ + + QS_CRIT_E_(); + QS_beginRec_((uint_fast8_t)QS_ENUM_DICT); + QS_2U8_PRE_((uint8_t)value, group); + QS_str_raw_(name); + QS_endRec_(); + QS_CRIT_X_(); + QS_onFlush(); +} + /*${QS::QS-tx::ASSERTION} ..................................................*/ void QS_ASSERTION( char const * const module, diff --git a/src/qs/qs_64bit.c b/src/qs/qs_64bit.c index 8364f306..31596199 100644 --- a/src/qs/qs_64bit.c +++ b/src/qs/qs_64bit.c @@ -3,7 +3,7 @@ * Model: qpc.qm * File: ${src::qs::qs_64bit.c} * -* This code has been generated by QM 5.2.3 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This code is covered by the following QP license: @@ -45,8 +45,8 @@ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/src/qs/qs_fp.c b/src/qs/qs_fp.c index 1f0d4b1a..235b3f83 100644 --- a/src/qs/qs_fp.c +++ b/src/qs/qs_fp.c @@ -3,7 +3,7 @@ * Model: qpc.qm * File: ${src::qs::qs_fp.c} * -* This code has been generated by QM 5.2.3 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This code is covered by the following QP license: @@ -45,8 +45,8 @@ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/src/qs/qs_rx.c b/src/qs/qs_rx.c index acb07492..6c1f55f8 100644 --- a/src/qs/qs_rx.c +++ b/src/qs/qs_rx.c @@ -3,7 +3,7 @@ * Model: qpc.qm * File: ${src::qs::qs_rx.c} * -* This code has been generated by QM 5.2.3 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This code is covered by the following QP license: @@ -196,8 +196,8 @@ static void QS_rxPoke_(void); /*==========================================================================*/ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/src/qs/qstamp.c b/src/qs/qstamp.c index 46b3ebc5..09ae4edc 100644 --- a/src/qs/qstamp.c +++ b/src/qs/qstamp.c @@ -3,7 +3,7 @@ * Model: qpc.qm * File: ${src::qs::qstamp.c} * -* This code has been generated by QM 5.2.3 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This code is covered by the following QP license: diff --git a/src/qs/qutest.c b/src/qs/qutest.c index 190c9808..b6fd5b90 100644 --- a/src/qs/qutest.c +++ b/src/qs/qutest.c @@ -3,7 +3,7 @@ * Model: qpc.qm * File: ${src::qs::qutest.c} * -* This code has been generated by QM 5.2.3 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This code is covered by the following QP license: @@ -54,8 +54,8 @@ /* QUTest unit testing harness */ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ @@ -116,9 +116,9 @@ Q_NORETURN Q_onAssert( QS_STR_PRE_((module != (char *)0) ? module : "?"); QS_END_NOCRIT_PRE_() - QS_onFlush(); /* flush the assertion record to the host */ - QS_onTestLoop(); /* loop to wait for commands (typically reset) */ - QS_onReset(); /* in case the QUTEST loop ever returns, reset manually */ + QS_onFlush(); /* flush the assertion record to the host */ + QS_onCleanup(); /* cleanup after the failure */ + QS_onReset(); /* reset the target to prevent the code from continuing */ for (;;) { /* QS_onReset() should not return, but to ensure no-return */ } } @@ -198,6 +198,7 @@ int_t QF_run(void) { QS_BEGIN_PRE_(QS_QF_RUN, 0U) QS_END_PRE_() + QS_processTestEvts_(); /* process all events posted so far */ QS_onTestLoop(); /* run the test loop */ QS_onCleanup(); /* application cleanup */ return 0; /* return no error */ @@ -366,6 +367,13 @@ void QHsmDummy_init_( { Q_UNUSED_PAR(par); + #ifdef Q_SPY + if ((QS_priv_.flags & 0x01U) == 0U) { + QS_priv_.flags |= 0x01U; + QS_FUN_DICTIONARY(&QHsm_top); + } + #endif + QS_CRIT_STAT_ QS_BEGIN_PRE_(QS_QEP_STATE_INIT, qs_id) QS_OBJ_PRE_(me); /* this state machine object */ @@ -415,7 +423,7 @@ void QActiveDummy_init_( void const * const par, uint_fast8_t const qs_id) { - (void)qs_id; /* unused parameter */ + Q_UNUSED_PAR(qs_id); QHsmDummy_init_(me, par, ((QActive const *)me)->prio); } @@ -426,7 +434,7 @@ void QActiveDummy_dispatch_( QEvt const * const e, uint_fast8_t const qs_id) { - (void)qs_id; /* unused parameter */ + Q_UNUSED_PAR(qs_id); QHsmDummy_dispatch_(me, e, ((QActive const *)me)->prio); } diff --git a/src/qv/qv.c b/src/qv/qv.c index d13a451c..2b124e0e 100644 --- a/src/qv/qv.c +++ b/src/qv/qv.c @@ -3,7 +3,7 @@ * Model: qpc.qm * File: ${src::qv::qv.c} * -* This code has been generated by QM 5.2.3 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This code is covered by the following QP license: @@ -60,8 +60,8 @@ Q_DEFINE_THIS_MODULE("qv") /*==========================================================================*/ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ @@ -93,39 +93,53 @@ void QF_stop(void) { /*${QV::QF-cust::run} ......................................................*/ int_t QF_run(void) { #ifdef Q_SPY - uint_fast8_t pprev = 0U; /* previously used priority */ - #endif + /* produce the QS_QF_RUN trace record */ + QF_INT_DISABLE(); + QS_beginRec_((uint_fast8_t)QS_QF_RUN); + QS_endRec_(); + QF_INT_ENABLE(); + #endif /* Q_SPY */ QF_onStartup(); /* application-specific startup callback */ - /* the combined event-loop and background-loop of the QV kernel... */ QF_INT_DISABLE(); - /* produce the QS_QF_RUN trace record */ - QS_BEGIN_NOCRIT_PRE_(QS_QF_RUN, 0U) - QS_END_NOCRIT_PRE_() + #ifdef QV_START + QV_START(); /* port-specific startup of the QV kernel */ + #endif + + #if (defined QF_ON_CONTEXT_SW) || (defined Q_SPY) + uint8_t pprev = 0U; /* previously used priority */ + #endif /* (defined QF_ON_CONTEXT_SW) || (defined Q_SPY) */ + + for (;;) { /* QV event loop... */ - for (;;) { /* find the maximum priority AO ready to run */ if (QPSet_notEmpty(&QF_readySet_)) { - uint_fast8_t const p = QPSet_findMax(&QF_readySet_); + uint8_t const p = (uint8_t)QPSet_findMax(&QF_readySet_); QActive * const a = QActive_registry_[p]; - #ifdef Q_SPY - QS_BEGIN_NOCRIT_PRE_(QS_SCHED_NEXT, a->prio) + #if (defined QF_ON_CONTEXT_SW) || (defined Q_SPY) + QS_BEGIN_NOCRIT_PRE_(QS_SCHED_NEXT, p) QS_TIME_PRE_(); /* timestamp */ QS_2U8_PRE_(p, /* priority of the scheduled AO */ pprev); /* previous priority */ QS_END_NOCRIT_PRE_() + #ifdef QF_ON_CONTEXT_SW + QF_onContextSw(((pprev != 0U) + ? QActive_registry_[pprev] + : (QActive *)0), a); + #endif /* QF_ON_CONTEXT_SW */ + pprev = p; /* update previous priority */ - #endif /* Q_SPY */ + #endif /* (defined QF_ON_CONTEXT_SW) || (defined Q_SPY) */ QF_INT_ENABLE(); /* perform the run-to-completion (RTC) step... - * 1. retrieve the event from the AO's event queue, which by this - * time must be non-empty and The "Vanialla" kernel asserts it. + * 1. retrieve the event from the AO's event queue, which + * by this time must be non-empty (and QV asserts it). * 2. dispatch the event to the AO's state machine. * 3. determine if event is garbage and collect it if so */ @@ -141,27 +155,33 @@ int_t QF_run(void) { } } else { /* no AO ready to run --> idle */ - #ifdef Q_SPY + #if (defined QF_ON_CONTEXT_SW) || (defined Q_SPY) if (pprev != 0U) { - QS_BEGIN_NOCRIT_PRE_(QS_SCHED_IDLE, 0U) + QS_BEGIN_NOCRIT_PRE_(QS_SCHED_IDLE, pprev) QS_TIME_PRE_(); /* timestamp */ QS_U8_PRE_(pprev); /* previous priority */ QS_END_NOCRIT_PRE_() + #ifdef QF_ON_CONTEXT_SW + QF_onContextSw(QActive_registry_[pprev], (QActive *)0); + #endif /* QF_ON_CONTEXT_SW */ + pprev = 0U; /* update previous priority */ } - #endif /* Q_SPY */ + #endif /* (defined QF_ON_CONTEXT_SW) || (defined Q_SPY) */ - /* QV_onIdle() must be called with interrupts DISABLED because - * the determination of the idle condition (no events in the - * queues) can change at any time by an interrupt posting events - * to a queue. QV_onIdle() MUST enable interrupts internally, - * perhaps at the same time as putting the CPU into a power-saving - * mode. + /* QV_onIdle() must be called with interrupts DISABLED + * because the determination of the idle condition (all event + * queues empty) can change at any time by an interrupt posting + * events to a queue. + * + * NOTE: QV_onIdle() MUST enable interrupts internally, + * ideally at the same time as putting the CPU into a power- + * saving mode. */ QV_onIdle(); - QF_INT_DISABLE(); + QF_INT_DISABLE(); /* disable interrupts before looping back */ } } #ifdef __GNUC__ /* GNU compiler? */ diff --git a/src/qxk/qxk.c b/src/qxk/qxk.c index 750826c9..bd55762b 100644 --- a/src/qxk/qxk.c +++ b/src/qxk/qxk.c @@ -3,7 +3,7 @@ * Model: qpc.qm * File: ${src::qxk::qxk.c} * -* This code has been generated by QM 5.2.3 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This code is covered by the following QP license: @@ -60,8 +60,8 @@ Q_DEFINE_THIS_MODULE("qxk") /*==========================================================================*/ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ @@ -159,6 +159,7 @@ void QF_init(void) { /* register the idle AO object (cast 'const' away) */ QActive_registry_[0] = (QActive *)&idle_ao; + QXK_attr_.prev = QActive_registry_[0]; #ifdef QXK_INIT QXK_INIT(); /* port-specific initialization of the QXK kernel */ @@ -168,33 +169,38 @@ void QF_init(void) { /*${QXK::QF-cust::stop} ....................................................*/ void QF_stop(void) { QF_onCleanup(); /* application-specific cleanup callback */ - /* nothing else to do for the cooperative QXK kernel */ + /* nothing else to do for the dual-mode QXK kernel */ } /*${QXK::QF-cust::run} .....................................................*/ int_t QF_run(void) { - QF_INT_DISABLE(); - QXK_attr_.prev = QActive_registry_[0]; /* the QXK idle thread */ - QXK_attr_.lockCeil = 0U; /* unlock the scheduler */ - - /* any active objects need to be scheduled before starting event loop? */ - if (QXK_sched_() != 0U) { /* activation needed? */ - QXK_activate_(); /* synchronously activate basic-thred(s) */ - } - - QF_onStartup(); /* application-specific startup callback */ - - /* produce the QS_QF_RUN trace record (no nested critical section) */ - QS_BEGIN_NOCRIT_PRE_(QS_QF_RUN, 0U) - QS_END_NOCRIT_PRE_() - - QF_INT_ENABLE(); - + #ifdef Q_SPY QS_SIG_DICTIONARY(QXK_DELAY_SIG, (void *)0); QS_SIG_DICTIONARY(QXK_TIMEOUT_SIG, (void *)0); - /* the QXK idle loop... */ - for (;;) { + /* produce the QS_QF_RUN trace record */ + QF_INT_DISABLE(); + QS_beginRec_((uint_fast8_t)QS_QF_RUN); + QS_endRec_(); + QF_INT_ENABLE(); + #endif /* Q_SPY */ + + QF_onStartup(); /* application-specific startup callback */ + + QF_INT_DISABLE(); + + QXK_attr_.lockCeil = 0U; /* unlock the QXK scheduler */ + /* activate AOs to process events posted so far */ + if (QXK_sched_() != 0U) { + QXK_activate_(); + } + + #ifdef QXK_START + QXK_START(); /* port-specific startup of the QXK kernel */ + #endif + + QF_INT_ENABLE(); + for (;;) { /* QXK idle loop... */ QXK_onIdle(); /* application-specific QXK idle callback */ } @@ -320,19 +326,19 @@ void QXK_activate_(void) { Q_REQUIRE_ID(700, (next != (QActive *)0) && (prio_in <= QF_MAX_ACTIVE)); /* QXK Context switch callback defined or QS tracing enabled? */ - #if (defined QXK_ON_CONTEXT_SW) || (defined Q_SPY) + #if (defined QF_ON_CONTEXT_SW) || (defined Q_SPY) QXK_contextSw(next); - #endif /* QXK_ON_CONTEXT_SW || Q_SPY */ + #endif /* QF_ON_CONTEXT_SW || Q_SPY */ QXK_attr_.next = (QActive *)0; /* clear the next AO */ QXK_attr_.curr = (QActive *)0; /* current is basic-thread */ /* priority of the next thread */ - uint_fast8_t p = (uint_fast8_t)next->prio; + uint8_t p = next->prio; /* loop until no more ready-to-run AOs of higher prio than the initial */ do { - QXK_attr_.actPrio = (uint8_t)p; /* next active prio */ + QXK_attr_.actPrio = p; /* next active prio */ QF_INT_ENABLE(); /* unconditionally enable interrupts */ @@ -361,14 +367,14 @@ void QXK_activate_(void) { } else { /* find new highest-prio AO ready to run... */ - p = QPSet_findMax(&QF_readySet_); + p = (uint8_t)QPSet_findMax(&QF_readySet_); next = QActive_registry_[p]; /* next thread must be registered in QF */ Q_ASSERT_ID(710, next != (QActive *)0); /* is the next priority below the lock-ceiling? */ - if (p <= (uint_fast8_t)QXK_attr_.lockCeil) { + if (p <= QXK_attr_.lockCeil) { p = QXK_attr_.lockHolder; /* thread holding lock */ if (p != 0U) { Q_ASSERT_ID(720, QPSet_hasElement(&QF_readySet_, p)); @@ -379,11 +385,11 @@ void QXK_activate_(void) { if (next->osObject == (void *)0) { /* is the next priority above the initial priority? */ if (p > QActive_registry_[prio_in]->prio) { - #if (defined QXK_ON_CONTEXT_SW) || (defined Q_SPY) - if (p != QXK_attr_.actPrio) { /* changing threads? */ + #if (defined QF_ON_CONTEXT_SW) || (defined Q_SPY) + if (p != QXK_attr_.actPrio) { /* changing threads? */ QXK_contextSw(next); } - #endif /* QXK_ON_CONTEXT_SW || Q_SPY */ + #endif /* QF_ON_CONTEXT_SW || Q_SPY */ QXK_attr_.next = next; } else { @@ -402,13 +408,13 @@ void QXK_activate_(void) { /* restore the active priority */ QXK_attr_.actPrio = prio_in; - #if (defined QXK_ON_CONTEXT_SW) || (defined Q_SPY) + #if (defined QF_ON_CONTEXT_SW) || (defined Q_SPY) if (next->osObject == (void *)0) { QXK_contextSw((prio_in == 0U) ? (QActive *)0 : QActive_registry_[prio_in]); } - #endif /* QXK_ON_CONTEXT_SW || Q_SPY */ + #endif /* QF_ON_CONTEXT_SW || Q_SPY */ } /*${QXK::QXK-extern-C::current} ............................................*/ @@ -432,7 +438,7 @@ QActive * QXK_current(void) { } /*${QXK::QXK-extern-C::contextSw} ..........................................*/ -#if defined(Q_SPY) || defined(QXK_ON_CONTEXT_SW) +#if defined(Q_SPY) || defined(QF_ON_CONTEXT_SW) void QXK_contextSw(QActive * const next) { #ifdef Q_SPY uint8_t const prev_prio = (QXK_attr_.prev != (QActive *)0) @@ -440,34 +446,26 @@ void QXK_contextSw(QActive * const next) { : 0U; #endif /* Q_SPY */ - uint8_t const next_prio = (next != (QActive *)0) - ? next->prio - : QXK_attr_.actPrio; - - if (next_prio == 0U) { /* going to idle? */ - QS_BEGIN_NOCRIT_PRE_(QS_SCHED_IDLE, 0U) + if (next != (QActive *)0) { /* next is NOT idle? */ + QS_BEGIN_NOCRIT_PRE_(QS_SCHED_NEXT, next->prio) + QS_TIME_PRE_(); /* timestamp */ + QS_2U8_PRE_(next->prio, prev_prio); + QS_END_NOCRIT_PRE_() + } + else { /* going to idle */ + QS_BEGIN_NOCRIT_PRE_(QS_SCHED_IDLE, prev_prio) QS_TIME_PRE_(); /* timestamp */ QS_U8_PRE_(prev_prio); QS_END_NOCRIT_PRE_() - - #ifdef QXK_ON_CONTEXT_SW - QXK_onContextSw(QXK_attr_.prev, (QActive *)0); - #endif /* QXK_ON_CONTEXT_SW */ } - else { - QS_BEGIN_NOCRIT_PRE_(QS_SCHED_NEXT, next_prio) - QS_TIME_PRE_(); /* timestamp */ - QS_2U8_PRE_(next_prio, prev_prio); - QS_END_NOCRIT_PRE_() - #ifdef QXK_ON_CONTEXT_SW - QXK_onContextSw(QXK_attr_.prev, next); - #endif /* QXK_ON_CONTEXT_SW */ - } + #ifdef QF_ON_CONTEXT_SW + QF_onContextSw(QXK_attr_.prev, next); + #endif /* QF_ON_CONTEXT_SW */ QXK_attr_.prev = next; /* update the previous thread */ } -#endif /* defined(Q_SPY) || defined(QXK_ON_CONTEXT_SW) */ +#endif /* defined(Q_SPY) || defined(QF_ON_CONTEXT_SW) */ /*$enddef${QXK::QXK-extern-C} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*==========================================================================*/ /*$define${QXK-impl} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ diff --git a/src/qxk/qxk_mutex.c b/src/qxk/qxk_mutex.c index 91b536a1..554c02a1 100644 --- a/src/qxk/qxk_mutex.c +++ b/src/qxk/qxk_mutex.c @@ -3,7 +3,7 @@ * Model: qpc.qm * File: ${src::qxk::qxk_mutex.c} * -* This code has been generated by QM 5.2.3 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This code is covered by the following QP license: @@ -61,8 +61,8 @@ Q_DEFINE_THIS_MODULE("qxk_mutex") /*==========================================================================*/ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/src/qxk/qxk_sema.c b/src/qxk/qxk_sema.c index c8239453..25a24420 100644 --- a/src/qxk/qxk_sema.c +++ b/src/qxk/qxk_sema.c @@ -3,7 +3,7 @@ * Model: qpc.qm * File: ${src::qxk::qxk_sema.c} * -* This code has been generated by QM 5.2.3 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This code is covered by the following QP license: @@ -60,8 +60,8 @@ Q_DEFINE_THIS_MODULE("qxk_sema") /*==========================================================================*/ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/src/qxk/qxk_xthr.c b/src/qxk/qxk_xthr.c index c8501356..e64e9848 100644 --- a/src/qxk/qxk_xthr.c +++ b/src/qxk/qxk_xthr.c @@ -3,7 +3,7 @@ * Model: qpc.qm * File: ${src::qxk::qxk_xthr.c} * -* This code has been generated by QM 5.2.3 . +* This code has been generated by QM 5.2.4 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This code is covered by the following QP license: @@ -60,8 +60,8 @@ Q_DEFINE_THIS_MODULE("qxk_xthr") /*==========================================================================*/ /*$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* Check for the minimum required QP version */ -#if (QP_VERSION < 690U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) -#error qpc version 6.9.0 or higher required +#if (QP_VERSION < 700U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) +#error qpc version 7.0.0 or higher required #endif /*$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ @@ -251,7 +251,7 @@ void QXThread_init_( { Q_UNUSED_PAR(me); Q_UNUSED_PAR(par); - Q_UNUSED_PAR(qs_id); /* when Q_SPY undefined */ + Q_UNUSED_PAR(qs_id); Q_ERROR_ID(110); } @@ -330,7 +330,9 @@ bool QXThread_post_( uint_fast16_t const margin, void const * const sender) { - Q_UNUSED_PAR(sender); /* when Q_SPY undefined */ + #ifndef Q_SPY + Q_UNUSED_PAR(sender); + #endif QF_CRIT_STAT_ QS_TEST_PROBE_DEF(&QXThread_post_) diff --git a/test/README.txt b/test/README.txt new file mode 100644 index 00000000..52b3ad4f --- /dev/null +++ b/test/README.txt @@ -0,0 +1,4 @@ +The `qpc/test/` directory is planned to contain a growing number of system-level tests, which are based on QUTest, but *without* the QP-stub. The tests take advantage of the new QUTest configuration, where the QP-stub is NOT included (because the actual QP framework is linked). This configuration is activated by defining macro `Q_UTEST=0`. + +@attention +Many tests provided in the `qpc/test/` directory run only on embedded targets and cannot run on the host machine. diff --git a/test/qk/test_sched/bsp.h b/test/qk/test_sched/bsp.h index 66fe0421..a4caa37e 100644 --- a/test/qk/test_sched/bsp.h +++ b/test/qk/test_sched/bsp.h @@ -1,7 +1,7 @@ -/***************************************************************************** -* Product: BSP for system-testing QXK -* Last updated for version 7.1.2 -* Last updated on 2022-10-02 +/*============================================================================ +* Product: BSP for system-testing +* Last updated for version 7.2.0 +* Last updated on 2022-12-13 * * Q u a n t u m L e a P s * ------------------------ @@ -30,9 +30,9 @@ * Contact information: * * -*****************************************************************************/ -#ifndef BSP_H -#define BSP_H +============================================================================*/ +#ifndef BSP_H_ +#define BSP_H_ void BSP_init(void); void BSP_terminate(int16_t result); @@ -44,6 +44,12 @@ void BSP_ledOn(void); void BSP_ledOff(void); void BSP_trigISR(void); +uint32_t BSP_romRead(int32_t offset, uint32_t fromEnd); +void BSP_romWrite(int32_t offset, uint32_t fromEnd, uint32_t value); + +uint32_t BSP_ramRead(int32_t offset, uint32_t fromEnd); +void BSP_ramWrite(int32_t offset, uint32_t fromEnd, uint32_t value); + enum TestSignals { TEST0_SIG = Q_USER_SIG, TEST1_SIG, @@ -54,5 +60,5 @@ enum TestSignals { MAX_SIG /* the last signal */ }; -#endif /* BSP_H */ +#endif /* BSP_H_ */ diff --git a/test/qk/test_sched/bsp_efm32.c b/test/qk/test_sched/bsp_efm32.c index 33e308d8..51743672 100644 --- a/test/qk/test_sched/bsp_efm32.c +++ b/test/qk/test_sched/bsp_efm32.c @@ -1,7 +1,7 @@ -/***************************************************************************** -* Product: BSP for system-testing QK kernel, EFM32-SLSTK3401A board -* Last updated for version 7.1.2 -* Last updated on 2022-10-05 +/*============================================================================ +* Product: BSP for system-testing of QK kernel, EFM32-SLSTK3401A board +* Last updated for version 7.2.0 +* Last updated on 2022-12-13 * * Q u a n t u m L e a P s * ------------------------ @@ -30,7 +30,7 @@ * Contact information: * * -*****************************************************************************/ +============================================================================*/ #include "qpc.h" #include "bsp.h" @@ -62,7 +62,7 @@ void GPIO_EVEN_IRQHandler(void); static QSpyId const l_test_ISR = { 101U }; enum AppRecords { /* application-specific trace records */ - CONTEXT_SW = QS_USER, + CONTEXT_SW = QS_USER1, TRACE_MSG }; @@ -91,8 +91,126 @@ void GPIO_EVEN_IRQHandler(void) { /* for testing, NOTE03 */ QK_ISR_EXIT(); /* inform QK kernel about exiting an ISR */ } +/*..........................................................................*/ +/* MPU setup for EFM32PG1B200F256GM48 MCU */ +static void EFM32PG182_MPU_setup(void) { + /* The following MPU configuration contains the general EFM32PG1 memory + * map described in the EFM32PG1 Data Sheet Figure 3.2. EFM32PG1 Memory Map + * + * Please note that the actual STM32 MCUs provide much less Flash and SRAM + * than the maximums configured here. This means that actual MCUs have + * unmapped memory regions (e.g., beyond the actual SRAM). Attempts to + * access these regions causes the HardFault exception, which is the + * desired behavior. + */ + static struct { + uint32_t rbar; + uint32_t rasr; + } const mpu_setup[] = { + + { /* region #0: Flash: base=0x0000'0000, size=512M=2^(28+1) */ + 0x00000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 0U), /* region #0 */ + (28U << MPU_RASR_SIZE_Pos) /* 2^(18+1) region */ + | (0x6U << MPU_RASR_AP_Pos) /* PA:ro/UA:ro */ + | (1U << MPU_RASR_C_Pos) /* C=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #1: SRAM: base=0x2000'0000, size=512M=2^(28+1) */ + 0x20000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 1U), /* region #1 */ + (28U << MPU_RASR_SIZE_Pos) /* 2^(28+1) region */ + | (0x3U << MPU_RASR_AP_Pos) /* PA:rw/UA:rw */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | (1U << MPU_RASR_S_Pos) /* S=1 */ + | (1U << MPU_RASR_C_Pos) /* C=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + /* region #3: (not configured) */ + { MPU_RBAR_VALID_Msk | (MPU_RBAR_REGION_Msk & 2U), 0U }, + + { /* region #3: Peripherals: base=0x4000'0000, size=512M=2^(28+1) */ + 0x40000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 3U), /* region #3 */ + (28U << MPU_RASR_SIZE_Pos) /* 2^(28+1) region */ + | (0x3U << MPU_RASR_AP_Pos) /* PA:rw/UA:rw */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | (1U << MPU_RASR_S_Pos) /* S=1 */ + | (1U << MPU_RASR_B_Pos) /* B=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #4: Priv. Periph: base=0xE000'0000, size=512M=2^(28+1) */ + 0xE0000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 4U), /* region #4 */ + (28U << MPU_RASR_SIZE_Pos) /* 2^(28+1) region */ + | (0x3U << MPU_RASR_AP_Pos) /* PA:rw/UA:rw */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | (1U << MPU_RASR_S_Pos) /* S=1 */ + | (1U << MPU_RASR_B_Pos) /* B=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #5: Ext RAM: base=0x6000'0000, size=1G=2^(29+1) */ + 0x60000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 5U), /* region #5 */ + (29U << MPU_RASR_SIZE_Pos) /* 2^(28+1) region */ + | (0x3U << MPU_RASR_AP_Pos) /* PA:rw/UA:rw */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | (1U << MPU_RASR_S_Pos) /* S=1 */ + | (1U << MPU_RASR_B_Pos) /* B=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #6: Ext Dev: base=0xA000'0000, size=1G=2^(29+1) */ + 0xA0000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 6U), /* region #6 */ + (29U << MPU_RASR_SIZE_Pos) /* 2^(28+1) region */ + | (0x3U << MPU_RASR_AP_Pos) /* PA:rw/UA:rw */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | (1U << MPU_RASR_S_Pos) /* S=1 */ + | (1U << MPU_RASR_B_Pos) /* B=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #7: NULL-pointer: base=0x000'0000, size=256B, NOTE0 */ + 0x00000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 7U), /* region #7 */ + (7U << MPU_RASR_SIZE_Pos) /* 2^(7+1)=256B region */ + | (0x0U << MPU_RASR_AP_Pos) /* PA:na/UA:na */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + }; + + /* enable the MemManage_Handler for MPU exception */ + SCB->SHCSR |= SCB_SHCSR_MEMFAULTENA_Msk; + + __DSB(); + MPU->CTRL = 0U; /* disable the MPU */ + for (uint_fast8_t n = 0U; n < Q_DIM(mpu_setup); ++n) { + MPU->RBAR = mpu_setup[n].rbar; + MPU->RASR = mpu_setup[n].rasr; + } + MPU->CTRL = MPU_CTRL_ENABLE_Msk; /* enable the MPU */ + __ISB(); + __DSB(); +} + /*..........................................................................*/ void BSP_init(void) { + /* setup the MPU... */ + EFM32PG182_MPU_setup(); + /* NOTE: SystemInit() has been already called from the startup code * but SystemCoreClock needs to be updated */ @@ -116,6 +234,7 @@ void BSP_init(void) { GPIO_PinModeSet(PB_PORT, PB0_PIN, gpioModeInputPull, 1); GPIO_PinModeSet(PB_PORT, PB1_PIN, gpioModeInputPull, 1); + /* initialize the QS software tracing... */ if (QS_INIT((void *)0) == 0) { /* initialize the QS software tracing */ Q_ERROR(); } @@ -148,6 +267,35 @@ void BSP_trace(QActive const *thr, char const *msg) { QS_STR(msg); QS_END() } +/*..........................................................................*/ +uint32_t BSP_romRead(int32_t offset, uint32_t fromEnd) { + int32_t const rom_base = (fromEnd == 0U) + ? 0x100 /* don't include the NULL-ptr region */ + : 0x40000 - 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) + ? 0x100 /* don't include the NULL-ptr region */ + : 0x40000 - 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 + : 0x20008000 - 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 + : 0x20008000 - 4; + *(uint32_t volatile *)(ram_base + offset) = value; +} /*..........................................................................*/ void QF_onStartup(void) { @@ -174,17 +322,21 @@ void QF_onStartup(void) { void QF_onCleanup(void) { } /*..........................................................................*/ -#ifdef QK_ON_CONTEXT_SW +#ifdef QF_ON_CONTEXT_SW /* NOTE: the context-switch callback is called with interrupts DISABLED */ -void QK_onContextSw(QActive *prev, QActive *next) { +void QF_onContextSw(QActive *prev, QActive *next) { QS_BEGIN_NOCRIT(CONTEXT_SW, 0U) /* no critical section! */ QS_OBJ(prev); QS_OBJ(next); QS_END_NOCRIT() } -#endif /* QK_ON_CONTEXT_SW */ +#endif /* QF_ON_CONTEXT_SW */ /*..........................................................................*/ void QK_onIdle(void) { + + GPIO->P[LED_PORT].DOUT |= (1U << LED1_PIN); + GPIO->P[LED_PORT].DOUT &= ~(1U << LED1_PIN); + #ifdef Q_SPY QS_rxParse(); /* parse all the received bytes */ QS_doOutput(); @@ -213,3 +365,12 @@ void QTimeEvt_tick1_( #endif /* Q_SPY */ +/*============================================================================ +* NOTE0: +* The MPU protection against NULL-pointer dereferencing sets up a no-access +* MPU region #7 around the NULL address (0x0). This works even though the +* Vector Table also resides at address 0x0. However, the *size* of the +* no-access region should not exceed the size of the Vector Table. In this +* case, the size is set to 2**(7+1)==256 bytes, which does not contain any +* data that the CPU would legitimately read with the LDR instruction. +*/ diff --git a/test/qk/test_sched/bsp_h743zi.c b/test/qk/test_sched/bsp_h743zi.c new file mode 100644 index 00000000..9656ea06 --- /dev/null +++ b/test/qk/test_sched/bsp_h743zi.c @@ -0,0 +1,300 @@ +/*============================================================================ +* Product: BSP for system-testing of QK kernel, NUCLEO-H743ZI board +* Last updated for version 7.2.0 +* Last updated on 2022-12-15 +* +* Q u a n t u m L e a P s +* ------------------------ +* Modern Embedded Software +* +* Copyright (C) 2005 Quantum Leaps, LLC. All rights reserved. +* +* This program is open source software: you can redistribute it and/or +* modify it under the terms of the GNU General Public License as published +* 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: +* +* +============================================================================*/ +#include "qpc.h" +#include "bsp.h" + +/* STM32CubeH7 include files */ +#include "stm32h7xx_hal.h" +#include "stm32h7xx_nucleo_144.h" +/* add other drivers if necessary... */ + +Q_DEFINE_THIS_FILE + +#ifdef Q_SPY + + /* QSpy source IDs */ + static QSpyId const l_SysTick_Handler = { 100U }; + static QSpyId const l_test_ISR = { 101U }; + + enum AppRecords { /* application-specific trace records */ + CONTEXT_SW = QS_USER1, + TRACE_MSG + }; + +#endif + +/* ISRs used in this project ===============================================*/ +void SysTick_Handler(void); /* prototype */ +void SysTick_Handler(void) { + QK_ISR_ENTRY(); /* inform QXK kernel about entering an ISR */ + + /* process time events for rate 0 */ + QTIMEEVT_TICK_X(0U, &l_SysTick_Handler); + + QK_ISR_EXIT(); /* inform QXK 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 QEvt const t1 = { TEST1_SIG, 0U, 0U }; + QACTIVE_PUBLISH(&t1, &l_test_ISR); + + QK_ISR_EXIT(); /* inform QXK kernel about exiting an ISR */ +} + +/* BSP functions ===========================================================*/ +/*..........................................................................*/ +/* MPU setup for STM32H743ZI MCU */ +static void STM32H743ZI_MPU_setup(void) { + /* The following MPU configuration contains just a generic ROM + * region (with read-only access) and NULL-pointer protection region. + * Otherwise, the MPU will fall back on the background region (PRIVDEFENA). + */ + static struct { + uint32_t rbar; + uint32_t rasr; + } const mpu_setup[] = { + + { /* region #0: Flash: base=0x0000'0000, size=512M=2^(28+1) */ + 0x00000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 0U), /* region #0 */ + (28U << MPU_RASR_SIZE_Pos) /* 2^(18+1) region */ + | (0x6U << MPU_RASR_AP_Pos) /* PA:ro/UA:ro */ + | (1U << MPU_RASR_C_Pos) /* C=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #7: NULL-pointer: base=0x000'0000, size=128M=2^(26+1) */ + /* NOTE: this region extends to 0x080'0000, which is where + * the ROM is re-mapped by STM32 + */ + 0x00000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 7U), /* region #7 */ + (26U << MPU_RASR_SIZE_Pos) /* 2^(26+1)=128M region */ + | (0x0U << MPU_RASR_AP_Pos) /* PA:na/UA:na */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + }; + + /* enable the MemManage_Handler for MPU exception */ + SCB->SHCSR |= SCB_SHCSR_MEMFAULTENA_Msk; + + __DSB(); + MPU->CTRL = 0U; /* disable the MPU */ + for (uint_fast8_t n = 0U; n < Q_DIM(mpu_setup); ++n) { + MPU->RBAR = mpu_setup[n].rbar; + MPU->RASR = mpu_setup[n].rasr; + } + MPU->CTRL = MPU_CTRL_ENABLE_Msk /* enable the MPU */ + | MPU_CTRL_PRIVDEFENA_Msk; /* enable background region */ + __ISB(); + __DSB(); +} + +/*..........................................................................*/ +void BSP_init(void) { + /* setup the MPU... */ + STM32H743ZI_MPU_setup(); + + /* NOTE: SystemInit() has been already called from the startup code + * but SystemCoreClock needs to be updated + */ + SystemCoreClockUpdate(); + + SCB_EnableICache(); /* Enable I-Cache */ + SCB_EnableDCache(); /* Enable D-Cache */ + + /* Configure Flash prefetch and Instr. cache through ART accelerator */ +#if (ART_ACCLERATOR_ENABLE != 0) + __HAL_FLASH_ART_ENABLE(); +#endif /* ART_ACCLERATOR_ENABLE */ + + /* Configure the LEDs */ + BSP_LED_Init(LED1); + BSP_LED_Init(LED2); + BSP_LED_Init(LED3); + + /* Configure the User Button in GPIO Mode */ + BSP_PB_Init(BUTTON_USER, BUTTON_MODE_GPIO); + + if (QS_INIT((void *)0) == 0) { /* 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) { + BSP_LED_On(LED1); +} +/*..........................................................................*/ +void BSP_ledOff(void) { + BSP_LED_Off(LED1); +} +/*..........................................................................*/ +void BSP_trigISR(void) { + NVIC_SetPendingIRQ(EXTI0_IRQn); +} +/*..........................................................................*/ +void BSP_trace(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 + : 0x08200000 - 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 + : 0x08200000 - 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 + : 0x20020000 - 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 + : 0x20020000 - 4; + *(uint32_t volatile *)(ram_base + offset) = value; +} + +/*..........................................................................*/ +void QF_onStartup(void) { + /* set up the SysTick timer to fire at BSP_TICKS_PER_SEC rate */ + //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, see NOTE1 + * + * !!!!!!!!!!!!!!!!!!!!!!!!!!!! CAUTION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * Assign a priority to EVERY ISR explicitly by calling NVIC_SetPriority(). + * DO NOT LEAVE THE ISR PRIORITIES AT THE DEFAULT VALUE! + */ + NVIC_SetPriority(SysTick_IRQn, QF_AWARE_ISR_CMSIS_PRI + 0U); + NVIC_SetPriority(EXTI0_IRQn, QF_AWARE_ISR_CMSIS_PRI + 1U); + /* ... */ + + /* enable IRQs... */ + NVIC_EnableIRQ(EXTI0_IRQn); +} +/*..........................................................................*/ +void QF_onCleanup(void) { +} +/*..........................................................................*/ +#ifdef QF_ON_CONTEXT_SW +/* NOTE: the context-switch callback is called with interrupts DISABLED */ +void QF_onContextSw(QActive *prev, QActive *next) { + QS_BEGIN_NOCRIT(CONTEXT_SW, 0U) /* no critical section! */ + QS_OBJ(prev); + QS_OBJ(next); + QS_END_NOCRIT() +} +#endif /* QF_ON_CONTEXT_SW */ + +/*..........................................................................*/ +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 ============================================================*/ +#ifdef Q_SPY + +/*..........................................................................*/ +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(); +} + +#endif /* Q_SPY */ + +/*============================================================================ +* 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/bsp_l053r8.c b/test/qk/test_sched/bsp_l053r8.c index 3c817dce..8d228e50 100644 --- a/test/qk/test_sched/bsp_l053r8.c +++ b/test/qk/test_sched/bsp_l053r8.c @@ -1,7 +1,7 @@ -/***************************************************************************** -* Product: BSP for system-testing QK kernel, NUCLEO-L053R8 board -* Last updated for version 7.1.3 -* Last updated on 2022-11-20 +/*============================================================================ +* Product: BSP for system-testing of QK kernel, NUCLEO-L053R8 board +* Last updated for version 7.2.0 +* Last updated on 2022-12-13 * * Q u a n t u m L e a P s * ------------------------ @@ -30,7 +30,7 @@ * Contact information: * * -*****************************************************************************/ +============================================================================*/ #include "qpc.h" #include "bsp.h" @@ -52,20 +52,19 @@ Q_DEFINE_THIS_FILE static QSpyId const l_test_ISR = { 101U }; enum AppRecords { /* application-specific trace records */ - CONTEXT_SW = QS_USER, + CONTEXT_SW = QS_USER1, TRACE_MSG }; #endif -/*..........................................................................*/ +/* ISRs used in this project ===============================================*/ void SysTick_Handler(void); /* prototype */ void SysTick_Handler(void) { QK_ISR_ENTRY(); /* inform QXK kernel about entering an ISR */ /* process time events for rate 0 */ QTIMEEVT_TICK_X(0U, &l_SysTick_Handler); - //QACTIVE_POST(the_Ticker0, 0, &l_SysTick_Handler); QK_ISR_EXIT(); /* inform QXK kernel about exiting an ISR */ } @@ -81,13 +80,128 @@ void EXTI0_1_IRQHandler(void) { /* for testing, NOTE03 */ QK_ISR_EXIT(); /* inform QXK kernel about exiting an ISR */ } +/* BSP functions ===========================================================*/ +/*..........................................................................*/ +/* MPU setup for STM32L053R8 MCU */ +static void STM32L053R8_MPU_setup(void) { + /* The following MPU configuration contains the general STM32 memory model + * as described in the ST AppNote AN4838 "Managing memory protection unit + * in STM32 MCUs", Figure 2. Cortex-M0+/M3/M4/M7 processor memory map. + * + * Please note that the actual STM32 MCUs provide much less Flash and SRAM + * than the maximums configured here. This means that actual MCUs have + * unmapped memory regions (e.g., beyond the actual SRAM). Attempts to + * access these regions causes the HardFault exception, which is the + * desired behavior. + */ + static struct { + uint32_t rbar; + uint32_t rasr; + } const mpu_setup[] = { + + { /* region #0: Flash: base=0x0000'0000, size=512M=2^(28+1) */ + 0x00000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 0U), /* region #0 */ + (28U << MPU_RASR_SIZE_Pos) /* 2^(18+1) region */ + | (0x6U << MPU_RASR_AP_Pos) /* PA:ro/UA:ro */ + | (1U << MPU_RASR_C_Pos) /* C=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #1: SRAM: base=0x2000'0000, size=512M=2^(28+1) */ + 0x20000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 1U), /* region #1 */ + (28U << MPU_RASR_SIZE_Pos) /* 2^(28+1) region */ + | (0x3U << MPU_RASR_AP_Pos) /* PA:rw/UA:rw */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | (1U << MPU_RASR_S_Pos) /* S=1 */ + | (1U << MPU_RASR_C_Pos) /* C=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + /* region #3: (not configured) */ + { MPU_RBAR_VALID_Msk | (MPU_RBAR_REGION_Msk & 2U), 0U }, + + { /* region #3: Peripherals: base=0x4000'0000, size=512M=2^(28+1) */ + 0x40000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 3U), /* region #3 */ + (28U << MPU_RASR_SIZE_Pos) /* 2^(28+1) region */ + | (0x3U << MPU_RASR_AP_Pos) /* PA:rw/UA:rw */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | (1U << MPU_RASR_S_Pos) /* S=1 */ + | (1U << MPU_RASR_B_Pos) /* B=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #4: Priv. Periph: base=0xE000'0000, size=512M=2^(28+1) */ + 0xE0000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 4U), /* region #4 */ + (28U << MPU_RASR_SIZE_Pos) /* 2^(28+1) region */ + | (0x3U << MPU_RASR_AP_Pos) /* PA:rw/UA:rw */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | (1U << MPU_RASR_S_Pos) /* S=1 */ + | (1U << MPU_RASR_B_Pos) /* B=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #5: Ext RAM: base=0x6000'0000, size=1G=2^(29+1) */ + 0x60000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 5U), /* region #5 */ + (29U << MPU_RASR_SIZE_Pos) /* 2^(28+1) region */ + | (0x3U << MPU_RASR_AP_Pos) /* PA:rw/UA:rw */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | (1U << MPU_RASR_S_Pos) /* S=1 */ + | (1U << MPU_RASR_B_Pos) /* B=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #6: Ext Dev: base=0xA000'0000, size=1G=2^(29+1) */ + 0xA0000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 6U), /* region #6 */ + (29U << MPU_RASR_SIZE_Pos) /* 2^(28+1) region */ + | (0x3U << MPU_RASR_AP_Pos) /* PA:rw/UA:rw */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | (1U << MPU_RASR_S_Pos) /* S=1 */ + | (1U << MPU_RASR_B_Pos) /* B=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #7: NULL-pointer: base=0x000'0000, size=128M=2^(26+1) */ + /* NOTE: this region extends to 0x080'0000, which is where + * the ROM is re-mapped by STM32 + */ + 0x00000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 7U), /* region #7 */ + (26U << MPU_RASR_SIZE_Pos) /* 2^(26+1)=128M region */ + | (0x0U << MPU_RASR_AP_Pos) /* PA:na/UA:na */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + }; + + __DSB(); + MPU->CTRL = 0U; /* disable the MPU */ + for (uint_fast8_t n = 0U; n < Q_DIM(mpu_setup); ++n) { + MPU->RBAR = mpu_setup[n].rbar; + MPU->RASR = mpu_setup[n].rasr; + } + MPU->CTRL = MPU_CTRL_PRIVDEFENA_Msk /* enable background region */ + | MPU_CTRL_ENABLE_Msk; /* enable the MPU */ + __ISB(); + __DSB(); +} /*..........................................................................*/ void BSP_init(void) { - /* setup the MPU to detect NULL-pointer dereferencing */ - //MPU->CTRL = 0U; /* disable the MPU */ - //MPU->RBAR = (0x0U | 1U << 4 | 1U); - //MPU->RASR = ((0x6U << 24) | (0x2U << 16) | (5 << 1) | 1U); - //MPU->CTRL = 1U; /* enable the MPU */ + /* setup the MPU... */ + STM32L053R8_MPU_setup(); /* NOTE: SystemInit() has been already called from the startup code * but SystemCoreClock needs to be updated @@ -114,9 +228,12 @@ void BSP_init(void) { GPIOC->OSPEEDR |= (1U << 2*13); GPIOC->PUPDR &= ~(3U << 2*13); + /* initialize the QS software tracing... */ if (QS_INIT((void *)0) == 0) { /* initialize the QS software tracing */ Q_ERROR(); } + + /* dictionaries... */ QS_OBJ_DICTIONARY(&l_SysTick_Handler); QS_OBJ_DICTIONARY(&l_test_ISR); @@ -125,7 +242,7 @@ void BSP_init(void) { } /*..........................................................................*/ void BSP_terminate(int16_t result) { - (void)result; + Q_UNUSED_PAR(result); } /*..........................................................................*/ void BSP_ledOn(void) { @@ -141,18 +258,49 @@ void BSP_trigISR(void) { } /*..........................................................................*/ void BSP_trace(QActive const *thr, char const *msg) { - QS_BEGIN(TRACE_MSG, 0U) + 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 + : 0x08010000 - 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 + : 0x08010000 - 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 + : 0x20002000 - 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 + : 0x20002000 - 4; + *(uint32_t volatile *)(ram_base + offset) = value; +} /*..........................................................................*/ void QF_onStartup(void) { /* set up the SysTick timer to fire at BSP_TICKS_PER_SEC rate */ //SysTick_Config(SystemCoreClock / BSP_TICKS_PER_SEC); - /* assign all priority bits for preemption-prio. and none to sub-prio. */ + /* 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, see NOTE1 @@ -172,15 +320,16 @@ void QF_onStartup(void) { void QF_onCleanup(void) { } /*..........................................................................*/ -#ifdef QK_ON_CONTEXT_SW +#ifdef QF_ON_CONTEXT_SW /* NOTE: the context-switch callback is called with interrupts DISABLED */ -void QK_onContextSw(QActive *prev, QActive *next) { +void QF_onContextSw(QActive *prev, QActive *next) { QS_BEGIN_NOCRIT(CONTEXT_SW, 0U) /* no critical section! */ QS_OBJ(prev); QS_OBJ(next); QS_END_NOCRIT() } -#endif /* QK_ON_CONTEXT_SW */ +#endif /* QF_ON_CONTEXT_SW */ + /*..........................................................................*/ void QK_onIdle(void) { #ifdef Q_SPY @@ -211,3 +360,15 @@ void QTimeEvt_tick1_( #endif /* Q_SPY */ +/*============================================================================ +* 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/make_efm32 b/test/qk/test_sched/make_efm32 index 0af7c2c5..0cbed835 100644 --- a/test/qk/test_sched/make_efm32 +++ b/test/qk/test_sched/make_efm32 @@ -1,7 +1,7 @@ ############################################################################## # Product: Makefile for SYSTEM-Level tests of QP/C on EMF32, GNU-ARM -# Last Updated for Version: 7.1.2 -# Date of the Last Update: 2022-10-05 +# Last Updated for Version: 7.2.0 +# Date of the Last Update: 2022-12-21 # # Q u a n t u m L e a P s # ------------------------ @@ -142,7 +142,7 @@ LIBS := # defines DEFINES := -DEFM32PG1B200F256GM48=1 \ - -DQK_ON_CONTEXT_SW + -DQF_ON_CONTEXT_SW # ARM CPU, ARCH, FPU, and Float-ABI types... # ARM_CPU: [cortex-m0 | cortex-m0plus | cortex-m1 | cortex-m3 | cortex-m4] @@ -194,8 +194,6 @@ ifeq ("$(wildcard $(QUTEST))","") QUTEST := python3 $(QTOOLS)/qutest/qutest.py endif -TESTS := *.py - #----------------------------------------------------------------------------- # build options # @@ -247,7 +245,7 @@ endif # rules # -.PHONY : run norun debug flash +.PHONY : run norun flash ifeq ($(MAKECMDGOALS),norun) all : $(TARGET_BIN) @@ -268,7 +266,7 @@ flash : $(FLASH) $(TARGET_BIN) run : $(TARGET_BIN) - $(QUTEST) $(TESTS) $(TARGET_EXE) $(HOST) + $(QUTEST) -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ @@ -298,7 +296,7 @@ endif endif debug : - $(QUTEST) $(TESTS) DEBUG $(HOST) + $(QUTEST) -edebug -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) .PHONY : clean show diff --git a/test/qk/test_sched/make_nucleo-h743zi b/test/qk/test_sched/make_nucleo-h743zi new file mode 100644 index 00000000..79d45302 --- /dev/null +++ b/test/qk/test_sched/make_nucleo-h743zi @@ -0,0 +1,346 @@ +############################################################################## +# Product: Makefile for QP/C on NUCLEO-H743ZI board, QUTEST, GNU-ARM +# Last Updated for Version: 7.2.0 +# Date of the Last Update: 2022-12-21 +# +# Q u a n t u m L e a P s +# ------------------------ +# Modern Embedded Software +# +# Copyright (C) 2005 Quantum Leaps, LLC. All rights reserved. +# +# This program is open source software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License as published +# 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 make_nucleo-h743zi USB=g: # make, uplaod to USB drive, run the tests +# make -f make_nucleo-h743zi USB=g: TESTS=philo*.py # make and run the selected tests +# make -f make_nucleo-h743zi USB=g: HOST=localhost:7705 # connect to host:port +# make -f make_nucleo-h743zi USB=g: norun # only make but not run the tests +# make -f make_nucleo-h743zi USB=g: clean # cleanup the build +# +# 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 ($(QPC),) +QPC := ../../.. +endif + +#----------------------------------------------------------------------------- +# project name, target name, target directory: +# +PROJECT := test_sched +TARGET := nucleo-h743zi +TARGET_DIR := $(QPC)/3rd_party/STM32CubeH7/qutest + +#----------------------------------------------------------------------------- +# project directories: +# + +# QP port used in this project +QP_PORT_DIR := $(QPC)/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 := . \ + $(QPC)/src/qf \ + $(QPC)/src/qk \ + $(QPC)/src/qs \ + $(QP_PORT_DIR) \ + $(TARGET_DIR) \ + $(QPC)/3rd_party/STM32CubeH7/nucleo-h743zi/gnu \ + $(QPC)/3rd_party/STM32CubeH7/Drivers/BSP\STM32H7xx_Nucleo_144 \ + $(QPC)/3rd_party/STM32CubeH7/Drivers/STM32H7xx_HAL_Driver/Src \ + $(QPC)/3rd_party/STM32CubeH7/Drivers/CMSIS/Device/ST/STM32H7xx/Source/Templates + +# list of all include directories needed by this project +INCLUDES = -I. \ + -I$(QPC)/include \ + -I$(QP_PORT_DIR) \ + -I$(TARGET_DIR) \ + -I$(QPC)/3rd_party/CMSIS/Include \ + -I$(QPC)/3rd_party/STM32CubeH7/Drivers/CMSIS/Device/ST/STM32H7xx/Include \ + -I$(QPC)/3rd_party/STM32CubeH7/Drivers/BSP/STM32H7xx_Nucleo_144 \ + -I$(QPC)/3rd_party/STM32CubeH7/Drivers/STM32H7xx_HAL_Driver/Inc + +#----------------------------------------------------------------------------- +# project files: +# + +# assembler source files +ASM_SRCS := + +# C source files +C_SRCS := \ + test_sched.c \ + bsp_h743zi.c \ + startup_stm32h743xx.c \ + system_stm32h7xx.c \ + stm32h7xx_nucleo_144.c \ + stm32h7xx_hal.c \ + stm32h7xx_hal_cortex.c \ + stm32h7xx_hal_gpio.c \ + stm32h7xx_hal_pwr_ex.c \ + stm32h7xx_hal_rcc.c \ + stm32h7xx_hal_rcc_ex.c \ + stm32h7xx_hal_msp.c \ + stm32h7xx_hal_uart.c + +# C++ source files +CPP_SRCS := + +OUTPUT := $(PROJECT) +LD_SCRIPT := $(TARGET_DIR)/qutest.ld + +QP_SRCS := \ + qep_hsm.c \ + qep_msm.c \ + qf_act.c \ + qf_actq.c \ + qf_defer.c \ + qf_dyn.c \ + qf_mem.c \ + qf_ps.c \ + qf_qact.c \ + qf_qeq.c \ + qf_qmact.c \ + qf_time.c \ + qk.c \ + qk_port.c \ + qs.c \ + qs_64bit.c \ + qs_rx.c \ + qs_fp.c \ + qutest.c \ + qutest_port.c + +QP_ASMS := + +LIB_DIRS := +LIBS := + +# defines +DEFINES := -DQP_API_VERSION=9999 \ + -DSTM32H743xx -DUSE_HAL_DRIVER -DUSE_STM32H7XX_NUCLEO_144 \ + -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-m7 +ARM_FPU := -mfpu=fpv5-d16 +FLOAT_ABI := -mfloat-abi=softfp + +#----------------------------------------------------------------------------- +# 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-gcc +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 soruces... +C_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) + $(CC) $(CFLAGS) $(QPC)/include/qstamp.c -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) $(TESTS) DEBUG $(HOST) + +.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/make_nucleo-l053r8 b/test/qk/test_sched/make_nucleo-l053r8 index 14d7b164..2d6f32ce 100644 --- a/test/qk/test_sched/make_nucleo-l053r8 +++ b/test/qk/test_sched/make_nucleo-l053r8 @@ -1,7 +1,7 @@ ############################################################################## # Product: Makefile for SYSTEM-Level tests of QP/C on NUCLEO-L053R8, GNU-ARM -# Last Updated for Version: 7.1.2 -# Date of the Last Update: 2022-10-05 +# Last Updated for Version: 7.2.0 +# Date of the Last Update: 2022-12-21 # # Q u a n t u m L e a P s # ------------------------ @@ -33,8 +33,8 @@ ############################################################################## # # examples of invoking this Makefile: -# make -f make_nucleo-l053r8 USB=e: # make, uplaod to USB drive, run the tests -# make -f make_nucleo-l053r8 USB=h: TESTS=philo*.py # make and run the selected tests +# make -f make_nucleo-l053r8 USB=g: # make, uplaod to USB drive, run the tests +# make -f make_nucleo-l053r8 USB=g: TESTS=philo*.py # make and run the selected tests # make -f make_nucleo-l053r8 HOST=localhost:7705 # connect to host:port # make -f make_nucleo-l053r8 norun # only make but not run the tests # make -f make_nucleo-l053r8 clean # cleanup the build @@ -137,8 +137,8 @@ LIB_DIRS := LIBS := # defines -DEFINES := \ - -DQK_ON_CONTEXT_SW +DEFINES := -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] @@ -169,11 +169,11 @@ LINK := $(GNU_ARM)/bin/arm-none-eabi-gcc BIN := $(GNU_ARM)/bin/arm-none-eabi-objcopy #----------------------------------------------------------------------------- -# NOTE: The following symbol USB assumes that the NUCLEO board +# NOTE: The symbol USB must be provided for the NUCLEO board # has enumerated as USB drive f: # ifeq ($(USB),) -USB := f: +$(error USB drive not provided for the NUCLEO board.) endif ############################################################################## @@ -194,8 +194,6 @@ ifeq ("$(wildcard $(QUTEST))","") QUTEST := python3 $(QTOOLS)/qutest/qutest.py endif -TESTS := *.py - #----------------------------------------------------------------------------- # build options # @@ -269,7 +267,7 @@ flash : $(CP) $(TARGET_BIN) $(USB) run : $(TARGET_BIN) - $(QUTEST) $(TESTS) $(TARGET_EXE) $(HOST) + $(QUTEST) -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ diff --git a/test/qk/test_sched/test_mpu.py b/test/qk/test_sched/test_mpu.py new file mode 100644 index 00000000..2ea7e64b --- /dev/null +++ b/test/qk/test_sched/test_mpu.py @@ -0,0 +1,99 @@ +# test-script for QUTest unit testing harness +# see https://www.state-machine.com/qtools/qutest.html/qutest.html + +note(''' +@uid{TQP701} +This test group verifies the memory access protection, +specifically the protection of various memory regions. +All tests run during the QS_TEST_PAUSE() in +the test_sched.c fixture. +''') + +# preamble +def on_reset(): + expect_pause() + # don't call continue_test() + +def on_setup(): + glb_filter(GRP_SC, GRP_UA) + +MEM_START = 0 +MEM_END = 1 + +# NULL-pointer dereferencing... +test(''' +NULL-read -> ASSERT +''') +command("MEM_READ", 0x0, 0x80) # value = *(uint32_t volatile *)(param1 + param2); +expect("@timestamp =ASSERT= Mod=*") + +test("NULL-write -> ASSERT") +command("MEM_WRITE", 0x0, 0xA0, 123) # *(uint32_t volatile *)(param1 + param2) = param3; +expect("@timestamp =ASSERT= Mod=*") + +# ROM_READ... +test("Below-Start Flash-read -> ASSERT") +command("ROM_READ", (-4 & 0xFFFFFFFF), MEM_START) # value = BSP_romRead(param1, param2); +expect("@timestamp =ASSERT= Mod=*") + +test("Start-of Flash-read") +command("ROM_READ", 0x0, MEM_START) # value = BSP_romRead(param1, param2); +expect("@timestamp USER+000 ROM_READ *") +expect("@timestamp Trg-Done QS_RX_COMMAND") + +test("Middle-of Flash-read", NORESET) +command("ROM_READ", 0x400, MEM_START) # value = BSP_romRead(param1, param2); +expect("@timestamp USER+000 ROM_READ *") +expect("@timestamp Trg-Done QS_RX_COMMAND") + +test("End-of Flash-read", NORESET) +command("ROM_READ", 0x0, MEM_END) # value = BSP_romRead(param1, param2); +expect("@timestamp USER+000 ROM_READ *") +expect("@timestamp Trg-Done QS_RX_COMMAND") + +skip(1) +test("After-End Flash-read-> ASSERT", NORESET) +command("ROM_READ", 0x4, MEM_END) # value = BSP_romRead(param1, param2); +expect("@timestamp =ASSERT= Mod=*") + +# ROM_WRITE... +test("Middle-of Flash-write -> ASSERT") +command("ROM_WRITE", 0x400, MEM_START, 123) # BSP_romWrite(param1, param2, param3); +expect("@timestamp =ASSERT= Mod=*") + +# RAM_READ... +test("Below-Start SRAM-read -> ASSERT") +command("RAM_READ", (-0x4 & 0xFFFFFFFF), MEM_START) # value = BSP_ramRead(param1, param2); +expect("@timestamp =ASSERT= Mod=*") + +test("Start-of SRAM-read") +command("RAM_READ", 0x0, MEM_START) # value = BSP_ramRead(param1, param2); +expect("@timestamp USER+000 RAM_READ *") +expect("@timestamp Trg-Done QS_RX_COMMAND") + +test("Middle-of SRAM-read", NORESET) +command("RAM_READ", 0x300, MEM_START) # value = BSP_ramRead(param1, param2); +expect("@timestamp USER+000 RAM_READ *") +expect("@timestamp Trg-Done QS_RX_COMMAND") + +test("End-of SRAM-read", NORESET) +command("RAM_READ", 0x0, MEM_END) # value = BSP_ramRead(param1, param2); +expect("@timestamp USER+000 RAM_READ *") +expect("@timestamp Trg-Done QS_RX_COMMAND") + +# RAM_WRITE... +test("Below-Start SRAM-write -> ASSERT", NORESET) +command("RAM_WRITE", (-0x4 & 0xFFFFFFFF), MEM_START, 123) # BSP_ramWrite(param1, param2, param3); +expect("@timestamp =ASSERT= Mod=*") + +# wrtiting to RAM does not need to be tested becasue the fact +# that the test fixture runs at all means that RAM works. +skip(1) +test("Middle-of SRAM-write") +command("RAM_WRITE", 0x300, MEM_START, 123) # BSP_ramWrite(param1, param2, param3); +expect("@timestamp USER+000 RAM_WRITE *") +expect("@timestamp Trg-Done QS_RX_COMMAND") + +test("After-End SRAM-write -> ASSERT") +command("RAM_WRITE", 0x4, MEM_END, 123) # BSP_ramWrite(param1, param2, param3); +expect("@timestamp =ASSERT= Mod=*") diff --git a/test/qk/test_sched/test_sched.c b/test/qk/test_sched/test_sched.c index fb80e1e3..8a0df328 100644 --- a/test/qk/test_sched/test_sched.c +++ b/test/qk/test_sched/test_sched.c @@ -1,7 +1,7 @@ /*============================================================================ * Product: System test fixture for QK kernel -* Last updated for version 7.1.2 -* Last updated on 2022-10-05 +* Last updated for version 7.2.0 +* Last updated on 2022-12-22 * * Q u a n t u m L e a P s * ------------------------ @@ -94,38 +94,54 @@ QState ObjB_active(ObjB * const me, QEvt const * const e) { ObjB aoB[NUM_B]; /*==========================================================================*/ +enum UserCommands { + MEM_READ, MEM_WRITE, + ROM_READ, ROM_WRITE, + RAM_READ, RAM_WRITE, +}; + int main() { QF_init(); /* initialize the framework and the underlying QXK kernel */ BSP_init(); /* initialize the Board Support Package */ - /* dictionaries */ - QS_FUN_DICTIONARY(&QHsm_top); - QS_SIG_DICTIONARY(TEST0_SIG, (void *)0); - QS_SIG_DICTIONARY(TEST1_SIG, (void *)0); - QS_SIG_DICTIONARY(TEST2_SIG, (void *)0); - QS_SIG_DICTIONARY(TEST3_SIG, (void *)0); - - uint8_t n; - for (uint8_t n = 0U; n < NUM_B; ++n) { - QS_OBJ_ARR_DICTIONARY(&aoB[n], n); - } - - static QPrioSpec pspecB[NUM_B + 1]; - QS_OBJ_DICTIONARY(pspecB); - /* initialize publish-subscribe... */ static QSubscrList subscrSto[MAX_PUB_SIG]; - QF_psInit(subscrSto, Q_DIM(subscrSto)); + QActive_psInit(subscrSto, Q_DIM(subscrSto)); /* initialize event pools... */ static QF_MPOOL_EL(QEvt) smlPoolSto[10]; /* small pool */ QF_poolInit(smlPoolSto, sizeof(smlPoolSto), sizeof(smlPoolSto[0])); - /* pause execution of the test and wait for the test script to continue */ + /* dictionaries */ + QS_SIG_DICTIONARY(TEST0_SIG, (void *)0); + QS_SIG_DICTIONARY(TEST1_SIG, (void *)0); + QS_SIG_DICTIONARY(TEST2_SIG, (void *)0); + QS_SIG_DICTIONARY(TEST3_SIG, (void *)0); + + QS_ENUM_DICTIONARY(MEM_READ, QS_CMD); + QS_ENUM_DICTIONARY(MEM_WRITE, QS_CMD); + QS_ENUM_DICTIONARY(ROM_READ, QS_CMD); + QS_ENUM_DICTIONARY(ROM_WRITE, QS_CMD); + QS_ENUM_DICTIONARY(RAM_READ, QS_CMD); + QS_ENUM_DICTIONARY(RAM_WRITE, QS_CMD); + + for (uint8_t n = 0U; n < NUM_B; ++n) { + QS_OBJ_ARR_DICTIONARY(&aoB[n], n); + } + + /* priority specifications for ObjBs... */ + static QPrioSpec pspecB[NUM_B + 1]; + QS_OBJ_DICTIONARY(pspecB); + + /* pause execution of the test and wait for the test script to continue + * NOTE: + * this pause gives the test-script a chance to poke pspecB and pspecX + * variables to start the threads with the desired prio-specifications. + */ QS_TEST_PAUSE(); static QEvt const *aoB_queueSto[NUM_B][10]; - for (n = 0U; n < NUM_B; ++n) { + for (uint8_t n = 0U; n < NUM_B; ++n) { if (pspecB[n] != 0U) { ObjB_ctor(&aoB[n]); /* instantiate the AO */ QACTIVE_START(&aoB[n].super, /* AO to start */ @@ -152,16 +168,73 @@ void QS_onTestTeardown(void) { void QS_onCommand(uint8_t cmdId, uint32_t param1, uint32_t param2, uint32_t param3) { - Q_UNUSED_PAR(cmdId); - Q_UNUSED_PAR(param1); - Q_UNUSED_PAR(param2); - Q_UNUSED_PAR(param3); + uint32_t volatile value; + + switch (cmdId) { + case MEM_READ: { // read MEM (can trip the MPU) + value = *(uint32_t volatile *)(param1 + param2); + QS_BEGIN_ID(QS_USER, 0U) + QS_ENUM(QS_CMD, cmdId); + QS_U32(0, value); + QS_END() + break; + } + case MEM_WRITE: { // write MEM (can trip the MPU) + *(uint32_t volatile *)(param1 + param2) = param3; + QS_BEGIN_ID(QS_USER, 0U) + QS_ENUM(QS_CMD, cmdId); + QS_U32(QS_HEX_FMT , param1); + QS_U32(QS_HEX_FMT , param2); + QS_U32(0 , param3); + QS_END() + break; + } + case ROM_READ: { // read ROM (can trip the MPU) + value = BSP_romRead((int32_t)param1, param2); + QS_BEGIN_ID(QS_USER, 0U) + QS_ENUM(QS_CMD, cmdId); + QS_U32(0, value); + QS_END() + break; + } + case ROM_WRITE: { // write ROM (can trip the MPU) + BSP_romWrite(param1, param2, param3); + QS_BEGIN_ID(QS_USER, 0U) + QS_ENUM(QS_CMD, cmdId); + QS_U32(QS_HEX_FMT , param1); + QS_U32(QS_HEX_FMT , param2); + QS_U32(0 , param3); + QS_END() + break; + } + case RAM_READ: { // read RAM (can trip the MPU) + value = BSP_ramRead(param1, param2); + QS_BEGIN_ID(QS_USER, 0U) + QS_ENUM(QS_CMD, cmdId); + QS_U32(0, value); + QS_END() + break; + } + case RAM_WRITE: { // write RAM (can trip the MPU) + BSP_ramWrite(param1, param2, param3); + QS_BEGIN_ID(QS_USER, 0U) + QS_ENUM(QS_CMD, cmdId); + QS_U32(QS_HEX_FMT , param1); + QS_U32(QS_HEX_FMT , param2); + QS_U32(0, param3); + QS_END() + break; + } + default: { + break; + } + } } /****************************************************************************/ /*! Host callback function to "massage" the event, if necessary */ void QS_onTestEvt(QEvt *e) { - (void)e; + Q_UNUSED_PAR(e); } /*..........................................................................*/ /*! callback function to output the posted QP events (not used here) */ diff --git a/test/qk/test_sched/test_sched.py b/test/qk/test_sched/test_sched.py index 7d1c3095..bfc5e823 100644 --- a/test/qk/test_sched/test_sched.py +++ b/test/qk/test_sched/test_sched.py @@ -1,22 +1,33 @@ # test-script for QUTest unit testing harness # see https://www.state-machine.com/qtools/qutest.html/qutest.html +tag('''@uid{TQP603} +This test group verifies the preemption scenarios +in the QK preemptive kernel +''') + # preamble def on_reset(): expect_pause() + # don't call continue_test() yet + # this will be done by the individual tests + # after they poke the priorities of threads +# helper function to repliacte the Q_PRIO() macro def Q_PRIO(prio, pthre): return prio | (pthre << 8) -test("ao->ao->ao (NO PTS)") +scenario("Scenario: ao->ao->ao (NO PTS)") +# given... current_obj(OBJ_AP, "pspecB") poke(0, 2, pack("2") expect("@timestamp CONTEXT_SW NULL aoB[1]") expect("@timestamp TRACE_MSG aoB[1] TEST0 1of2") @@ -63,15 +74,17 @@ expect("@timestamp CONTEXT_SW aoB[0] NULL") expect("@timestamp Trg-Done QS_RX_EVENT") -test("ao->ao->ao (PTS1)") +scenario("ao->ao->ao (PTS1)") +# given... current_obj(OBJ_AP, "pspecB") poke(0, 2, pack("2") expect("@timestamp CONTEXT_SW NULL aoB[1]") expect("@timestamp TRACE_MSG aoB[1] TEST0 1of2") @@ -118,15 +131,17 @@ expect("@timestamp CONTEXT_SW aoB[0] NULL") expect("@timestamp Trg-Done QS_RX_EVENT") -test("ao->ao->ao (PTS2)") +scenario("ao->ao->ao (PTS2)") +# given... current_obj(OBJ_AP, "pspecB") poke(0, 2, pack("2") expect("@timestamp CONTEXT_SW NULL aoB[1]") expect("@timestamp TRACE_MSG aoB[1] TEST0 1of2") @@ -171,52 +186,3 @@ expect("@timestamp TRACE_MSG aoB[0] TEST2 1of1") expect("@timestamp Sch-Idle Pri=1->0") expect("@timestamp CONTEXT_SW aoB[0] NULL") expect("@timestamp Trg-Done QS_RX_EVENT") - - -test("ao->ao->ao (PTS2, NORESET)", NORESET) -post("TEST0_SIG") -expect("@timestamp Sch-Next Pri=0->2") -expect("@timestamp CONTEXT_SW NULL aoB[1]") -expect("@timestamp TRACE_MSG aoB[1] TEST0 1of2") -expect("@timestamp TRACE_MSG aoB[1] TEST0 2of2") -expect("@timestamp Sch-Next Pri=2->3") -expect("@timestamp CONTEXT_SW aoB[1] aoB[2]") -expect("@timestamp TRACE_MSG aoB[2] TEST1 1of2") -expect("@timestamp Sch-Lock Ceil=0->3") -expect("@timestamp Sch-Unlk Ceil=3->0") -expect("@timestamp TRACE_MSG aoB[2] TEST1 2of2") -expect("@timestamp TRACE_MSG aoB[2] TEST2 1of1") -expect("@timestamp Sch-Next Pri=3->2") -expect("@timestamp CONTEXT_SW aoB[2] aoB[1]") -expect("@timestamp TRACE_MSG aoB[1] TEST1 1of2") -expect("@timestamp Sch-Lock Ceil=0->3") -expect("@timestamp Sch-Unlk Ceil=3->0") -expect("@timestamp TRACE_MSG aoB[1] TEST1 2of2") -expect("@timestamp Sch-Next Pri=2->3") -expect("@timestamp CONTEXT_SW aoB[1] aoB[2]") -expect("@timestamp TRACE_MSG aoB[2] TEST2 1of1") -expect("@timestamp Sch-Next Pri=3->2") -expect("@timestamp CONTEXT_SW aoB[2] aoB[1]") -expect("@timestamp TRACE_MSG aoB[1] TEST2 1of1") -expect("@timestamp TRACE_MSG aoB[1] TEST2 1of1") -expect("@timestamp Sch-Next Pri=2->1") -expect("@timestamp CONTEXT_SW aoB[1] aoB[0]") -expect("@timestamp TRACE_MSG aoB[0] TEST1 1of2") -expect("@timestamp Sch-Lock Ceil=0->3") -expect("@timestamp Sch-Unlk Ceil=3->0") -expect("@timestamp Sch-Next Pri=1->3") -expect("@timestamp CONTEXT_SW aoB[0] aoB[2]") -expect("@timestamp TRACE_MSG aoB[2] TEST2 1of1") -expect("@timestamp Sch-Next Pri=3->2") -expect("@timestamp CONTEXT_SW aoB[2] aoB[1]") -expect("@timestamp TRACE_MSG aoB[1] TEST2 1of1") -expect("@timestamp Sch-Next Pri=2->1") -expect("@timestamp CONTEXT_SW aoB[1] aoB[0]") -expect("@timestamp TRACE_MSG aoB[0] TEST1 2of2") -expect("@timestamp TRACE_MSG aoB[0] TEST2 1of1") -expect("@timestamp TRACE_MSG aoB[0] TEST2 1of1") -expect("@timestamp TRACE_MSG aoB[0] TEST2 1of1") -expect("@timestamp Sch-Idle Pri=1->0") -expect("@timestamp CONTEXT_SW aoB[0] NULL") -expect("@timestamp Trg-Done QS_RX_EVENT") - diff --git a/test/qk/test_sched/uvision_efm32.uvoptx b/test/qk/test_sched/uvision_efm32.uvoptx index 9bb06f26..5e7c7f38 100644 --- a/test/qk/test_sched/uvision_efm32.uvoptx +++ b/test/qk/test_sched/uvision_efm32.uvoptx @@ -198,7 +198,7 @@ 0 0 1 - .\test_pts.c + C:\qp-dev\qpc\test\qk\test_sched\test_pts.c \\test\test_pts.c\180 @@ -328,8 +328,8 @@ 0 0 0 - .\test_pts.c - test_pts.c + .\test_sched.c + test_sched.c 0 0 @@ -348,7 +348,7 @@ 0 0 0 - ..\..\..\..\3rd_party\efm32pg1b\arm\startup_efm32pg1b.s + ..\..\..\3rd_party\efm32pg1b\arm\startup_efm32pg1b.s startup_efm32pg1b.s 0 0 @@ -360,7 +360,7 @@ 0 0 0 - ..\..\..\..\3rd_party\efm32pg1b\em_cmu.c + ..\..\..\3rd_party\efm32pg1b\em_cmu.c em_cmu.c 0 0 @@ -372,7 +372,7 @@ 0 0 0 - ..\..\..\..\3rd_party\efm32pg1b\em_emu.c + ..\..\..\3rd_party\efm32pg1b\em_emu.c em_emu.c 0 0 @@ -384,7 +384,7 @@ 0 0 0 - ..\..\..\..\3rd_party\efm32pg1b\em_gpio.c + ..\..\..\3rd_party\efm32pg1b\em_gpio.c em_gpio.c 0 0 @@ -396,7 +396,7 @@ 0 0 0 - ..\..\..\..\3rd_party\efm32pg1b\system_efm32pg1b.c + ..\..\..\3rd_party\efm32pg1b\system_efm32pg1b.c system_efm32pg1b.c 0 0 @@ -408,7 +408,7 @@ 0 0 0 - ..\..\..\..\3rd_party\efm32pg1b\em_system.c + ..\..\..\3rd_party\efm32pg1b\em_system.c em_system.c 0 0 @@ -420,7 +420,7 @@ 0 0 0 - ..\..\..\..\3rd_party\efm32pg1b\em_usart.c + ..\..\..\3rd_party\efm32pg1b\em_usart.c em_usart.c 0 0 @@ -584,18 +584,6 @@ 0 0 0 - ..\..\..\include\qstamp.c - qstamp.c - 0 - 0 - - - 3 - 24 - 1 - 0 - 0 - 0 ..\..\..\src\qk\qk.c qk.c 0 @@ -611,7 +599,7 @@ 0 4 - 25 + 24 5 0 0 @@ -623,7 +611,7 @@ 4 - 26 + 25 5 0 0 @@ -635,7 +623,7 @@ 4 - 27 + 26 5 0 0 @@ -647,7 +635,7 @@ 4 - 28 + 27 1 0 0 @@ -659,7 +647,7 @@ 4 - 29 + 28 5 0 0 @@ -671,7 +659,7 @@ 4 - 30 + 29 1 0 0 @@ -691,7 +679,7 @@ 0 5 - 31 + 30 1 0 0 @@ -703,7 +691,7 @@ 5 - 32 + 31 1 0 0 @@ -715,7 +703,7 @@ 5 - 33 + 32 1 0 0 @@ -727,7 +715,7 @@ 5 - 34 + 33 1 0 0 @@ -739,7 +727,7 @@ 5 - 35 + 34 1 0 0 @@ -749,6 +737,18 @@ 0 0 + + 5 + 35 + 1 + 0 + 0 + 0 + ..\..\..\src\qs\qstamp.c + qstamp.c + 0 + 0 + diff --git a/test/qk/test_sched/uvision_efm32.uvprojx b/test/qk/test_sched/uvision_efm32.uvprojx index 65e7f24b..4cbe70e4 100644 --- a/test/qk/test_sched/uvision_efm32.uvprojx +++ b/test/qk/test_sched/uvision_efm32.uvprojx @@ -49,7 +49,7 @@ 1 .\uvision_emf32\ - test + test_fixture 1 0 0 @@ -72,7 +72,7 @@ 1 0 - cmd /c "del .\uvision_em32\qstamp.o" + cmd /c "del .\uvision_emf32\qstamp.o" 0 0 @@ -82,7 +82,7 @@ 1 0 - fromelf --bin --output .\uvision_em32\test.bin .\uvision_em32\test.axf + fromelf --bin --output .\uvision_emf32\test_fixture.bin .\uvision_emf32\test_fixture.axf 0 0 @@ -313,7 +313,7 @@ 0 - 1 + 0 0 0 1 @@ -337,9 +337,9 @@ 0 - Q_SPY, Q_UTEST=0 + Q_SPY,Q_UTEST=0,QF_ON_CONTEXT_SW - .;..\..\..\include;..\..\..\ports\arm-cm\qk\armclang;..\..\..\..\3rd_party\CMSIS\Include;..\..\..\..\3rd_party\efm32pg1b + .;..\..\..\include;..\..\..\ports\arm-cm\qk\armclang;..\..\..\3rd_party\CMSIS\Include;..\..\..\3rd_party\efm32pg1b @@ -394,9 +394,9 @@ .\bsp_efm32.c - test_pts.c + test_sched.c 1 - .\test_pts.c + .\test_sched.c @@ -406,37 +406,37 @@ startup_efm32pg1b.s 2 - ..\..\..\..\3rd_party\efm32pg1b\arm\startup_efm32pg1b.s + ..\..\..\3rd_party\efm32pg1b\arm\startup_efm32pg1b.s em_cmu.c 1 - ..\..\..\..\3rd_party\efm32pg1b\em_cmu.c + ..\..\..\3rd_party\efm32pg1b\em_cmu.c em_emu.c 1 - ..\..\..\..\3rd_party\efm32pg1b\em_emu.c + ..\..\..\3rd_party\efm32pg1b\em_emu.c em_gpio.c 1 - ..\..\..\..\3rd_party\efm32pg1b\em_gpio.c + ..\..\..\3rd_party\efm32pg1b\em_gpio.c system_efm32pg1b.c 1 - ..\..\..\..\3rd_party\efm32pg1b\system_efm32pg1b.c + ..\..\..\3rd_party\efm32pg1b\system_efm32pg1b.c em_system.c 1 - ..\..\..\..\3rd_party\efm32pg1b\em_system.c + ..\..\..\3rd_party\efm32pg1b\em_system.c em_usart.c 1 - ..\..\..\..\3rd_party\efm32pg1b\em_usart.c + ..\..\..\3rd_party\efm32pg1b\em_usart.c @@ -503,11 +503,6 @@ 1 ..\..\..\src\qf\qf_time.c - - qstamp.c - 1 - ..\..\..\include\qstamp.c - qk.c 1 @@ -578,6 +573,11 @@ 1 ..\..\..\src\qs\qutest.c + + qstamp.c + 1 + ..\..\..\src\qs\qstamp.c + diff --git a/test/qk/test_sched/uvision_l053r8.uvoptx b/test/qk/test_sched/uvision_l053r8.uvoptx new file mode 100644 index 00000000..79e8251e --- /dev/null +++ b/test/qk/test_sched/uvision_l053r8.uvoptx @@ -0,0 +1,705 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj; *.o + *.lib + *.txt; *.h; *.inc; *.md + *.plm + *.cpp + 0 + + + + 0 + 0 + + + + test_l053r8 + 0x4 + ARM-ADS + + 12000000 + + 1 + 1 + 1 + 0 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\spy\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 18 + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 0 + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 6 + + + + + + + + + + + STLink\ST-LINKIII-KEIL_SWO.dll + + + + 0 + UL2CM3 + -O207 -S0 -C0 -FO7 -FN1 -FC1000 -FD20000000 -FF0STM32L0xx_64 -FL010000 -FS08000000 -FP0($$Device:STM32L053R8Tx$CMSIS\Flash\STM32L0xx_64.FLM) + + + 0 + ST-LINKIII-KEIL_SWO + -U066CFF484951775087074312 -O8431 -SF10000 -C0 -A0 -I0 -HNlocalhost -HP7184 -P2 -N00("ARM CoreSight SW-DP (ARM Core") -D00(0BC11477) -L00(0) -TO131090 -TC10000000 -TT10000000 -TP21 -TDS8004 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32L0xx_64.FLM -FS08000000 -FL010000 -FP0($$Device:STM32L053R8Tx$CMSIS\Flash\STM32L0xx_64.FLM) + + + 0 + DLGUARM + (105=-1,-1,-1,-1,0) + + + 0 + ARMRTXEVENTFLAGS + -L70 -Z18 -C0 -M0 -T1 + + + 0 + DLGTARM + (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0) + + + 0 + ARMDBGFLAGS + + + + + + 0 + 0 + 171 + 1 +
0
+ 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\3rd_party\nucleo-l053r8\arm\startup_stm32l053xx.s + + +
+ + 1 + 0 + 142 + 1 +
0
+ 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\3rd_party\nucleo-l053r8\qutest\qutest_port.c + + +
+ + 2 + 0 + 76 + 1 +
0
+ 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\3rd_party\nucleo-l053r8\qutest\qutest_port.c + + +
+
+ + + 1 + 2 + 0x20000200 + 0 + + + + + 2 + 0 + 0x400 + 0 + + + + 0 + + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + 0 + 0 + 0 + + + + + + + + + + 1 + 0 + 0 + 2 + 10000000 + +
+
+ + + Source Code + 1 + 0 + 0 + 0 + + 1 + 1 + 5 + 0 + 0 + 0 + .\bsp.h + bsp.h + 0 + 0 + + + 1 + 2 + 1 + 0 + 0 + 0 + .\bsp_l053r8.c + bsp_l053r8.c + 0 + 0 + + + 1 + 3 + 1 + 0 + 0 + 0 + .\test_sched.c + test_sched.c + 0 + 0 + + + + + nucleo-l053r8 + 1 + 0 + 0 + 0 + + 2 + 4 + 5 + 0 + 0 + 0 + ..\..\..\3rd_party\nucleo-l053r8\stm32l0xx.h + stm32l0xx.h + 0 + 0 + + + 2 + 5 + 5 + 0 + 0 + 0 + ..\..\..\3rd_party\nucleo-l053r8\stm32l053xx.h + stm32l053xx.h + 0 + 0 + + + 2 + 6 + 1 + 0 + 0 + 0 + ..\..\..\3rd_party\nucleo-l053r8\system_stm32l0xx.c + system_stm32l0xx.c + 0 + 0 + + + 2 + 7 + 5 + 0 + 0 + 0 + ..\..\..\3rd_party\nucleo-l053r8\system_stm32l0xx.h + system_stm32l0xx.h + 0 + 0 + + + 2 + 8 + 2 + 0 + 0 + 0 + ..\..\..\3rd_party\nucleo-l053r8\arm\startup_stm32l053xx.s + startup_stm32l053xx.s + 0 + 0 + + + 2 + 9 + 1 + 0 + 0 + 0 + ..\..\..\3rd_party\nucleo-l053r8\qutest\qutest_port.c + qutest_port.c + 0 + 0 + + + + + QP + 1 + 0 + 0 + 0 + + 3 + 10 + 1 + 0 + 0 + 0 + ..\..\..\src\qf\qep_hsm.c + qep_hsm.c + 0 + 0 + + + 3 + 11 + 1 + 0 + 0 + 0 + ..\..\..\src\qf\qep_msm.c + qep_msm.c + 0 + 0 + + + 3 + 12 + 1 + 0 + 0 + 0 + ..\..\..\src\qf\qf_act.c + qf_act.c + 0 + 0 + + + 3 + 13 + 1 + 0 + 0 + 0 + ..\..\..\src\qf\qf_actq.c + qf_actq.c + 0 + 0 + + + 3 + 14 + 1 + 0 + 0 + 0 + ..\..\..\src\qf\qf_defer.c + qf_defer.c + 0 + 0 + + + 3 + 15 + 1 + 0 + 0 + 0 + ..\..\..\src\qf\qf_dyn.c + qf_dyn.c + 0 + 0 + + + 3 + 16 + 1 + 0 + 0 + 0 + ..\..\..\src\qf\qf_mem.c + qf_mem.c + 0 + 0 + + + 3 + 17 + 1 + 0 + 0 + 0 + ..\..\..\src\qf\qf_ps.c + qf_ps.c + 0 + 0 + + + 3 + 18 + 1 + 0 + 0 + 0 + ..\..\..\src\qf\qf_qact.c + qf_qact.c + 0 + 0 + + + 3 + 19 + 1 + 0 + 0 + 0 + ..\..\..\src\qf\qf_qeq.c + qf_qeq.c + 0 + 0 + + + 3 + 20 + 1 + 0 + 0 + 0 + ..\..\..\src\qf\qf_qmact.c + qf_qmact.c + 0 + 0 + + + 3 + 21 + 1 + 0 + 0 + 0 + ..\..\..\src\qf\qf_time.c + qf_time.c + 0 + 0 + + + 3 + 22 + 1 + 0 + 0 + 0 + ..\..\..\src\qk\qk.c + qk.c + 0 + 0 + + + + + QP_port + 1 + 0 + 0 + 0 + + 4 + 23 + 5 + 0 + 0 + 0 + ..\..\..\ports\arm-cm\qk\armclang\qep_port.h + qep_port.h + 0 + 0 + + + 4 + 24 + 5 + 0 + 0 + 0 + ..\..\..\ports\arm-cm\qk\armclang\qf_port.h + qf_port.h + 0 + 0 + + + 4 + 25 + 1 + 0 + 0 + 0 + ..\..\..\ports\arm-cm\qk\armclang\qk_port.c + qk_port.c + 0 + 0 + + + 4 + 26 + 5 + 0 + 0 + 0 + ..\..\..\ports\arm-cm\qk\armclang\qk_port.h + qk_port.h + 0 + 0 + + + 4 + 27 + 5 + 0 + 0 + 0 + ..\..\..\ports\arm-cm\qk\armclang\qs_port.h + qs_port.h + 0 + 0 + + + + + QS + 1 + 0 + 0 + 0 + + 5 + 28 + 1 + 0 + 0 + 0 + ..\..\..\src\qs\qs.c + qs.c + 0 + 0 + + + 5 + 29 + 1 + 0 + 0 + 0 + ..\..\..\src\qs\qs_64bit.c + qs_64bit.c + 0 + 0 + + + 5 + 30 + 1 + 0 + 0 + 0 + ..\..\..\src\qs\qs_fp.c + qs_fp.c + 0 + 0 + + + 5 + 31 + 1 + 0 + 0 + 0 + ..\..\..\src\qs\qs_rx.c + qs_rx.c + 0 + 0 + + + 5 + 32 + 1 + 0 + 0 + 0 + ..\..\..\src\qs\qstamp.c + qstamp.c + 0 + 0 + + + 5 + 33 + 1 + 0 + 0 + 0 + ..\..\..\src\qs\qutest.c + qutest.c + 0 + 0 + + + +
diff --git a/test/qk/test_sched/uvision_l053r8.uvprojx b/test/qk/test_sched/uvision_l053r8.uvprojx new file mode 100644 index 00000000..e15835b5 --- /dev/null +++ b/test/qk/test_sched/uvision_l053r8.uvprojx @@ -0,0 +1,592 @@ + + + + 2.1 + +
### uVision Project, (C) Keil Software
+ + + + test_l053r8 + 0x4 + ARM-ADS + 6160000::V6.16::ARMCLANG + 1 + + + STM32L053R8Tx + STMicroelectronics + Keil.STM32L0xx_DFP.2.2.0 + http://www.keil.com/pack/ + IRAM(0x20000000,0x00002000) IROM(0x08000000,0x00010000) CPUTYPE("Cortex-M0+") CLOCK(12000000) ELITTLE + + + UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32L0xx_64 -FS08000000 -FL010000 -FP0($$Device:STM32L053R8Tx$Flash\STM32L0xx_64.FLM)) + 0 + $$Device:STM32L053R8Tx$Device\Include\stm32l0xx.h + + + + + + + + + + $$Device:STM32L053R8Tx$SVD\STM32L053x.svd + 0 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\spy\ + dpp-qk + 1 + 0 + 0 + 1 + 1 + .\spy\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 1 + 0 + cmd /c "del .\spy\qstamp.o" + + 0 + 0 + 0 + 0 + + + 1 + 0 + fromelf --bin --output .\spy\dpp-qk.bin .\spy\dpp-qk.axf + + 0 + 0 + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + + SARMCM3.DLL + -REMAP + DARMCM1.DLL + -pCM0+ + SARMCM3.DLL + + TARMCM1.DLL + -pCM0+ + + + + 1 + 0 + 0 + 0 + 16 + + + + + 1 + 0 + 0 + 1 + 1 + 4096 + + 1 + BIN\UL2CM3.DLL + + + + + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + "Cortex-M0+" + + 0 + 0 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 8 + 0 + 0 + 0 + 0 + 3 + 3 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x2000 + + + 1 + 0x8000000 + 0x10000 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x8000000 + 0x10000 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x2000 + + + 0 + 0x0 + 0x0 + + + + + + 0 + 1 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 3 + 0 + 1 + 0 + 0 + 0 + 3 + 3 + 0 + 0 + 0 + 0 + 0 + + + Q_SPY, Q_UTEST=0,QK_USE_IRQ_HANDLER=LCD_IRQHandler,QK_USE_IRQ_NUM=30,QF_ON_CONTEXT_SW + + .;..\..\..\include;..\..\..\ports\arm-cm\qk\armclang;..\..\..\3rd_party\CMSIS\Include,..\..\..\3rd_party\nucleo-l053r8 + + + + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 4 + + + Stack_Size=2048 Heap_Size=16 + + + + + + 1 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x20000000 + + dpp-qk.sct + + + --entry Reset_Handler + + + + + + + + Source Code + + + bsp.h + 5 + .\bsp.h + + + bsp_l053r8.c + 1 + .\bsp_l053r8.c + + + test_sched.c + 1 + .\test_sched.c + + + + + nucleo-l053r8 + + + stm32l0xx.h + 5 + ..\..\..\3rd_party\nucleo-l053r8\stm32l0xx.h + + + stm32l053xx.h + 5 + ..\..\..\3rd_party\nucleo-l053r8\stm32l053xx.h + + + system_stm32l0xx.c + 1 + ..\..\..\3rd_party\nucleo-l053r8\system_stm32l0xx.c + + + system_stm32l0xx.h + 5 + ..\..\..\3rd_party\nucleo-l053r8\system_stm32l0xx.h + + + startup_stm32l053xx.s + 2 + ..\..\..\3rd_party\nucleo-l053r8\arm\startup_stm32l053xx.s + + + qutest_port.c + 1 + ..\..\..\3rd_party\nucleo-l053r8\qutest\qutest_port.c + + + + + QP + + + qep_hsm.c + 1 + ..\..\..\src\qf\qep_hsm.c + + + qep_msm.c + 1 + ..\..\..\src\qf\qep_msm.c + + + qf_act.c + 1 + ..\..\..\src\qf\qf_act.c + + + qf_actq.c + 1 + ..\..\..\src\qf\qf_actq.c + + + qf_defer.c + 1 + ..\..\..\src\qf\qf_defer.c + + + qf_dyn.c + 1 + ..\..\..\src\qf\qf_dyn.c + + + qf_mem.c + 1 + ..\..\..\src\qf\qf_mem.c + + + qf_ps.c + 1 + ..\..\..\src\qf\qf_ps.c + + + qf_qact.c + 1 + ..\..\..\src\qf\qf_qact.c + + + qf_qeq.c + 1 + ..\..\..\src\qf\qf_qeq.c + + + qf_qmact.c + 1 + ..\..\..\src\qf\qf_qmact.c + + + qf_time.c + 1 + ..\..\..\src\qf\qf_time.c + + + qk.c + 1 + ..\..\..\src\qk\qk.c + + + + + QP_port + + + qep_port.h + 5 + ..\..\..\ports\arm-cm\qk\armclang\qep_port.h + + + qf_port.h + 5 + ..\..\..\ports\arm-cm\qk\armclang\qf_port.h + + + qk_port.c + 1 + ..\..\..\ports\arm-cm\qk\armclang\qk_port.c + + + qk_port.h + 5 + ..\..\..\ports\arm-cm\qk\armclang\qk_port.h + + + qs_port.h + 5 + ..\..\..\ports\arm-cm\qk\armclang\qs_port.h + + + + + QS + + + qs.c + 1 + ..\..\..\src\qs\qs.c + + + qs_64bit.c + 1 + ..\..\..\src\qs\qs_64bit.c + + + qs_fp.c + 1 + ..\..\..\src\qs\qs_fp.c + + + qs_rx.c + 1 + ..\..\..\src\qs\qs_rx.c + + + qstamp.c + 1 + ..\..\..\src\qs\qstamp.c + + + qutest.c + 1 + ..\..\..\src\qs\qutest.c + + + + + + + + + + + + + + + + + uvision_l053r8 + 1 + + + + +
diff --git a/test/qxk/test_sched/bsp.h b/test/qxk/test_sched/bsp.h index 66fe0421..a4caa37e 100644 --- a/test/qxk/test_sched/bsp.h +++ b/test/qxk/test_sched/bsp.h @@ -1,7 +1,7 @@ -/***************************************************************************** -* Product: BSP for system-testing QXK -* Last updated for version 7.1.2 -* Last updated on 2022-10-02 +/*============================================================================ +* Product: BSP for system-testing +* Last updated for version 7.2.0 +* Last updated on 2022-12-13 * * Q u a n t u m L e a P s * ------------------------ @@ -30,9 +30,9 @@ * Contact information: * * -*****************************************************************************/ -#ifndef BSP_H -#define BSP_H +============================================================================*/ +#ifndef BSP_H_ +#define BSP_H_ void BSP_init(void); void BSP_terminate(int16_t result); @@ -44,6 +44,12 @@ void BSP_ledOn(void); void BSP_ledOff(void); void BSP_trigISR(void); +uint32_t BSP_romRead(int32_t offset, uint32_t fromEnd); +void BSP_romWrite(int32_t offset, uint32_t fromEnd, uint32_t value); + +uint32_t BSP_ramRead(int32_t offset, uint32_t fromEnd); +void BSP_ramWrite(int32_t offset, uint32_t fromEnd, uint32_t value); + enum TestSignals { TEST0_SIG = Q_USER_SIG, TEST1_SIG, @@ -54,5 +60,5 @@ enum TestSignals { MAX_SIG /* the last signal */ }; -#endif /* BSP_H */ +#endif /* BSP_H_ */ diff --git a/test/qxk/test_sched/bsp_efm32.c b/test/qxk/test_sched/bsp_efm32.c index c3d98e1a..b3853019 100644 --- a/test/qxk/test_sched/bsp_efm32.c +++ b/test/qxk/test_sched/bsp_efm32.c @@ -1,7 +1,7 @@ -/***************************************************************************** -* Product: BSP for system-testing QK kernel, EFM32-SLSTK3401A board -* Last updated for version 7.1.2 -* Last updated on 2022-10-03 +/*============================================================================ +* Product: BSP for system-testing QXK kernel, EFM32-SLSTK3401A board +* Last updated for version 7.2.0 +* Last updated on 2022-12-13 * * Q u a n t u m L e a P s * ------------------------ @@ -30,7 +30,7 @@ * Contact information: * * -*****************************************************************************/ +============================================================================*/ #include "qpc.h" #include "bsp.h" @@ -62,7 +62,7 @@ void GPIO_EVEN_IRQHandler(void); static QSpyId const l_test_ISR = { 101U }; enum AppRecords { /* application-specific trace records */ - CONTEXT_SW = QS_USER, + CONTEXT_SW = QS_USER1, TRACE_MSG }; @@ -91,8 +91,126 @@ void GPIO_EVEN_IRQHandler(void) { /* for testing, NOTE03 */ QXK_ISR_EXIT(); /* inform QXK kernel about exiting an ISR */ } +/*..........................................................................*/ +/* MPU setup for EFM32PG1B200F256GM48 MCU */ +static void EFM32PG182_MPU_setup(void) { + /* The following MPU configuration contains the general EFM32PG1 memory + * map described in the EFM32PG1 Data Sheet Figure 3.2. EFM32PG1 Memory Map + * + * Please note that the actual STM32 MCUs provide much less Flash and SRAM + * than the maximums configured here. This means that actual MCUs have + * unmapped memory regions (e.g., beyond the actual SRAM). Attempts to + * access these regions causes the HardFault exception, which is the + * desired behavior. + */ + static struct { + uint32_t rbar; + uint32_t rasr; + } const mpu_setup[] = { + + { /* region #0: Flash: base=0x0000'0000, size=512M=2^(28+1) */ + 0x00000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 0U), /* region #0 */ + (28U << MPU_RASR_SIZE_Pos) /* 2^(18+1) region */ + | (0x6U << MPU_RASR_AP_Pos) /* PA:ro/UA:ro */ + | (1U << MPU_RASR_C_Pos) /* C=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #1: SRAM: base=0x2000'0000, size=512M=2^(28+1) */ + 0x20000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 1U), /* region #1 */ + (28U << MPU_RASR_SIZE_Pos) /* 2^(28+1) region */ + | (0x3U << MPU_RASR_AP_Pos) /* PA:rw/UA:rw */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | (1U << MPU_RASR_S_Pos) /* S=1 */ + | (1U << MPU_RASR_C_Pos) /* C=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + /* region #3: (not configured) */ + { MPU_RBAR_VALID_Msk | (MPU_RBAR_REGION_Msk & 2U), 0U }, + + { /* region #3: Peripherals: base=0x4000'0000, size=512M=2^(28+1) */ + 0x40000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 3U), /* region #3 */ + (28U << MPU_RASR_SIZE_Pos) /* 2^(28+1) region */ + | (0x3U << MPU_RASR_AP_Pos) /* PA:rw/UA:rw */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | (1U << MPU_RASR_S_Pos) /* S=1 */ + | (1U << MPU_RASR_B_Pos) /* B=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #4: Priv. Periph: base=0xE000'0000, size=512M=2^(28+1) */ + 0xE0000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 4U), /* region #4 */ + (28U << MPU_RASR_SIZE_Pos) /* 2^(28+1) region */ + | (0x3U << MPU_RASR_AP_Pos) /* PA:rw/UA:rw */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | (1U << MPU_RASR_S_Pos) /* S=1 */ + | (1U << MPU_RASR_B_Pos) /* B=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #5: Ext RAM: base=0x6000'0000, size=1G=2^(29+1) */ + 0x60000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 5U), /* region #5 */ + (29U << MPU_RASR_SIZE_Pos) /* 2^(28+1) region */ + | (0x3U << MPU_RASR_AP_Pos) /* PA:rw/UA:rw */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | (1U << MPU_RASR_S_Pos) /* S=1 */ + | (1U << MPU_RASR_B_Pos) /* B=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #6: Ext Dev: base=0xA000'0000, size=1G=2^(29+1) */ + 0xA0000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 6U), /* region #6 */ + (29U << MPU_RASR_SIZE_Pos) /* 2^(28+1) region */ + | (0x3U << MPU_RASR_AP_Pos) /* PA:rw/UA:rw */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | (1U << MPU_RASR_S_Pos) /* S=1 */ + | (1U << MPU_RASR_B_Pos) /* B=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #7: NULL-pointer: base=0x000'0000, size=256B, NOTE0 */ + 0x00000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 7U), /* region #7 */ + (7U << MPU_RASR_SIZE_Pos) /* 2^(7+1)=256B region */ + | (0x0U << MPU_RASR_AP_Pos) /* PA:na/UA:na */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + }; + + /* enable the MemManage_Handler for MPU exception */ + SCB->SHCSR |= SCB_SHCSR_MEMFAULTENA_Msk; + + __DSB(); + MPU->CTRL = 0U; /* disable the MPU */ + for (uint_fast8_t n = 0U; n < Q_DIM(mpu_setup); ++n) { + MPU->RBAR = mpu_setup[n].rbar; + MPU->RASR = mpu_setup[n].rasr; + } + MPU->CTRL = MPU_CTRL_ENABLE_Msk; /* enable the MPU */ + __ISB(); + __DSB(); +} + /*..........................................................................*/ void BSP_init(void) { + /* setup the MPU... */ + EFM32PG182_MPU_setup(); + /* NOTE: SystemInit() has been already called from the startup code * but SystemCoreClock needs to be updated */ @@ -127,7 +245,7 @@ void BSP_init(void) { } /*..........................................................................*/ void BSP_terminate(int16_t result) { - (void)result; + Q_UNUSED_PAR(result); } /*..........................................................................*/ void BSP_ledOn(void) { @@ -148,6 +266,35 @@ void BSP_trace(QActive const *thr, char const *msg) { QS_STR(msg); QS_END() } +/*..........................................................................*/ +uint32_t BSP_romRead(int32_t offset, uint32_t fromEnd) { + int32_t const rom_base = (fromEnd == 0U) + ? 0x100 /* don't include the NULL-ptr region */ + : 0x40000 - 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) + ? 0x100 /* don't include the NULL-ptr region */ + : 0x40000 - 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 + : 0x20008000 - 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 + : 0x20008000 - 4; + *(uint32_t volatile *)(ram_base + offset) = value; +} /*..........................................................................*/ void QF_onStartup(void) { @@ -157,14 +304,10 @@ void QF_onStartup(void) { /* assign all priority bits for preemption-prio. and none to sub-prio. */ NVIC_SetPriorityGrouping(0U); - /* set priorities of ALL ISRs used in the system, see NOTE1 - * - * !!!!!!!!!!!!!!!!!!!!!!!!!!!! CAUTION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - * Assign a priority to EVERY ISR explicitly by calling NVIC_SetPriority(). - * DO NOT LEAVE THE ISR PRIORITIES AT THE DEFAULT VALUE! - */ + /* set priorities of ALL ISRs used in the system */ NVIC_SetPriority(GPIO_EVEN_IRQn, QF_AWARE_ISR_CMSIS_PRI + 0U); NVIC_SetPriority(SysTick_IRQn, QF_AWARE_ISR_CMSIS_PRI + 1U); + /* NOTE: priority of UART IRQ used for QS-RX is set in qutest_port.c */ /* ... */ /* enable IRQs... */ @@ -174,17 +317,21 @@ void QF_onStartup(void) { void QF_onCleanup(void) { } /*..........................................................................*/ -#ifdef QXK_ON_CONTEXT_SW +#ifdef QF_ON_CONTEXT_SW /* NOTE: the context-switch callback is called with interrupts DISABLED */ -void QXK_onContextSw(QActive *prev, QActive *next) { +void QF_onContextSw(QActive *prev, QActive *next) { QS_BEGIN_NOCRIT(CONTEXT_SW, 0U) /* no critical section! */ QS_OBJ(prev); QS_OBJ(next); QS_END_NOCRIT() } -#endif /* QXK_ON_CONTEXT_SW */ +#endif /* QF_ON_CONTEXT_SW */ /*..........................................................................*/ void QXK_onIdle(void) { + + GPIO->P[LED_PORT].DOUT |= (1U << LED1_PIN); + GPIO->P[LED_PORT].DOUT &= ~(1U << LED1_PIN); + #ifdef Q_SPY QS_rxParse(); /* parse all the received bytes */ QS_doOutput(); @@ -213,3 +360,12 @@ void QTimeEvt_tick1_( #endif /* Q_SPY */ +/*============================================================================ +* NOTE0: +* The MPU protection against NULL-pointer dereferencing sets up a no-access +* MPU region #7 around the NULL address (0x0). This works even though the +* Vector Table also resides at address 0x0. However, the *size* of the +* no-access region should not exceed the size of the Vector Table. In this +* case, the size is set to 2**(7+1)==256 bytes, which does not contain any +* data that the CPU would legitimately read with the LDR instruction. +*/ diff --git a/test/qxk/test_sched/bsp_h743zi.c b/test/qxk/test_sched/bsp_h743zi.c new file mode 100644 index 00000000..a5cc5048 --- /dev/null +++ b/test/qxk/test_sched/bsp_h743zi.c @@ -0,0 +1,300 @@ +/*============================================================================ +* Product: BSP for system-testing of QXK kernel, NUCLEO-H743ZI board +* Last updated for version 7.2.0 +* Last updated on 2022-12-15 +* +* Q u a n t u m L e a P s +* ------------------------ +* Modern Embedded Software +* +* Copyright (C) 2005 Quantum Leaps, LLC. All rights reserved. +* +* This program is open source software: you can redistribute it and/or +* modify it under the terms of the GNU General Public License as published +* 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: +* +* +============================================================================*/ +#include "qpc.h" +#include "bsp.h" + +/* STM32CubeH7 include files */ +#include "stm32h7xx_hal.h" +#include "stm32h7xx_nucleo_144.h" +/* add other drivers if necessary... */ + +Q_DEFINE_THIS_FILE + +#ifdef Q_SPY + + /* QSpy source IDs */ + static QSpyId const l_SysTick_Handler = { 100U }; + static QSpyId const l_test_ISR = { 101U }; + + enum AppRecords { /* application-specific trace records */ + CONTEXT_SW = QS_USER1, + TRACE_MSG + }; + +#endif + +/* ISRs used in this project ===============================================*/ +void SysTick_Handler(void); /* prototype */ +void SysTick_Handler(void) { + QXK_ISR_ENTRY(); /* inform QXK kernel about entering an ISR */ + + /* process time events for rate 0 */ + QTIMEEVT_TICK_X(0U, &l_SysTick_Handler); + + QXK_ISR_EXIT(); /* inform QXK kernel about exiting an ISR */ +} +/*..........................................................................*/ +void EXTI0_IRQHandler(void); /* prototype */ +void EXTI0_IRQHandler(void) { /* for testing, NOTE03 */ + QXK_ISR_ENTRY(); /* inform QXK kernel about entering an ISR */ + + /* for testing... */ + static QEvt const t1 = { TEST1_SIG, 0U, 0U }; + QACTIVE_PUBLISH(&t1, &l_test_ISR); + + QXK_ISR_EXIT(); /* inform QXK kernel about exiting an ISR */ +} + +/* BSP functions ===========================================================*/ +/*..........................................................................*/ +/* MPU setup for STM32H743ZI MCU */ +static void STM32H743ZI_MPU_setup(void) { + /* The following MPU configuration contains just a generic ROM + * region (with read-only access) and NULL-pointer protection region. + * Otherwise, the MPU will fall back on the background region (PRIVDEFENA). + */ + static struct { + uint32_t rbar; + uint32_t rasr; + } const mpu_setup[] = { + + { /* region #0: Flash: base=0x0000'0000, size=512M=2^(28+1) */ + 0x00000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 0U), /* region #0 */ + (28U << MPU_RASR_SIZE_Pos) /* 2^(18+1) region */ + | (0x6U << MPU_RASR_AP_Pos) /* PA:ro/UA:ro */ + | (1U << MPU_RASR_C_Pos) /* C=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #7: NULL-pointer: base=0x000'0000, size=128M=2^(26+1) */ + /* NOTE: this region extends to 0x080'0000, which is where + * the ROM is re-mapped by STM32 + */ + 0x00000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 7U), /* region #7 */ + (26U << MPU_RASR_SIZE_Pos) /* 2^(26+1)=128M region */ + | (0x0U << MPU_RASR_AP_Pos) /* PA:na/UA:na */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + }; + + /* enable the MemManage_Handler for MPU exception */ + SCB->SHCSR |= SCB_SHCSR_MEMFAULTENA_Msk; + + __DSB(); + MPU->CTRL = 0U; /* disable the MPU */ + for (uint_fast8_t n = 0U; n < Q_DIM(mpu_setup); ++n) { + MPU->RBAR = mpu_setup[n].rbar; + MPU->RASR = mpu_setup[n].rasr; + } + MPU->CTRL = MPU_CTRL_ENABLE_Msk /* enable the MPU */ + | MPU_CTRL_PRIVDEFENA_Msk; /* enable background region */ + __ISB(); + __DSB(); +} + +/*..........................................................................*/ +void BSP_init(void) { + /* setup the MPU... */ + STM32H743ZI_MPU_setup(); + + /* NOTE: SystemInit() has been already called from the startup code + * but SystemCoreClock needs to be updated + */ + SystemCoreClockUpdate(); + + SCB_EnableICache(); /* Enable I-Cache */ + SCB_EnableDCache(); /* Enable D-Cache */ + + /* Configure Flash prefetch and Instr. cache through ART accelerator */ +#if (ART_ACCLERATOR_ENABLE != 0) + __HAL_FLASH_ART_ENABLE(); +#endif /* ART_ACCLERATOR_ENABLE */ + + /* Configure the LEDs */ + BSP_LED_Init(LED1); + BSP_LED_Init(LED2); + BSP_LED_Init(LED3); + + /* Configure the User Button in GPIO Mode */ + BSP_PB_Init(BUTTON_USER, BUTTON_MODE_GPIO); + + if (QS_INIT((void *)0) == 0) { /* 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) { + BSP_LED_On(LED1); +} +/*..........................................................................*/ +void BSP_ledOff(void) { + BSP_LED_Off(LED1); +} +/*..........................................................................*/ +void BSP_trigISR(void) { + NVIC_SetPendingIRQ(EXTI0_IRQn); +} +/*..........................................................................*/ +void BSP_trace(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 + : 0x08200000 - 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 + : 0x08200000 - 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 + : 0x20020000 - 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 + : 0x20020000 - 4; + *(uint32_t volatile *)(ram_base + offset) = value; +} + +/*..........................................................................*/ +void QF_onStartup(void) { + /* set up the SysTick timer to fire at BSP_TICKS_PER_SEC rate */ + //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, see NOTE1 + * + * !!!!!!!!!!!!!!!!!!!!!!!!!!!! CAUTION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * Assign a priority to EVERY ISR explicitly by calling NVIC_SetPriority(). + * DO NOT LEAVE THE ISR PRIORITIES AT THE DEFAULT VALUE! + */ + NVIC_SetPriority(SysTick_IRQn, QF_AWARE_ISR_CMSIS_PRI + 0U); + NVIC_SetPriority(EXTI0_IRQn, QF_AWARE_ISR_CMSIS_PRI + 1U); + /* ... */ + + /* enable IRQs... */ + NVIC_EnableIRQ(EXTI0_IRQn); +} +/*..........................................................................*/ +void QF_onCleanup(void) { +} +/*..........................................................................*/ +#ifdef QF_ON_CONTEXT_SW +/* NOTE: the context-switch callback is called with interrupts DISABLED */ +void QF_onContextSw(QActive *prev, QActive *next) { + QS_BEGIN_NOCRIT(CONTEXT_SW, 0U) /* no critical section! */ + QS_OBJ(prev); + QS_OBJ(next); + QS_END_NOCRIT() +} +#endif /* QF_ON_CONTEXT_SW */ + +/*..........................................................................*/ +void QXK_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 ============================================================*/ +#ifdef Q_SPY + +/*..........................................................................*/ +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(); +} + +#endif /* Q_SPY */ + +/*============================================================================ +* 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/qxk/test_sched/bsp_l053r8.c b/test/qxk/test_sched/bsp_l053r8.c index d34e91eb..7d79db6f 100644 --- a/test/qxk/test_sched/bsp_l053r8.c +++ b/test/qxk/test_sched/bsp_l053r8.c @@ -1,7 +1,7 @@ -/***************************************************************************** -* Product: BSP for system-testing QK kernel, NUCLEO-L053R8 board -* Last updated for version 7.1.2 -* Last updated on 2022-10-03 +/*============================================================================ +* Product: BSP for system-testing QXK kernel, NUCLEO-L053R8 board +* Last updated for version 7.2.0 +* Last updated on 2022-12-13 * * Q u a n t u m L e a P s * ------------------------ @@ -30,7 +30,7 @@ * Contact information: * * -*****************************************************************************/ +============================================================================*/ #include "qpc.h" #include "bsp.h" @@ -52,7 +52,7 @@ Q_DEFINE_THIS_FILE static QSpyId const l_test_ISR = { 101U }; enum AppRecords { /* application-specific trace records */ - CONTEXT_SW = QS_USER, + CONTEXT_SW = QS_USER1, TRACE_MSG }; @@ -81,8 +81,128 @@ void EXTI0_1_IRQHandler(void) { /* for testing, NOTE03 */ QXK_ISR_EXIT(); /* inform QXK kernel about exiting an ISR */ } +/*..........................................................................*/ +/* MPU setup for STM32L053R8 MCU */ +static void STM32L053R8_MPU_setup(void) { + /* The following MPU configuration contains the general STM32 memory model + * as described in the ST AppNote AN4838 "Managing memory protection unit + * in STM32 MCUs", Figure 2. Cortex-M0+/M3/M4/M7 processor memory map. + * + * Please note that the actual STM32 MCUs provide much less Flash and SRAM + * than the maximums configured here. This means that actual MCUs have + * unmapped memory regions (e.g., beyond the actual SRAM). Attempts to + * access these regions causes the HardFault exception, which is the + * desired behavior. + */ + static struct { + uint32_t rbar; + uint32_t rasr; + } const mpu_setup[] = { + + { /* region #0: Flash: base=0x0000'0000, size=512M=2^(28+1) */ + 0x00000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 0U), /* region #0 */ + (28U << MPU_RASR_SIZE_Pos) /* 2^(18+1) region */ + | (0x6U << MPU_RASR_AP_Pos) /* PA:ro/UA:ro */ + | (1U << MPU_RASR_C_Pos) /* C=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #1: SRAM: base=0x2000'0000, size=512M=2^(28+1) */ + 0x20000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 1U), /* region #1 */ + (28U << MPU_RASR_SIZE_Pos) /* 2^(28+1) region */ + | (0x3U << MPU_RASR_AP_Pos) /* PA:rw/UA:rw */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | (1U << MPU_RASR_S_Pos) /* S=1 */ + | (1U << MPU_RASR_C_Pos) /* C=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + /* region #3: (not configured) */ + { MPU_RBAR_VALID_Msk | (MPU_RBAR_REGION_Msk & 2U), 0U }, + + { /* region #3: Peripherals: base=0x4000'0000, size=512M=2^(28+1) */ + 0x40000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 3U), /* region #3 */ + (28U << MPU_RASR_SIZE_Pos) /* 2^(28+1) region */ + | (0x3U << MPU_RASR_AP_Pos) /* PA:rw/UA:rw */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | (1U << MPU_RASR_S_Pos) /* S=1 */ + | (1U << MPU_RASR_B_Pos) /* B=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #4: Priv. Periph: base=0xE000'0000, size=512M=2^(28+1) */ + 0xE0000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 4U), /* region #4 */ + (28U << MPU_RASR_SIZE_Pos) /* 2^(28+1) region */ + | (0x3U << MPU_RASR_AP_Pos) /* PA:rw/UA:rw */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | (1U << MPU_RASR_S_Pos) /* S=1 */ + | (1U << MPU_RASR_B_Pos) /* B=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #5: Ext RAM: base=0x6000'0000, size=1G=2^(29+1) */ + 0x60000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 5U), /* region #5 */ + (29U << MPU_RASR_SIZE_Pos) /* 2^(28+1) region */ + | (0x3U << MPU_RASR_AP_Pos) /* PA:rw/UA:rw */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | (1U << MPU_RASR_S_Pos) /* S=1 */ + | (1U << MPU_RASR_B_Pos) /* B=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #6: Ext Dev: base=0xA000'0000, size=1G=2^(29+1) */ + 0xA0000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 6U), /* region #6 */ + (29U << MPU_RASR_SIZE_Pos) /* 2^(28+1) region */ + | (0x3U << MPU_RASR_AP_Pos) /* PA:rw/UA:rw */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | (1U << MPU_RASR_S_Pos) /* S=1 */ + | (1U << MPU_RASR_B_Pos) /* B=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + { /* region #7: NULL-pointer: base=0x000'0000, size=128M=2^(26+1) */ + /* NOTE: this region extends to 0x080'0000, which is where + * the ROM is re-mapped by STM32 + */ + 0x00000000U /* base address */ + | MPU_RBAR_VALID_Msk /* valid region */ + | (MPU_RBAR_REGION_Msk & 7U), /* region #7 */ + (26U << MPU_RASR_SIZE_Pos) /* 2^(26+1)=128M region */ + | (0x0U << MPU_RASR_AP_Pos) /* PA:na/UA:na */ + | (1U << MPU_RASR_XN_Pos) /* XN=1 */ + | MPU_RASR_ENABLE_Msk /* region enable */ + }, + + }; + + __DSB(); + MPU->CTRL = 0U; /* disable the MPU */ + for (uint_fast8_t n = 0U; n < Q_DIM(mpu_setup); ++n) { + MPU->RBAR = mpu_setup[n].rbar; + MPU->RASR = mpu_setup[n].rasr; + } + MPU->CTRL = MPU_CTRL_PRIVDEFENA_Msk /* enable background region */ + | MPU_CTRL_ENABLE_Msk; /* enable the MPU */ + __ISB(); + __DSB(); +} /*..........................................................................*/ void BSP_init(void) { + /* setup the MPU... */ + STM32L053R8_MPU_setup(); + /* NOTE: SystemInit() has been already called from the startup code * but SystemCoreClock needs to be updated */ @@ -108,6 +228,7 @@ void BSP_init(void) { GPIOC->OSPEEDR |= (1U << 2*13); GPIOC->PUPDR &= ~(3U << 2*13); + /* initialize the QS software tracing... */ if (QS_INIT((void *)0) == 0) { /* initialize the QS software tracing */ Q_ERROR(); } @@ -140,23 +261,48 @@ void BSP_trace(QActive const *thr, char const *msg) { QS_STR(msg); QS_END() } +/*..........................................................................*/ +uint32_t BSP_romRead(int32_t offset, uint32_t fromEnd) { + int32_t const rom_base = (fromEnd == 0U) + ? 0x08000000 + : 0x08010000 - 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 + : 0x08010000 - 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 + : 0x20002000 - 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 + : 0x20002000 - 4; + *(uint32_t volatile *)(ram_base + offset) = value; +} /*..........................................................................*/ void QF_onStartup(void) { - /* set up the SysTick timer to fire at BSP_TICKS_PER_SEC rate */ + /* DON'T set up the SysTick timer to fire at BSP_TICKS_PER_SEC rate */ //SysTick_Config(SystemCoreClock / BSP_TICKS_PER_SEC); /* assign all priority bits for preemption-prio. and none to sub-prio. */ NVIC_SetPriorityGrouping(0U); - /* set priorities of ALL ISRs used in the system, see NOTE1 - * - * !!!!!!!!!!!!!!!!!!!!!!!!!!!! CAUTION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - * Assign a priority to EVERY ISR explicitly by calling NVIC_SetPriority(). - * DO NOT LEAVE THE ISR PRIORITIES AT THE DEFAULT VALUE! - */ + /* set priorities of ALL ISRs used in the system */ NVIC_SetPriority(SysTick_IRQn, QF_AWARE_ISR_CMSIS_PRI + 0U); NVIC_SetPriority(EXTI0_1_IRQn, QF_AWARE_ISR_CMSIS_PRI + 1U); + /* NOTE: priority of UART IRQ used for QS-RX is set in qutest_port.c */ /* ... */ /* enable IRQs... */ @@ -166,15 +312,15 @@ void QF_onStartup(void) { void QF_onCleanup(void) { } /*..........................................................................*/ -#ifdef QXK_ON_CONTEXT_SW +#ifdef QF_ON_CONTEXT_SW /* NOTE: the context-switch callback is called with interrupts DISABLED */ -void QXK_onContextSw(QActive *prev, QActive *next) { +void QF_onContextSw(QActive *prev, QActive *next) { QS_BEGIN_NOCRIT(CONTEXT_SW, 0U) /* no critical section! */ QS_OBJ(prev); QS_OBJ(next); QS_END_NOCRIT() } -#endif /* QXK_ON_CONTEXT_SW */ +#endif /* QF_ON_CONTEXT_SW */ /*..........................................................................*/ void QXK_onIdle(void) { #ifdef Q_SPY @@ -205,3 +351,15 @@ void QTimeEvt_tick1_( #endif /* Q_SPY */ +/*============================================================================ +* 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/qxk/test_sched/make_efm32 b/test/qxk/test_sched/make_efm32 index cbbd82fc..659e93e6 100644 --- a/test/qxk/test_sched/make_efm32 +++ b/test/qxk/test_sched/make_efm32 @@ -1,7 +1,7 @@ ############################################################################## # Product: Makefile for SYSTEM-Level tests of QP/C on EMF32, GNU-ARM -# Last Updated for Version: 7.1.2 -# Date of the Last Update: 2022-10-05 +# Last Updated for Version: 7.2.0 +# Date of the Last Update: 2022-12-21 # # Q u a n t u m L e a P s # ------------------------ @@ -145,7 +145,7 @@ LIBS := # defines DEFINES := -DEFM32PG1B200F256GM48=1 \ - -DQXK_ON_CONTEXT_SW + -DQF_ON_CONTEXT_SW # ARM CPU, ARCH, FPU, and Float-ABI types... # ARM_CPU: [cortex-m0 | cortex-m0plus | cortex-m1 | cortex-m3 | cortex-m4] @@ -197,8 +197,6 @@ ifeq ("$(wildcard $(QUTEST))","") QUTEST := python3 $(QTOOLS)/qutest/qutest.py endif -TESTS := *.py - #----------------------------------------------------------------------------- # build options # @@ -271,7 +269,7 @@ flash : $(FLASH) $(TARGET_BIN) run : $(TARGET_BIN) - $(QUTEST) $(TESTS) $(TARGET_EXE) $(HOST) + $(QUTEST) -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ diff --git a/test/qxk/test_sched/make_nucleo-h743zi b/test/qxk/test_sched/make_nucleo-h743zi new file mode 100644 index 00000000..a1aa1680 --- /dev/null +++ b/test/qxk/test_sched/make_nucleo-h743zi @@ -0,0 +1,349 @@ +############################################################################## +# Product: Makefile for QP/C on NUCLEO-H743ZI board, QUTEST, GNU-ARM +# Last Updated for Version: 7.2.0 +# Date of the Last Update: 2022-12-21 +# +# Q u a n t u m L e a P s +# ------------------------ +# Modern Embedded Software +# +# Copyright (C) 2005 Quantum Leaps, LLC. All rights reserved. +# +# This program is open source software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License as published +# 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 make_nucleo-h743zi USB=g: # make, uplaod to USB drive, run the tests +# make -f make_nucleo-h743zi USB=g: TESTS=philo*.py # make and run the selected tests +# make -f make_nucleo-h743zi HOST=localhost:7705 # connect to host:port +# make -f make_nucleo-h743zi norun # only make but not run the tests +# make -f make_nucleo-h743zi clean # cleanup the build +# +# 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 ($(QPC),) +QPC := ../../.. +endif + +#----------------------------------------------------------------------------- +# project name, target name, target directory: +# +PROJECT := test_sched +TARGET := nucleo-h743zi +TARGET_DIR := $(QPC)/3rd_party/STM32CubeH7/qutest + +#----------------------------------------------------------------------------- +# project directories: +# + +# QP port used in this project +QP_PORT_DIR := $(QPC)/ports/arm-cm/qxk/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 := . \ + $(QPC)/src/qf \ + $(QPC)/src/qxk \ + $(QPC)/src/qs \ + $(QP_PORT_DIR) \ + $(TARGET_DIR) \ + $(QPC)/3rd_party/STM32CubeH7/nucleo-h743zi/gnu \ + $(QPC)/3rd_party/STM32CubeH7/Drivers/BSP\STM32H7xx_Nucleo_144 \ + $(QPC)/3rd_party/STM32CubeH7/Drivers/STM32H7xx_HAL_Driver/Src \ + $(QPC)/3rd_party/STM32CubeH7/Drivers/CMSIS/Device/ST/STM32H7xx/Source/Templates + +# list of all include directories needed by this project +INCLUDES = -I. \ + -I$(QPC)/include \ + -I$(QP_PORT_DIR) \ + -I$(TARGET_DIR) \ + -I$(QPC)/3rd_party/CMSIS/Include \ + -I$(QPC)/3rd_party/STM32CubeH7/Drivers/CMSIS/Device/ST/STM32H7xx/Include \ + -I$(QPC)/3rd_party/STM32CubeH7/Drivers/BSP/STM32H7xx_Nucleo_144 \ + -I$(QPC)/3rd_party/STM32CubeH7/Drivers/STM32H7xx_HAL_Driver/Inc + +#----------------------------------------------------------------------------- +# project files: +# + +# assembler source files +ASM_SRCS := + +# C source files +C_SRCS := \ + test_sched.c \ + bsp_h743zi.c \ + startup_stm32h743xx.c \ + system_stm32h7xx.c \ + stm32h7xx_nucleo_144.c \ + stm32h7xx_hal.c \ + stm32h7xx_hal_cortex.c \ + stm32h7xx_hal_gpio.c \ + stm32h7xx_hal_pwr_ex.c \ + stm32h7xx_hal_rcc.c \ + stm32h7xx_hal_rcc_ex.c \ + stm32h7xx_hal_msp.c \ + stm32h7xx_hal_uart.c + +# C++ source files +CPP_SRCS := + +OUTPUT := $(PROJECT) +LD_SCRIPT := $(TARGET_DIR)/qutest.ld + +QP_SRCS := \ + qep_hsm.c \ + qep_msm.c \ + qf_act.c \ + qf_actq.c \ + qf_defer.c \ + qf_dyn.c \ + qf_mem.c \ + qf_ps.c \ + qf_qact.c \ + qf_qeq.c \ + qf_qmact.c \ + qf_time.c \ + qxk.c \ + qxk_xthr.c \ + qxk_sema.c \ + qxk_mutex.c \ + qxk_port.c \ + qs.c \ + qs_64bit.c \ + qs_rx.c \ + qs_fp.c \ + qutest.c \ + qutest_port.c + +QP_ASMS := + +LIB_DIRS := +LIBS := + +# defines +DEFINES := -DQP_API_VERSION=9999 \ + -DSTM32H743xx -DUSE_HAL_DRIVER -DUSE_STM32H7XX_NUCLEO_144 \ + -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-m7 +ARM_FPU := -mfpu=fpv5-d16 +FLOAT_ABI := -mfloat-abi=softfp + +#----------------------------------------------------------------------------- +# 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-gcc +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 soruces... +C_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) + $(CC) $(CFLAGS) $(QPC)/include/qstamp.c -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) $(TESTS) DEBUG $(HOST) + +.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/qxk/test_sched/make_nucleo-l053r8 b/test/qxk/test_sched/make_nucleo-l053r8 index dde5a867..237293a0 100644 --- a/test/qxk/test_sched/make_nucleo-l053r8 +++ b/test/qxk/test_sched/make_nucleo-l053r8 @@ -1,7 +1,7 @@ ############################################################################## # Product: Makefile for SYSTEM-Level tests of QP/C on NUCLEO-L053R8, GNU-ARM -# Last Updated for Version: 7.1.2 -# Date of the Last Update: 2022-10-05 +# Last Updated for Version: 7.2.0 +# Date of the Last Update: 2022-12-21 # # Q u a n t u m L e a P s # ------------------------ @@ -141,7 +141,7 @@ LIBS := # defines DEFINES := \ - -DQXK_ON_CONTEXT_SW + -DQF_ON_CONTEXT_SW # ARM CPU, ARCH, FPU, and Float-ABI types... # ARM_CPU: [cortex-m0 | cortex-m0plus | cortex-m1 | cortex-m3 | cortex-m4] @@ -172,11 +172,11 @@ LINK := $(GNU_ARM)/bin/arm-none-eabi-gcc BIN := $(GNU_ARM)/bin/arm-none-eabi-objcopy #----------------------------------------------------------------------------- -# NOTE: The following symbol USB assumes that the NUCLEO board +# NOTE: The symbol USB must be provided for the NUCLEO board # has enumerated as USB drive f: # ifeq ($(USB),) -USB := f: +$(error USB drive not provided for the NUCLEO board.) endif ############################################################################## @@ -197,8 +197,6 @@ ifeq ("$(wildcard $(QUTEST))","") QUTEST := python3 $(QTOOLS)/qutest/qutest.py endif -TESTS := *.py - #----------------------------------------------------------------------------- # build options # @@ -272,7 +270,7 @@ flash : $(CP) $(TARGET_BIN) $(USB) run : $(TARGET_BIN) - $(QUTEST) $(TESTS) $(TARGET_EXE) $(HOST) + $(QUTEST) -q$(QSPY) -l$(LOG) -o$(OPT) -- $(TESTS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ diff --git a/test/qxk/test_sched/test_mpu.py b/test/qxk/test_sched/test_mpu.py new file mode 100644 index 00000000..2ea7e64b --- /dev/null +++ b/test/qxk/test_sched/test_mpu.py @@ -0,0 +1,99 @@ +# test-script for QUTest unit testing harness +# see https://www.state-machine.com/qtools/qutest.html/qutest.html + +note(''' +@uid{TQP701} +This test group verifies the memory access protection, +specifically the protection of various memory regions. +All tests run during the QS_TEST_PAUSE() in +the test_sched.c fixture. +''') + +# preamble +def on_reset(): + expect_pause() + # don't call continue_test() + +def on_setup(): + glb_filter(GRP_SC, GRP_UA) + +MEM_START = 0 +MEM_END = 1 + +# NULL-pointer dereferencing... +test(''' +NULL-read -> ASSERT +''') +command("MEM_READ", 0x0, 0x80) # value = *(uint32_t volatile *)(param1 + param2); +expect("@timestamp =ASSERT= Mod=*") + +test("NULL-write -> ASSERT") +command("MEM_WRITE", 0x0, 0xA0, 123) # *(uint32_t volatile *)(param1 + param2) = param3; +expect("@timestamp =ASSERT= Mod=*") + +# ROM_READ... +test("Below-Start Flash-read -> ASSERT") +command("ROM_READ", (-4 & 0xFFFFFFFF), MEM_START) # value = BSP_romRead(param1, param2); +expect("@timestamp =ASSERT= Mod=*") + +test("Start-of Flash-read") +command("ROM_READ", 0x0, MEM_START) # value = BSP_romRead(param1, param2); +expect("@timestamp USER+000 ROM_READ *") +expect("@timestamp Trg-Done QS_RX_COMMAND") + +test("Middle-of Flash-read", NORESET) +command("ROM_READ", 0x400, MEM_START) # value = BSP_romRead(param1, param2); +expect("@timestamp USER+000 ROM_READ *") +expect("@timestamp Trg-Done QS_RX_COMMAND") + +test("End-of Flash-read", NORESET) +command("ROM_READ", 0x0, MEM_END) # value = BSP_romRead(param1, param2); +expect("@timestamp USER+000 ROM_READ *") +expect("@timestamp Trg-Done QS_RX_COMMAND") + +skip(1) +test("After-End Flash-read-> ASSERT", NORESET) +command("ROM_READ", 0x4, MEM_END) # value = BSP_romRead(param1, param2); +expect("@timestamp =ASSERT= Mod=*") + +# ROM_WRITE... +test("Middle-of Flash-write -> ASSERT") +command("ROM_WRITE", 0x400, MEM_START, 123) # BSP_romWrite(param1, param2, param3); +expect("@timestamp =ASSERT= Mod=*") + +# RAM_READ... +test("Below-Start SRAM-read -> ASSERT") +command("RAM_READ", (-0x4 & 0xFFFFFFFF), MEM_START) # value = BSP_ramRead(param1, param2); +expect("@timestamp =ASSERT= Mod=*") + +test("Start-of SRAM-read") +command("RAM_READ", 0x0, MEM_START) # value = BSP_ramRead(param1, param2); +expect("@timestamp USER+000 RAM_READ *") +expect("@timestamp Trg-Done QS_RX_COMMAND") + +test("Middle-of SRAM-read", NORESET) +command("RAM_READ", 0x300, MEM_START) # value = BSP_ramRead(param1, param2); +expect("@timestamp USER+000 RAM_READ *") +expect("@timestamp Trg-Done QS_RX_COMMAND") + +test("End-of SRAM-read", NORESET) +command("RAM_READ", 0x0, MEM_END) # value = BSP_ramRead(param1, param2); +expect("@timestamp USER+000 RAM_READ *") +expect("@timestamp Trg-Done QS_RX_COMMAND") + +# RAM_WRITE... +test("Below-Start SRAM-write -> ASSERT", NORESET) +command("RAM_WRITE", (-0x4 & 0xFFFFFFFF), MEM_START, 123) # BSP_ramWrite(param1, param2, param3); +expect("@timestamp =ASSERT= Mod=*") + +# wrtiting to RAM does not need to be tested becasue the fact +# that the test fixture runs at all means that RAM works. +skip(1) +test("Middle-of SRAM-write") +command("RAM_WRITE", 0x300, MEM_START, 123) # BSP_ramWrite(param1, param2, param3); +expect("@timestamp USER+000 RAM_WRITE *") +expect("@timestamp Trg-Done QS_RX_COMMAND") + +test("After-End SRAM-write -> ASSERT") +command("RAM_WRITE", 0x4, MEM_END, 123) # BSP_ramWrite(param1, param2, param3); +expect("@timestamp =ASSERT= Mod=*") diff --git a/test/qxk/test_sched/test_sched.c b/test/qxk/test_sched/test_sched.c index 8820122a..2edc0343 100644 --- a/test/qxk/test_sched/test_sched.c +++ b/test/qxk/test_sched/test_sched.c @@ -1,7 +1,7 @@ /*============================================================================ * Product: System test fixture for QXK kernel -* Last updated for version 7.1.2 -* Last updated on 2022-10-03 +* Last updated for version 7.2.0 +* Last updated on 2022-12-22 * * Q u a n t u m L e a P s * ------------------------ @@ -94,6 +94,13 @@ ObjB aoB[NUM_B]; /*==========================================================================*/ enum { NUM_X = 3 }; +enum UserCommands { + MEM_READ, MEM_WRITE, + ROM_READ, ROM_WRITE, + RAM_READ, RAM_WRITE, +}; + +/*..........................................................................*/ void ThrX_run(QXThread * const me) { QActive_subscribe(&me->super, TEST1_SIG); QActive_subscribe(&me->super, TEST2_SIG); @@ -135,20 +142,26 @@ int main() { /* initialize publish-subscribe... */ static QSubscrList subscrSto[MAX_PUB_SIG]; - QF_psInit(subscrSto, Q_DIM(subscrSto)); + QActive_psInit(subscrSto, Q_DIM(subscrSto)); /* initialize event pools... */ static QF_MPOOL_EL(QEvt) smlPoolSto[10]; /* small pool */ QF_poolInit(smlPoolSto, sizeof(smlPoolSto), sizeof(smlPoolSto[0])); /* dictionaries */ - QS_FUN_DICTIONARY(&QHsm_top); QS_SIG_DICTIONARY(QXK_DELAY_SIG, (void *)0); QS_SIG_DICTIONARY(QXK_TIMEOUT_SIG, (void *)0); - QS_SIG_DICTIONARY(TEST0_SIG, (void *)0); - QS_SIG_DICTIONARY(TEST1_SIG, (void *)0); - QS_SIG_DICTIONARY(TEST2_SIG, (void *)0); - QS_SIG_DICTIONARY(TEST3_SIG, (void *)0); + QS_SIG_DICTIONARY(TEST0_SIG, (void *)0); + QS_SIG_DICTIONARY(TEST1_SIG, (void *)0); + QS_SIG_DICTIONARY(TEST2_SIG, (void *)0); + QS_SIG_DICTIONARY(TEST3_SIG, (void *)0); + + QS_ENUM_DICTIONARY(MEM_READ, QS_CMD); + QS_ENUM_DICTIONARY(MEM_WRITE, QS_CMD); + QS_ENUM_DICTIONARY(ROM_READ, QS_CMD); + QS_ENUM_DICTIONARY(ROM_WRITE, QS_CMD); + QS_ENUM_DICTIONARY(RAM_READ, QS_CMD); + QS_ENUM_DICTIONARY(RAM_WRITE, QS_CMD); /* priority specifications for ObjBs... */ static QPrioSpec pspecB[NUM_B]; @@ -217,10 +230,67 @@ void QS_onTestTeardown(void) { void QS_onCommand(uint8_t cmdId, uint32_t param1, uint32_t param2, uint32_t param3) { - Q_UNUSED_PAR(cmdId); - Q_UNUSED_PAR(param1); - Q_UNUSED_PAR(param2); - Q_UNUSED_PAR(param3); + uint32_t volatile value; + + switch (cmdId) { + case MEM_READ: { // read MEM (can trip the MPU) + value = *(uint32_t volatile *)(param1 + param2); + QS_BEGIN_ID(QS_USER, 0U) + QS_ENUM(QS_CMD, cmdId); + QS_U32(0, value); + QS_END() + break; + } + case MEM_WRITE: { // write MEM (can trip the MPU) + *(uint32_t volatile *)(param1 + param2) = param3; + QS_BEGIN_ID(QS_USER, 0U) + QS_ENUM(QS_CMD, cmdId); + QS_U32(QS_HEX_FMT , param1); + QS_U32(QS_HEX_FMT , param2); + QS_U32(0 , param3); + QS_END() + break; + } + case ROM_READ: { // read ROM (can trip the MPU) + value = BSP_romRead((int32_t)param1, param2); + QS_BEGIN_ID(QS_USER, 0U) + QS_ENUM(QS_CMD, cmdId); + QS_U32(0, value); + QS_END() + break; + } + case ROM_WRITE: { // write ROM (can trip the MPU) + BSP_romWrite(param1, param2, param3); + QS_BEGIN_ID(QS_USER, 0U) + QS_ENUM(QS_CMD, cmdId); + QS_U32(QS_HEX_FMT , param1); + QS_U32(QS_HEX_FMT , param2); + QS_U32(0 , param3); + QS_END() + break; + } + case RAM_READ: { // read RAM (can trip the MPU) + value = BSP_ramRead(param1, param2); + QS_BEGIN_ID(QS_USER, 0U) + QS_ENUM(QS_CMD, cmdId); + QS_U32(0, value); + QS_END() + break; + } + case RAM_WRITE: { // write RAM (can trip the MPU) + BSP_ramWrite(param1, param2, param3); + QS_BEGIN_ID(QS_USER, 0U) + QS_ENUM(QS_CMD, cmdId); + QS_U32(QS_HEX_FMT , param1); + QS_U32(QS_HEX_FMT , param2); + QS_U32(0, param3); + QS_END() + break; + } + default: { + break; + } + } } /****************************************************************************/ diff --git a/test/qxk/test_sched/test_sched.py b/test/qxk/test_sched/test_sched.py index 9bc8333d..47385028 100644 --- a/test/qxk/test_sched/test_sched.py +++ b/test/qxk/test_sched/test_sched.py @@ -1,21 +1,31 @@ # test-script for QUTest unit testing harness # see https://www.state-machine.com/qtools/qutest.html/qutest.html +note(''' +This test group verifies the preemption scenarios +in the QXK preemptive kernel +''') + # preamble def on_reset(): expect_pause() + # don't call continue_test() yet + # this will be done by the individual tests + # after they poke the priorities of threads -test("extened->basic") +scenario("extened->basic") +# given... current_obj(OBJ_AP, "pspecB") poke(0, 2, pack("1") expect("@timestamp CONTEXT_SW NULL thrX[0]") expect("@timestamp TRACE_MSG thrX[0] TEST0 1of2") @@ -39,17 +49,20 @@ expect("@timestamp Sch-Idle Pri=1->0") expect("@timestamp CONTEXT_SW thrX[0] NULL") expect("@timestamp Trg-Done QS_RX_EVENT") -test("extended->extened->basic") + +scenario("extended->extened->basic") +# given... current_obj(OBJ_AP, "pspecB") poke(0, 2, pack("4") expect("@timestamp CONTEXT_SW NULL thrX[0]") expect("@timestamp TRACE_MSG thrX[0] TEST0 1of2") @@ -94,17 +107,19 @@ expect("@timestamp CONTEXT_SW aoB[0] NULL") expect("@timestamp Trg-Done QS_RX_EVENT") -test("extened->basic->extended") +scenario("extened->basic->extended") +# given... current_obj(OBJ_AP, "pspecB") poke(0, 2, pack("1") expect("@timestamp CONTEXT_SW NULL thrX[0]") expect("@timestamp TRACE_MSG thrX[0] TEST0 1of2") diff --git a/test/qxk/test_sched/uvision_efm32.uvprojx b/test/qxk/test_sched/uvision_efm32.uvprojx index 8c1c944b..a0282480 100644 --- a/test/qxk/test_sched/uvision_efm32.uvprojx +++ b/test/qxk/test_sched/uvision_efm32.uvprojx @@ -337,7 +337,7 @@ 0 - Q_SPY, Q_UTEST=0, QXK_ON_CONTEXT_SW + Q_SPY, Q_UTEST=0, QF_ON_CONTEXT_SW .;..\..\..\include;..\..\..\ports\arm-cm\qxk\armclang;..\..\..\..\3rd_party\CMSIS\Include;..\..\..\..\3rd_party\efm32pg1b diff --git a/zephyr/qf_port.h b/zephyr/qf_port.h index 43427d49..6f584bfe 100644 --- a/zephyr/qf_port.h +++ b/zephyr/qf_port.h @@ -23,11 +23,11 @@ * ============================================================================*/ /*! -* @date Last updated on: 2022-08-24 -* @version Last updated for: Zephyr 3.1.99 and @ref qpc_7_1_0 +* @date Last updated on: 2023-01-04 +* @version Last updated for: Zephyr 3.2.0 and @ref qpc_7_2_0 * * @file -* @brief QF/C port to Zephyr RTOS (v 3.1.99) +* @brief QF/C port to Zephyr RTOS */ #ifndef QF_PORT_H #define QF_PORT_H @@ -47,11 +47,11 @@ #define QF_CRIT_ENTRY(key_) ((key_) = k_spin_lock(&QF_spinlock)) #define QF_CRIT_EXIT(key_) (k_spin_unlock(&QF_spinlock, (key_))) -#include /* Zephyr API */ -#include "qep_port.h" /* QEP port */ -#include "qequeue.h" /* native QP event-queue for event deferral */ -#include "qmpool.h" /* Zephyr port uses native QP memory-pool */ -#include "qf.h" /* QF platform-independent public interface */ +#include /* Zephyr kernel API */ +#include "qep_port.h" /* QEP port */ +#include "qequeue.h" /* used for event deferral */ +#include "qmpool.h" /* this QP port uses the native QF memory pool */ +#include "qf.h" /* QF platform-independent public interface */ /* Zephyr spinlock for QF critical section */ extern struct k_spinlock QF_spinlock; @@ -60,7 +60,7 @@ extern struct k_spinlock QF_spinlock; * when Q_SPY configuation is used */ #ifndef Q_SPY -#define Q_PRINTK(fmt_, ...) printk(fmt_, ##__VA_ARGS__) +#define Q_PRINTK(fmt_, ...) printk(fmt_, ##__VA_ARGS__) #else #define Q_PRINTK(dummy, ...) ((void)0) #endif