QP/C++  8.0.0
Real-Time Embedded Framework
Loading...
Searching...
No Matches
qp_config.hpp File Reference

Sample QP/C++ configuration file. More...

Go to the source code of this file.

Macros

#define QP_API_VERSION   0
 QP Framework API backwards-compatibility version.
 
#define Q_UNSAFE
 Disable the QP Functional Safety (FuSa) Subsystem.
 
#define Q_SIGNAL_SIZE   2U
 Size of the QEvt signal [bytes].
 
#define QF_MAX_ACTIVE   32U
 Maximum # Active Objects in the system (1..64)
 
#define QF_MAX_EPOOL   3U
 Maximum # event pools in the system (0..15)
 
#define QF_MAX_TICK_RATE   1U
 Maximum # clock tick rates in the system (0..15)
 
#define QEVT_PAR_INIT
 Event parameter initialization (RAII) for dynamic events.
 
#define QACTIVE_CAN_STOP
 Enable the Active Object stop API.
 
#define Q_XTOR
 Enable the virtual destructor in the QP::QAsm base class.
 
#define QF_EVENT_SIZ_SIZE   2U
 Maximum size of dynamic events managed by QP.
 
#define QF_TIMEEVT_CTR_SIZE   4U
 Time event counter size.
 
#define QF_EQUEUE_CTR_SIZE   1U
 Event queue counter size.
 
#define QF_MPOOL_CTR_SIZE   2U
 Memory pool counter size (QF_MPOOL_CTR_SIZE)
 
#define QF_MPOOL_SIZ_SIZE   2U
 Memory block size (QF_MPOOL_SIZ_SIZE)
 
#define QS_TIME_SIZE   4U
 QS timestamp size (QS_TIME_SIZE)
 
#define QS_CTR_SIZE   2U
 QS buffer counter size (QS_CTR_SIZE)
 
#define QF_ON_CONTEXT_SW
 Enable context switch callback WITHOUT QS.
 
#define QF_MEM_ISOLATE
 Enable MPU memory isolation.
 
#define QK_USE_IRQ_NUM   31
 Use IRQ handler for QK return-from-preemption in ARM Cortex-M.
 
#define QK_USE_IRQ_HANDLER   Reserved31_IRQHandler
 Use IRQ handler for QK return-from-preemption in ARM Cortex-M.
 
#define QXK_USE_IRQ_NUM   31
 Use IRQ handler for QXK return-from-preemption in ARM Cortex-M.
 
#define QXK_USE_IRQ_HANDLER   Reserved31_IRQHandler
 Use IRQ handler for QK return-from-preemption in ARM Cortex-M.
 

Detailed Description

Sample QP/C++ configuration file.

Details
This an example of a QP/C++ configuration file with the explanation of the available configuration macros. The qp_config.hpp file is optional and does not need to be provided (see the description of the QP_CONFIG macro below). In that case, all the listed configuration macros will be set at their default values.
Attention
The qp_config.hpp configuration file takes effect only when the command-line macro QP_CONFIG is defined.

Also, if the qp_config.hpp file is provided and enabled (by defining the command-line macro QP_CONFIG), but any of the listed configuration macros is not defined in the provided file, the default value will be used.

Note
Some of the configuration macros listed in this file apply only to specific QP/C++ ports.
Configuration Wizard support
The qp_config.hpp header files provided in the various QP/C++ examples are formatted to support the "Configuration Wizard" editor available in some IDEs (e.g., KEIL uVision). The screen shot below shows how to edit qp_config.hpp in that mode.

Definition in file qp_config.hpp.

Macro Definition Documentation

◆ QP_API_VERSION

#define QP_API_VERSION   0

QP Framework API backwards-compatibility version.

Details
QP API backwards compatibility with the QP/C++ API version. Lower QP_API_VERSION values enable backwards compatibility with lower (older) QP API versions.
  • 0 => maximum supported compatibility
  • 580 => QP 5.8.0 or newer
  • 660 => QP 6.6.0 or newer
  • 691 => QP 6.9.1 or newer
  • 700 => QP 7.0.0 or newer
  • 9999 => Latest QP API only (minimum compatibility)

For example, QP_API_VERSION==691 will enable the compatibility layer with QP version 6.9.1 and newer, but not older than 6.9.1. QP_API_VERSION==0 enables the maximum currently supported backwards compatibility. Conversely, QP_API_VERSION==9999 means that no backwards compatibility layer should be enabled. Default: 0 (All supported)

Definition at line 61 of file qp_config.hpp.

◆ Q_UNSAFE

#define Q_UNSAFE

Disable the QP Functional Safety (FuSa) Subsystem.

Details
Defining the macro Q_UNSAFE disables QP FuSa Subsystem, which consists of the following facilities:
  • Software assertions as a recommended technique (called Failure Assertion Programming (FAP) in IEC 61508)
  • Software Self-Monitoring (SSM), which encompasses such techniques:
    • Duplicate Inverse Storage for critical variables
    • Fixed Upper Loop Bound for all loops
    • Invalid Control Flow for all unreachable code paths
    • Hardware Memory Isolation by means of Memory Protection Unit (MPU)
    • High Watermark in event queues
    • High Watermark in event pools
    • Stack Overflow detection in QP Applications
    • Stack Painting in QP Applications
    • NULL-Pointer Dereferencing protection in QP Applications

Default: undefined

Attention
Disabling QP FuSa Subsystem (by defining the macro Q_UNSAFE), especially in the final production release, CONTRADICTS the most fundamental principles of functional safety and is NOT recommended.

Definition at line 91 of file qp_config.hpp.

◆ Q_SIGNAL_SIZE

#define Q_SIGNAL_SIZE   2U

Size of the QEvt signal [bytes].

Details
This macro controls the dynamic range of event signals.
  • 1U => 1 byte (up to 255 signals)
  • 2U => 2 bytes (up to 65535 signals) (default)
  • 4U => 4 bytes (up to 4G signals)

Definition at line 106 of file qp_config.hpp.

◆ QF_MAX_ACTIVE

#define QF_MAX_ACTIVE   32U

Maximum # Active Objects in the system (1..64)

Details
Defines the maximum # Active Objects that QP Framework can manage at any time.
  • Minimum: 1
  • Default: 32
  • Maximum: 64 (inclusive)

Definition at line 123 of file qp_config.hpp.

◆ QF_MAX_EPOOL

#define QF_MAX_EPOOL   3U

Maximum # event pools in the system (0..15)

Details
  • Minimum: 0 – no event pools at all
  • Default: 3
  • Maximum: 15 (inclusive)

Definition at line 133 of file qp_config.hpp.

◆ QF_MAX_TICK_RATE

#define QF_MAX_TICK_RATE   1U

Maximum # clock tick rates in the system (0..15)

Details
  • Minimum: 0 – no time events at all
  • Default: 1
  • Maximum: 15 (inclusive)

Definition at line 143 of file qp_config.hpp.

◆ QEVT_PAR_INIT

#define QEVT_PAR_INIT

Event parameter initialization (RAII) for dynamic events.

Details
When defined, the macro activates initialization of event parameters while creating dynamic events. This could be use for Resource Acquisition Is Initialization (RAII) for dynamic events.

Default: undefined

See also

Definition at line 161 of file qp_config.hpp.

◆ QACTIVE_CAN_STOP

#define QACTIVE_CAN_STOP

Enable the Active Object stop API.

Details
When defined, enable Active Object stop API (Not recommended)

Default: undefined

Definition at line 172 of file qp_config.hpp.

◆ Q_XTOR

#define Q_XTOR

Enable the virtual destructor in the QP::QAsm base class.

Details
When defined, the macro Q_XTOR enables the virtual destructor in the QP::QAsm base class and all its subclasses: QP::QHsm, QP::QMsm, QP::QActive, QP::QMActive, etc.
Note
The virtual destructor is not enabled by default because such a destructor tends to pull in the delete operator, which then must be linked from a standard library. This is undesirable in many embedded systems.

Default: undefined

See also

Definition at line 192 of file qp_config.hpp.

◆ QF_EVENT_SIZ_SIZE

#define QF_EVENT_SIZ_SIZE   2U

Maximum size of dynamic events managed by QP.

Details
This macro controls the maximum size of dynamic events managed by QP Framework.
  • 1U => 1 byte dynamic range (event size up to 255 bytes)
  • 2U => 2 byte dynamic range (event size up to 65535 bytes) (default)

Default: 2 byte dynamic range (64K bytes maximum event size)

Definition at line 204 of file qp_config.hpp.

◆ QF_TIMEEVT_CTR_SIZE

#define QF_TIMEEVT_CTR_SIZE   4U

Time event counter size.

Details
This macro controls the dynamic range of timeouts allowed in QP::QTimeEvt. The timeouts are counted in tick of the associated clock tick rate.
  • 1U => 1 byte (timeouts of up to 255 ticks)
  • 2U => 2 bytes (timeouts of up to 65535 ticks)
  • 4U => 4 bytes (timeouts of up to 2^32 ticks) (default)

Default: 4 bytes (2^32 dynamic range)

Definition at line 219 of file qp_config.hpp.

◆ QF_EQUEUE_CTR_SIZE

#define QF_EQUEUE_CTR_SIZE   1U

Event queue counter size.

The size [bytes] of the ring-buffer counters used in the native QF event queue implementation. Valid values: 1U or 2U; default 1U.

This macro can be defined in the QF port file (qf_port.hpp) to configure the QP::QEQueueCtr type. Here the macro is not defined so the default of 1 byte is chosen.

Details
This macro controls the maximum number of events that QP::QEQueue can hold
  • 1U => 1 byte (maximum 255 events) (default)
  • 2U => 2 bytes (maximum 65535 events)

Default: 1 (maximum 255 events in a queue)

Definition at line 232 of file qp_config.hpp.

◆ QF_MPOOL_CTR_SIZE

#define QF_MPOOL_CTR_SIZE   2U

Memory pool counter size (QF_MPOOL_CTR_SIZE)

Details
This macro controls the maximum number of memory blocks that QP::QMPool can hold
  • 1U => 1 byte (up to 255 memory blocks)
  • 2U => 2 bytes (up to 65535 memory blocks) (default)
  • 2U => 2 bytes (up to 2^32 memory blocks)

Default: 2 bytes (up to 65535 memory blocks maximum in a pool)

Definition at line 246 of file qp_config.hpp.

◆ QF_MPOOL_SIZ_SIZE

#define QF_MPOOL_SIZ_SIZE   2U

Memory block size (QF_MPOOL_SIZ_SIZE)

Details
This macro controls the maximum size of memory blocks that QP::QMPool can hold.
  • 1U => 1 byte dynamic range (event size up to 255 bytes)
  • 2 U=> 2 byte dynamic range (event size up to 65535 bytes) (default)

Default: 2 byte dynamic range (64K bytes maximum block size)

Definition at line 259 of file qp_config.hpp.

◆ QS_TIME_SIZE

#define QS_TIME_SIZE   4U

QS timestamp size (QS_TIME_SIZE)

Details
This macro controls the dynamic range of timestamp produced by QS software tracing.
  • 1U => 1 byte (timestamp wraps around at 255 )
  • 2U => 2 bytes (timestamp wraps around at 65535)
  • 4U => 4 bytes (timestamp wraps around at 2^32) (default)

Default: 4 bytes (2^32 dynamic range)

See also

Definition at line 281 of file qp_config.hpp.

◆ QS_CTR_SIZE

#define QS_CTR_SIZE   2U

QS buffer counter size (QS_CTR_SIZE)

Details
This macro controls the maximum number of bytes held in the QS TX/RX buffers.
  • 1U => 1 byte (maximum 255 bytes)
  • 2U => 2 bytes (maximum 65535 bytes) (default)
  • 4U => 4 bytes (maximum 2^32 bytes)

Default: 2 bytes (maximum 65535 bytes in QS buffers)

Definition at line 295 of file qp_config.hpp.

◆ QF_ON_CONTEXT_SW

#define QF_ON_CONTEXT_SW

Enable context switch callback WITHOUT QS.

Details
When defined, enables context switch callback QF_onContextSw() in the built-in kernels (QV, QK, QXK).

Default: undefined

Definition at line 307 of file qp_config.hpp.

◆ QF_MEM_ISOLATE

#define QF_MEM_ISOLATE

Enable MPU memory isolation.

Details
When defined, enables memory isolation (requires MPU)
Note
Implies QF_ON_CONTEXT_SW (i.e., QF_ON_CONTEXT_SW gets defined)

Definition at line 318 of file qp_config.hpp.

◆ QK_USE_IRQ_NUM

#define QK_USE_IRQ_NUM   31

Use IRQ handler for QK return-from-preemption in ARM Cortex-M.

Details
If QK_USE_IRQ_NUM macro is defined, it specifies the IRQ number in ARM Cortex-M to be used as the exception for return-from-preemption in the QK kernel.

This macro should be defined only if the NMI handler is utilized in the project. The specified IRQ number must be otherwise unused.

Default: undefined

See also
Requires defining the macro QK_USE_IRQ_HANDLER

Definition at line 337 of file qp_config.hpp.

◆ QK_USE_IRQ_HANDLER

#define QK_USE_IRQ_HANDLER   Reserved31_IRQHandler

Use IRQ handler for QK return-from-preemption in ARM Cortex-M.

Details
If QK_USE_IRQ_HANDLER macro is defined, it specifies the IRQ handler name in ARM Cortex-M to be used as the exception for return-from-preemption in the QK kernel.

This macro should be defined only if the NMI handler is utilized in the project. The specified IRQ handler must be otherwise unused.

See also
Requires defining the macro QK_USE_IRQ_NUM

Definition at line 353 of file qp_config.hpp.

◆ QXK_USE_IRQ_NUM

#define QXK_USE_IRQ_NUM   31

Use IRQ handler for QXK return-from-preemption in ARM Cortex-M.

Details
If QXK_USE_IRQ_NUM macro is defined, it specifies the IRQ number in ARM Cortex-M to be used as the exception for return-from-preemption in the QXK kernel.

This macro should be defined only if the NMI handler is utilized in the project. The specified IRQ number must be otherwise unused.

Default: undefined

See also
Requires defining the macro QXK_USE_IRQ_HANDLER

Definition at line 371 of file qp_config.hpp.

◆ QXK_USE_IRQ_HANDLER

#define QXK_USE_IRQ_HANDLER   Reserved31_IRQHandler

Use IRQ handler for QK return-from-preemption in ARM Cortex-M.

Details
If QXK_USE_IRQ_HANDLER macro is defined, it specifies the IRQ handler name in ARM Cortex-M to be used as the exception for return-from-preemption in the QK kernel.

This macro should be defined only if the NMI handler is utilized in the project. The specified IRQ handler must be otherwise unused.

Default: undefined

See also
Requires defining the macro QXK_USE_IRQ_NUM

Definition at line 389 of file qp_config.hpp.