From b2622dcf2b512066e79d31d3f3f9876719e0485b Mon Sep 17 00:00:00 2001 From: Dev10-sys Date: Sat, 24 Oct 2026 22:05:26 +0530 Subject: [PATCH 1/3] Decouple TX_SAFETY_CRITICAL build checks from runtime exception handling - Decouple TX_SAFETY_CRITICAL into granular TX_SAFETY_CRITICAL_BUILD_CHECK and TX_SAFETY_CRITICAL_EXCEPTION_ENABLE, retaining TX_SAFETY_CRITICAL as a backward-compatible umbrella macro. - Remove prohibitions on TX_ENABLE_STACK_CHECKING, TX_DISABLE_NOTIFY_CALLBACKS, and TX_ENABLE_EVENT_TRACE to align with certified profiles and safety manual. - Add TX_PARAMETER_NOT_USED to default TX_SAFETY_CRITICAL_EXCEPTION_HANDLER to prevent -Werror=unused-parameter compilation failures. - Update runtime trap call sites across common, common_smp, and all module ports. - Add regression test cases for both single-core and SMP test suites. Fixes #795 Signed-off-by: Dev10-sys --- common/inc/tx_api.h | 31 ++-- common/src/tx_initialize_kernel_enter.c | 4 +- common/src/tx_thread_shell_entry.c | 2 +- common/src/tx_timer_initialize.c | 2 +- common/src/tx_timer_thread_entry.c | 2 +- common_smp/inc/tx_api.h | 31 ++-- common_smp/src/tx_initialize_kernel_enter.c | 4 +- common_smp/src/tx_thread_shell_entry.c | 2 +- common_smp/src/tx_timer_thread_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- test/smp/cmake/regression/CMakeLists.txt | 3 +- test/smp/regression/testcontrol.c | 2 + .../regression/threadx_safety_critical_test.c | 143 ++++++++++++++++++ test/tx/cmake/regression/CMakeLists.txt | 3 +- test/tx/regression/testcontrol.c | 2 + .../regression/threadx_safety_critical_test.c | 143 ++++++++++++++++++ 51 files changed, 371 insertions(+), 77 deletions(-) create mode 100644 test/smp/regression/threadx_safety_critical_test.c create mode 100644 test/tx/regression/threadx_safety_critical_test.c diff --git a/common/inc/tx_api.h b/common/inc/tx_api.h index ed1f82918..bbb447ee5 100644 --- a/common/inc/tx_api.h +++ b/common/inc/tx_api.h @@ -2101,6 +2101,15 @@ VOID _tx_misra_thread_entry_exit_notify_not_used(VOID (*threa /* Define safety critical configuration and exception handling. */ #ifdef TX_SAFETY_CRITICAL +#ifndef TX_SAFETY_CRITICAL_BUILD_CHECK +#define TX_SAFETY_CRITICAL_BUILD_CHECK +#endif +#ifndef TX_SAFETY_CRITICAL_EXCEPTION_ENABLE +#define TX_SAFETY_CRITICAL_EXCEPTION_ENABLE +#endif +#endif + +#ifdef TX_SAFETY_CRITICAL_BUILD_CHECK /* Ensure the maximum number of priorities is defined in safety critical mode. */ #ifndef TX_MAX_PRIORITIES @@ -2132,11 +2141,6 @@ VOID _tx_misra_thread_entry_exit_notify_not_used(VOID (*threa #error "TX_DISABLE_STACK_FILLING must not be defined." #endif -/* Ensure enable stack checking is not defined. */ -#ifdef TX_ENABLE_STACK_CHECKING -#error "TX_ENABLE_STACK_CHECKING must not be defined." -#endif - /* Ensure disable preemption-threshold is not defined. */ #ifdef TX_DISABLE_PREEMPTION_THRESHOLD #error "TX_DISABLE_PREEMPTION_THRESHOLD must not be defined." @@ -2152,11 +2156,6 @@ VOID _tx_misra_thread_entry_exit_notify_not_used(VOID (*threa #error "TX_NO_TIMER must not be defined." #endif -/* Ensure disable notify callbacks is not defined. */ -#ifdef TX_DISABLE_NOTIFY_CALLBACKS -#error "TX_DISABLE_NOTIFY_CALLBACKS must not be defined." -#endif - /* Ensure in-line thread suspend/resume is not defined. */ #ifdef TX_INLINE_THREAD_RESUME_SUSPEND #error "TX_INLINE_THREAD_RESUME_SUSPEND must not be defined." @@ -2167,11 +2166,6 @@ VOID _tx_misra_thread_entry_exit_notify_not_used(VOID (*threa #error "TX_NOT_INTERRUPTABLE must not be defined." #endif -/* Ensure event trace enable is not defined. */ -#ifdef TX_ENABLE_EVENT_TRACE -#error "TX_ENABLE_EVENT_TRACE must not be defined." -#endif - /* Ensure block pool performance info enable is not defined. */ #ifdef TX_BLOCK_POOL_ENABLE_PERFORMANCE_INFO #error "TX_BLOCK_POOL_ENABLE_PERFORMANCE_INFO must not be defined." @@ -2212,6 +2206,10 @@ VOID _tx_misra_thread_entry_exit_notify_not_used(VOID (*threa #error "TX_TIMER_ENABLE_PERFORMANCE_INFO must not be defined." #endif +#endif + + +#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) /* Now define the safety critical exception handler. */ @@ -2225,6 +2223,9 @@ VOID _tx_safety_critical_exception_handler(CHAR *file_name, INT line_number, #ifndef TX_SAFETY_CRITICAL_EXCEPTION_HANDLER #define TX_SAFETY_CRITICAL_EXCEPTION_HANDLER VOID _tx_safety_critical_exception_handler(CHAR *file_name, INT line_number, UINT status) \ { \ + TX_PARAMETER_NOT_USED(file_name); \ + TX_PARAMETER_NOT_USED(line_number); \ + TX_PARAMETER_NOT_USED(status); \ while(1) \ { \ } \ diff --git a/common/src/tx_initialize_kernel_enter.c b/common/src/tx_initialize_kernel_enter.c index bbb073326..e16192d1a 100644 --- a/common/src/tx_initialize_kernel_enter.c +++ b/common/src/tx_initialize_kernel_enter.c @@ -39,7 +39,7 @@ extern VOID _tx_execution_initialize(VOID); TX_PORT_SPECIFIC_DATA -#ifdef TX_SAFETY_CRITICAL +#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) TX_SAFETY_CRITICAL_EXCEPTION_HANDLER #endif @@ -147,7 +147,7 @@ VOID _tx_initialize_kernel_enter(VOID) /* Enter the scheduling loop to start executing threads! */ _tx_thread_schedule(); -#ifdef TX_SAFETY_CRITICAL +#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/common/src/tx_thread_shell_entry.c b/common/src/tx_thread_shell_entry.c index 2a16a00b6..3d61f9d88 100644 --- a/common/src/tx_thread_shell_entry.c +++ b/common/src/tx_thread_shell_entry.c @@ -208,7 +208,7 @@ VOID (*entry_exit_notify)(TX_THREAD *notify_thread_ptr, UINT type); #endif -#ifdef TX_SAFETY_CRITICAL +#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/common/src/tx_timer_initialize.c b/common/src/tx_timer_initialize.c index 210888a1e..4f1badb23 100644 --- a/common/src/tx_timer_initialize.c +++ b/common/src/tx_timer_initialize.c @@ -255,7 +255,7 @@ UINT status; _tx_timer_priority, _tx_timer_priority, TX_NO_TIME_SLICE, TX_DONT_START); -#ifdef TX_SAFETY_CRITICAL +#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) /* Check return from thread create - if an error is detected throw an exception. */ if (status != TX_SUCCESS) diff --git a/common/src/tx_timer_thread_entry.c b/common/src/tx_timer_thread_entry.c index 971a0703f..bb9912400 100644 --- a/common/src/tx_timer_thread_entry.c +++ b/common/src/tx_timer_thread_entry.c @@ -463,7 +463,7 @@ TX_TIMER *timer_ptr; } } -#ifdef TX_SAFETY_CRITICAL +#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/common_smp/inc/tx_api.h b/common_smp/inc/tx_api.h index 77bd6218b..78b31a558 100644 --- a/common_smp/inc/tx_api.h +++ b/common_smp/inc/tx_api.h @@ -2110,6 +2110,15 @@ VOID _tx_misra_thread_entry_exit_notify_not_used(VOID (*threa /* Define safety critical configuration and exception handling. */ #ifdef TX_SAFETY_CRITICAL +#ifndef TX_SAFETY_CRITICAL_BUILD_CHECK +#define TX_SAFETY_CRITICAL_BUILD_CHECK +#endif +#ifndef TX_SAFETY_CRITICAL_EXCEPTION_ENABLE +#define TX_SAFETY_CRITICAL_EXCEPTION_ENABLE +#endif +#endif + +#ifdef TX_SAFETY_CRITICAL_BUILD_CHECK /* Ensure the maximum number of priorities is defined in safety critical mode. */ #ifndef TX_MAX_PRIORITIES @@ -2141,11 +2150,6 @@ VOID _tx_misra_thread_entry_exit_notify_not_used(VOID (*threa #error "TX_DISABLE_STACK_FILLING must not be defined." #endif -/* Ensure enable stack checking is not defined. */ -#ifdef TX_ENABLE_STACK_CHECKING -#error "TX_ENABLE_STACK_CHECKING must not be defined." -#endif - /* Ensure disable preemption-threshold is not defined. */ #ifdef TX_DISABLE_PREEMPTION_THRESHOLD #error "TX_DISABLE_PREEMPTION_THRESHOLD must not be defined." @@ -2161,11 +2165,6 @@ VOID _tx_misra_thread_entry_exit_notify_not_used(VOID (*threa #error "TX_NO_TIMER must not be defined." #endif -/* Ensure disable notify callbacks is not defined. */ -#ifdef TX_DISABLE_NOTIFY_CALLBACKS -#error "TX_DISABLE_NOTIFY_CALLBACKS must not be defined." -#endif - /* Ensure in-line thread suspend/resume is not defined. */ #ifdef TX_INLINE_THREAD_RESUME_SUSPEND #error "TX_INLINE_THREAD_RESUME_SUSPEND must not be defined." @@ -2176,11 +2175,6 @@ VOID _tx_misra_thread_entry_exit_notify_not_used(VOID (*threa #error "TX_NOT_INTERRUPTABLE must not be defined." #endif -/* Ensure event trace enable is not defined. */ -#ifdef TX_ENABLE_EVENT_TRACE -#error "TX_ENABLE_EVENT_TRACE must not be defined." -#endif - /* Ensure block pool performance info enable is not defined. */ #ifdef TX_BLOCK_POOL_ENABLE_PERFORMANCE_INFO #error "TX_BLOCK_POOL_ENABLE_PERFORMANCE_INFO must not be defined." @@ -2221,6 +2215,10 @@ VOID _tx_misra_thread_entry_exit_notify_not_used(VOID (*threa #error "TX_TIMER_ENABLE_PERFORMANCE_INFO must not be defined." #endif +#endif + + +#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) /* Now define the safety critical exception handler. */ @@ -2234,6 +2232,9 @@ VOID _tx_safety_critical_exception_handler(CHAR *file_name, INT line_number, #ifndef TX_SAFETY_CRITICAL_EXCEPTION_HANDLER #define TX_SAFETY_CRITICAL_EXCEPTION_HANDLER VOID _tx_safety_critical_exception_handler(CHAR *file_name, INT line_number, UINT status) \ { \ + TX_PARAMETER_NOT_USED(file_name); \ + TX_PARAMETER_NOT_USED(line_number); \ + TX_PARAMETER_NOT_USED(status); \ while(1) \ { \ } \ diff --git a/common_smp/src/tx_initialize_kernel_enter.c b/common_smp/src/tx_initialize_kernel_enter.c index 5fa71b8fa..5fe32b629 100644 --- a/common_smp/src/tx_initialize_kernel_enter.c +++ b/common_smp/src/tx_initialize_kernel_enter.c @@ -37,7 +37,7 @@ TX_PORT_SPECIFIC_DATA -#ifdef TX_SAFETY_CRITICAL +#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) TX_SAFETY_CRITICAL_EXCEPTION_HANDLER #endif @@ -176,7 +176,7 @@ ULONG other_core_status, i; /* Enter the scheduling loop to start executing threads! */ _tx_thread_schedule(); -#ifdef TX_SAFETY_CRITICAL +#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/common_smp/src/tx_thread_shell_entry.c b/common_smp/src/tx_thread_shell_entry.c index 2a16a00b6..3d61f9d88 100644 --- a/common_smp/src/tx_thread_shell_entry.c +++ b/common_smp/src/tx_thread_shell_entry.c @@ -208,7 +208,7 @@ VOID (*entry_exit_notify)(TX_THREAD *notify_thread_ptr, UINT type); #endif -#ifdef TX_SAFETY_CRITICAL +#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/common_smp/src/tx_timer_thread_entry.c b/common_smp/src/tx_timer_thread_entry.c index 51b165b23..85433a27d 100644 --- a/common_smp/src/tx_timer_thread_entry.c +++ b/common_smp/src/tx_timer_thread_entry.c @@ -530,7 +530,7 @@ UINT status; } } -#ifdef TX_SAFETY_CRITICAL +#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_arch/ARMv7-M/threadx_modules/ac5/module_lib/src/txm_module_thread_shell_entry.c b/ports_arch/ARMv7-M/threadx_modules/ac5/module_lib/src/txm_module_thread_shell_entry.c index 0e46caea5..230950141 100644 --- a/ports_arch/ARMv7-M/threadx_modules/ac5/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_arch/ARMv7-M/threadx_modules/ac5/module_lib/src/txm_module_thread_shell_entry.c @@ -160,7 +160,7 @@ VOID _txm_module_thread_shell_entry(TX_THREAD *thread_ptr, TXM_MODULE_THREAD_EN /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#ifdef TX_SAFETY_CRITICAL +#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_arch/ARMv7-M/threadx_modules/ac6/module_lib/src/txm_module_thread_shell_entry.c b/ports_arch/ARMv7-M/threadx_modules/ac6/module_lib/src/txm_module_thread_shell_entry.c index cd286c2dc..c32b4f928 100644 --- a/ports_arch/ARMv7-M/threadx_modules/ac6/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_arch/ARMv7-M/threadx_modules/ac6/module_lib/src/txm_module_thread_shell_entry.c @@ -161,7 +161,7 @@ VOID _txm_module_thread_shell_entry(TX_THREAD *thread_ptr, TXM_MODULE_THREAD_EN /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#ifdef TX_SAFETY_CRITICAL +#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_arch/ARMv7-M/threadx_modules/gnu/module_lib/src/txm_module_thread_shell_entry.c b/ports_arch/ARMv7-M/threadx_modules/gnu/module_lib/src/txm_module_thread_shell_entry.c index 01f2f9093..7bae2e7d9 100644 --- a/ports_arch/ARMv7-M/threadx_modules/gnu/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_arch/ARMv7-M/threadx_modules/gnu/module_lib/src/txm_module_thread_shell_entry.c @@ -159,7 +159,7 @@ VOID _txm_module_thread_shell_entry(TX_THREAD *thread_ptr, TXM_MODULE_THREAD_EN /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#ifdef TX_SAFETY_CRITICAL +#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_arch/ARMv7-M/threadx_modules/iar/module_lib/src/txm_module_thread_shell_entry.c b/ports_arch/ARMv7-M/threadx_modules/iar/module_lib/src/txm_module_thread_shell_entry.c index 0f892ce5f..188f58b79 100644 --- a/ports_arch/ARMv7-M/threadx_modules/iar/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_arch/ARMv7-M/threadx_modules/iar/module_lib/src/txm_module_thread_shell_entry.c @@ -159,7 +159,7 @@ VOID _txm_module_thread_shell_entry(TX_THREAD *thread_ptr, TXM_MODULE_THREAD_EN /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#ifdef TX_SAFETY_CRITICAL +#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_module/cortex_a35/ac6/module_lib/src/txm_module_thread_shell_entry.c b/ports_module/cortex_a35/ac6/module_lib/src/txm_module_thread_shell_entry.c index adf4163f7..690c9a966 100644 --- a/ports_module/cortex_a35/ac6/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_module/cortex_a35/ac6/module_lib/src/txm_module_thread_shell_entry.c @@ -165,7 +165,7 @@ VOID (*entry_exit_notify)(TX_THREAD *notify_thread_ptr, UINT type); /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#ifdef TX_SAFETY_CRITICAL +#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_module/cortex_a35/gnu/module_lib/src/txm_module_thread_shell_entry.c b/ports_module/cortex_a35/gnu/module_lib/src/txm_module_thread_shell_entry.c index 922b9306f..602ea5cbc 100644 --- a/ports_module/cortex_a35/gnu/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_module/cortex_a35/gnu/module_lib/src/txm_module_thread_shell_entry.c @@ -165,7 +165,7 @@ VOID (*entry_exit_notify)(TX_THREAD *notify_thread_ptr, UINT type); /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#ifdef TX_SAFETY_CRITICAL +#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_module/cortex_a35_smp/ac6/module_lib/src/txm_module_thread_shell_entry.c b/ports_module/cortex_a35_smp/ac6/module_lib/src/txm_module_thread_shell_entry.c index 4559ac0ea..1f88d27e1 100644 --- a/ports_module/cortex_a35_smp/ac6/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_module/cortex_a35_smp/ac6/module_lib/src/txm_module_thread_shell_entry.c @@ -157,7 +157,7 @@ VOID (*entry_exit_notify)(TX_THREAD *notify_thread_ptr, UINT type); /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#ifdef TX_SAFETY_CRITICAL +#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_module/cortex_a35_smp/gnu/module_lib/src/txm_module_thread_shell_entry.c b/ports_module/cortex_a35_smp/gnu/module_lib/src/txm_module_thread_shell_entry.c index ba56d9e3d..29b8aceb4 100644 --- a/ports_module/cortex_a35_smp/gnu/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_module/cortex_a35_smp/gnu/module_lib/src/txm_module_thread_shell_entry.c @@ -157,7 +157,7 @@ VOID (*entry_exit_notify)(TX_THREAD *notify_thread_ptr, UINT type); /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#ifdef TX_SAFETY_CRITICAL +#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_module/cortex_a7/ac5/module_lib/src/txm_module_thread_shell_entry.c b/ports_module/cortex_a7/ac5/module_lib/src/txm_module_thread_shell_entry.c index 4925fe47b..78c26c654 100644 --- a/ports_module/cortex_a7/ac5/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_module/cortex_a7/ac5/module_lib/src/txm_module_thread_shell_entry.c @@ -160,7 +160,7 @@ VOID _txm_module_thread_shell_entry(TX_THREAD *thread_ptr, TXM_MODULE_THREAD_EN /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#ifdef TX_SAFETY_CRITICAL +#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_module/cortex_a7/gnu/module_lib/src/txm_module_thread_shell_entry.c b/ports_module/cortex_a7/gnu/module_lib/src/txm_module_thread_shell_entry.c index 73a38340d..7d89ff456 100644 --- a/ports_module/cortex_a7/gnu/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_module/cortex_a7/gnu/module_lib/src/txm_module_thread_shell_entry.c @@ -166,7 +166,7 @@ VOID (*entry_exit_notify)(TX_THREAD *, UINT); /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#ifdef TX_SAFETY_CRITICAL +#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_module/cortex_a7/iar/module_lib/src/txm_module_thread_shell_entry.c b/ports_module/cortex_a7/iar/module_lib/src/txm_module_thread_shell_entry.c index cfe18ef19..5e0cc5419 100644 --- a/ports_module/cortex_a7/iar/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_module/cortex_a7/iar/module_lib/src/txm_module_thread_shell_entry.c @@ -161,7 +161,7 @@ VOID _txm_module_thread_shell_entry(TX_THREAD *thread_ptr, TXM_MODULE_THREAD_EN /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#ifdef TX_SAFETY_CRITICAL +#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_module/cortex_m0+/ac6/module_lib/src/txm_module_thread_shell_entry.c b/ports_module/cortex_m0+/ac6/module_lib/src/txm_module_thread_shell_entry.c index 13f57b8de..d2e489234 100644 --- a/ports_module/cortex_m0+/ac6/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_module/cortex_m0+/ac6/module_lib/src/txm_module_thread_shell_entry.c @@ -159,7 +159,7 @@ VOID _txm_module_thread_shell_entry(TX_THREAD *thread_ptr, TXM_MODULE_THREAD_EN /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#ifdef TX_SAFETY_CRITICAL +#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_module/cortex_m0+/gnu/module_lib/src/txm_module_thread_shell_entry.c b/ports_module/cortex_m0+/gnu/module_lib/src/txm_module_thread_shell_entry.c index 2bb3bf7eb..ba18c8d16 100644 --- a/ports_module/cortex_m0+/gnu/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_module/cortex_m0+/gnu/module_lib/src/txm_module_thread_shell_entry.c @@ -159,7 +159,7 @@ VOID _txm_module_thread_shell_entry(TX_THREAD *thread_ptr, TXM_MODULE_THREAD_EN /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#ifdef TX_SAFETY_CRITICAL +#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_module/cortex_m0+/iar/module_lib/src/txm_module_thread_shell_entry.c b/ports_module/cortex_m0+/iar/module_lib/src/txm_module_thread_shell_entry.c index 8983b8329..a545d2b80 100644 --- a/ports_module/cortex_m0+/iar/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_module/cortex_m0+/iar/module_lib/src/txm_module_thread_shell_entry.c @@ -159,7 +159,7 @@ VOID _txm_module_thread_shell_entry(TX_THREAD *thread_ptr, TXM_MODULE_THREAD_EN /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#ifdef TX_SAFETY_CRITICAL +#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_module/cortex_m23/ac6/module_lib/src/txm_module_thread_shell_entry.c b/ports_module/cortex_m23/ac6/module_lib/src/txm_module_thread_shell_entry.c index 0be91d63c..55975ed07 100644 --- a/ports_module/cortex_m23/ac6/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_module/cortex_m23/ac6/module_lib/src/txm_module_thread_shell_entry.c @@ -161,7 +161,7 @@ VOID _txm_module_thread_shell_entry(TX_THREAD *thread_ptr, TXM_MODULE_THREAD_EN /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#ifdef TX_SAFETY_CRITICAL +#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_module/cortex_m23/gnu/module_lib/src/txm_module_thread_shell_entry.c b/ports_module/cortex_m23/gnu/module_lib/src/txm_module_thread_shell_entry.c index b4e753782..a78ae20e3 100644 --- a/ports_module/cortex_m23/gnu/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_module/cortex_m23/gnu/module_lib/src/txm_module_thread_shell_entry.c @@ -159,7 +159,7 @@ VOID _txm_module_thread_shell_entry(TX_THREAD *thread_ptr, TXM_MODULE_THREAD_EN /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#ifdef TX_SAFETY_CRITICAL +#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_module/cortex_m23/iar/module_lib/src/txm_module_thread_shell_entry.c b/ports_module/cortex_m23/iar/module_lib/src/txm_module_thread_shell_entry.c index 1bcfe689b..2ab9fdc7f 100644 --- a/ports_module/cortex_m23/iar/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_module/cortex_m23/iar/module_lib/src/txm_module_thread_shell_entry.c @@ -159,7 +159,7 @@ VOID _txm_module_thread_shell_entry(TX_THREAD *thread_ptr, TXM_MODULE_THREAD_EN /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#ifdef TX_SAFETY_CRITICAL +#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_module/cortex_m3/ac5/module_lib/src/txm_module_thread_shell_entry.c b/ports_module/cortex_m3/ac5/module_lib/src/txm_module_thread_shell_entry.c index b1e803f9d..8833ff0df 100644 --- a/ports_module/cortex_m3/ac5/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_module/cortex_m3/ac5/module_lib/src/txm_module_thread_shell_entry.c @@ -160,7 +160,7 @@ VOID _txm_module_thread_shell_entry(TX_THREAD *thread_ptr, TXM_MODULE_THREAD_EN /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#ifdef TX_SAFETY_CRITICAL +#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_module/cortex_m3/ac6/module_lib/src/txm_module_thread_shell_entry.c b/ports_module/cortex_m3/ac6/module_lib/src/txm_module_thread_shell_entry.c index 518704d74..e2efcbe0f 100644 --- a/ports_module/cortex_m3/ac6/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_module/cortex_m3/ac6/module_lib/src/txm_module_thread_shell_entry.c @@ -161,7 +161,7 @@ VOID _txm_module_thread_shell_entry(TX_THREAD *thread_ptr, TXM_MODULE_THREAD_EN /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#ifdef TX_SAFETY_CRITICAL +#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_module/cortex_m3/gnu/module_lib/src/txm_module_thread_shell_entry.c b/ports_module/cortex_m3/gnu/module_lib/src/txm_module_thread_shell_entry.c index e8af97a97..2a34487cc 100644 --- a/ports_module/cortex_m3/gnu/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_module/cortex_m3/gnu/module_lib/src/txm_module_thread_shell_entry.c @@ -159,7 +159,7 @@ VOID _txm_module_thread_shell_entry(TX_THREAD *thread_ptr, TXM_MODULE_THREAD_EN /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#ifdef TX_SAFETY_CRITICAL +#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_module/cortex_m3/iar/module_lib/src/txm_module_thread_shell_entry.c b/ports_module/cortex_m3/iar/module_lib/src/txm_module_thread_shell_entry.c index d4fd04ec6..f7b0419ce 100644 --- a/ports_module/cortex_m3/iar/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_module/cortex_m3/iar/module_lib/src/txm_module_thread_shell_entry.c @@ -159,7 +159,7 @@ VOID _txm_module_thread_shell_entry(TX_THREAD *thread_ptr, TXM_MODULE_THREAD_EN /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#ifdef TX_SAFETY_CRITICAL +#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_module/cortex_m33/ac6/module_lib/src/txm_module_thread_shell_entry.c b/ports_module/cortex_m33/ac6/module_lib/src/txm_module_thread_shell_entry.c index bf6fcb5f7..6805cc9fc 100644 --- a/ports_module/cortex_m33/ac6/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_module/cortex_m33/ac6/module_lib/src/txm_module_thread_shell_entry.c @@ -161,7 +161,7 @@ VOID _txm_module_thread_shell_entry(TX_THREAD *thread_ptr, TXM_MODULE_THREAD_EN /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#ifdef TX_SAFETY_CRITICAL +#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_module/cortex_m33/gnu/module_lib/src/txm_module_thread_shell_entry.c b/ports_module/cortex_m33/gnu/module_lib/src/txm_module_thread_shell_entry.c index 0fa4f2de5..c006d4a84 100644 --- a/ports_module/cortex_m33/gnu/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_module/cortex_m33/gnu/module_lib/src/txm_module_thread_shell_entry.c @@ -159,7 +159,7 @@ VOID _txm_module_thread_shell_entry(TX_THREAD *thread_ptr, TXM_MODULE_THREAD_EN /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#ifdef TX_SAFETY_CRITICAL +#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_module/cortex_m33/iar/module_lib/src/txm_module_thread_shell_entry.c b/ports_module/cortex_m33/iar/module_lib/src/txm_module_thread_shell_entry.c index 1d2e17201..e21062175 100644 --- a/ports_module/cortex_m33/iar/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_module/cortex_m33/iar/module_lib/src/txm_module_thread_shell_entry.c @@ -159,7 +159,7 @@ VOID _txm_module_thread_shell_entry(TX_THREAD *thread_ptr, TXM_MODULE_THREAD_EN /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#ifdef TX_SAFETY_CRITICAL +#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_module/cortex_m4/ac5/module_lib/src/txm_module_thread_shell_entry.c b/ports_module/cortex_m4/ac5/module_lib/src/txm_module_thread_shell_entry.c index b7bccaa82..12d6ad045 100644 --- a/ports_module/cortex_m4/ac5/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_module/cortex_m4/ac5/module_lib/src/txm_module_thread_shell_entry.c @@ -160,7 +160,7 @@ VOID _txm_module_thread_shell_entry(TX_THREAD *thread_ptr, TXM_MODULE_THREAD_EN /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#ifdef TX_SAFETY_CRITICAL +#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_module/cortex_m4/ac6/module_lib/src/txm_module_thread_shell_entry.c b/ports_module/cortex_m4/ac6/module_lib/src/txm_module_thread_shell_entry.c index e75e693d6..bd953f53e 100644 --- a/ports_module/cortex_m4/ac6/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_module/cortex_m4/ac6/module_lib/src/txm_module_thread_shell_entry.c @@ -161,7 +161,7 @@ VOID _txm_module_thread_shell_entry(TX_THREAD *thread_ptr, TXM_MODULE_THREAD_EN /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#ifdef TX_SAFETY_CRITICAL +#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_module/cortex_m4/gnu/module_lib/src/txm_module_thread_shell_entry.c b/ports_module/cortex_m4/gnu/module_lib/src/txm_module_thread_shell_entry.c index 30632c1e1..cbeb0597d 100644 --- a/ports_module/cortex_m4/gnu/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_module/cortex_m4/gnu/module_lib/src/txm_module_thread_shell_entry.c @@ -159,7 +159,7 @@ VOID _txm_module_thread_shell_entry(TX_THREAD *thread_ptr, TXM_MODULE_THREAD_EN /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#ifdef TX_SAFETY_CRITICAL +#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_module/cortex_m4/iar/module_lib/src/txm_module_thread_shell_entry.c b/ports_module/cortex_m4/iar/module_lib/src/txm_module_thread_shell_entry.c index 5d7767aed..49888b5af 100644 --- a/ports_module/cortex_m4/iar/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_module/cortex_m4/iar/module_lib/src/txm_module_thread_shell_entry.c @@ -159,7 +159,7 @@ VOID _txm_module_thread_shell_entry(TX_THREAD *thread_ptr, TXM_MODULE_THREAD_EN /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#ifdef TX_SAFETY_CRITICAL +#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_module/cortex_m7/ac5/module_lib/src/txm_module_thread_shell_entry.c b/ports_module/cortex_m7/ac5/module_lib/src/txm_module_thread_shell_entry.c index 48f5b3a8d..e8db65447 100644 --- a/ports_module/cortex_m7/ac5/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_module/cortex_m7/ac5/module_lib/src/txm_module_thread_shell_entry.c @@ -160,7 +160,7 @@ VOID _txm_module_thread_shell_entry(TX_THREAD *thread_ptr, TXM_MODULE_THREAD_EN /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#ifdef TX_SAFETY_CRITICAL +#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_module/cortex_m7/ac6/module_lib/src/txm_module_thread_shell_entry.c b/ports_module/cortex_m7/ac6/module_lib/src/txm_module_thread_shell_entry.c index bd3c0c7ce..d06a980b8 100644 --- a/ports_module/cortex_m7/ac6/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_module/cortex_m7/ac6/module_lib/src/txm_module_thread_shell_entry.c @@ -161,7 +161,7 @@ VOID _txm_module_thread_shell_entry(TX_THREAD *thread_ptr, TXM_MODULE_THREAD_EN /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#ifdef TX_SAFETY_CRITICAL +#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_module/cortex_m7/gnu/module_lib/src/txm_module_thread_shell_entry.c b/ports_module/cortex_m7/gnu/module_lib/src/txm_module_thread_shell_entry.c index 3eb08b2b3..9feba2d0f 100644 --- a/ports_module/cortex_m7/gnu/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_module/cortex_m7/gnu/module_lib/src/txm_module_thread_shell_entry.c @@ -159,7 +159,7 @@ VOID _txm_module_thread_shell_entry(TX_THREAD *thread_ptr, TXM_MODULE_THREAD_EN /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#ifdef TX_SAFETY_CRITICAL +#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_module/cortex_m7/iar/module_lib/src/txm_module_thread_shell_entry.c b/ports_module/cortex_m7/iar/module_lib/src/txm_module_thread_shell_entry.c index c858fb2b9..4a6d05084 100644 --- a/ports_module/cortex_m7/iar/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_module/cortex_m7/iar/module_lib/src/txm_module_thread_shell_entry.c @@ -159,7 +159,7 @@ VOID _txm_module_thread_shell_entry(TX_THREAD *thread_ptr, TXM_MODULE_THREAD_EN /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#ifdef TX_SAFETY_CRITICAL +#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_module/cortex_r4/ac6/module_lib/src/txm_module_thread_shell_entry.c b/ports_module/cortex_r4/ac6/module_lib/src/txm_module_thread_shell_entry.c index ec0d81c63..7f765faf3 100644 --- a/ports_module/cortex_r4/ac6/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_module/cortex_r4/ac6/module_lib/src/txm_module_thread_shell_entry.c @@ -161,7 +161,7 @@ VOID _txm_module_thread_shell_entry(TX_THREAD *thread_ptr, TXM_MODULE_THREAD_EN /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#ifdef TX_SAFETY_CRITICAL +#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_module/cortex_r4/iar/module_lib/src/txm_module_thread_shell_entry.c b/ports_module/cortex_r4/iar/module_lib/src/txm_module_thread_shell_entry.c index b27e06e3b..90b7e0fc4 100644 --- a/ports_module/cortex_r4/iar/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_module/cortex_r4/iar/module_lib/src/txm_module_thread_shell_entry.c @@ -159,7 +159,7 @@ VOID _txm_module_thread_shell_entry(TX_THREAD *thread_ptr, TXM_MODULE_THREAD_EN /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#ifdef TX_SAFETY_CRITICAL +#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_module/cortex_r52/gnu/module_lib/src/txm_module_thread_shell_entry.c b/ports_module/cortex_r52/gnu/module_lib/src/txm_module_thread_shell_entry.c index 4f01b7a8c..e866742a9 100644 --- a/ports_module/cortex_r52/gnu/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_module/cortex_r52/gnu/module_lib/src/txm_module_thread_shell_entry.c @@ -159,7 +159,7 @@ VOID _txm_module_thread_shell_entry(TX_THREAD *thread_ptr, TXM_MODULE_THREAD_EN /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#ifdef TX_SAFETY_CRITICAL +#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_module/rxv2/iar/module_lib/src/txm_module_thread_shell_entry.c b/ports_module/rxv2/iar/module_lib/src/txm_module_thread_shell_entry.c index 1242184cc..a6ac34777 100644 --- a/ports_module/rxv2/iar/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_module/rxv2/iar/module_lib/src/txm_module_thread_shell_entry.c @@ -159,7 +159,7 @@ VOID _txm_module_thread_shell_entry(TX_THREAD *thread_ptr, TXM_MODULE_THREAD_EN /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#ifdef TX_SAFETY_CRITICAL +#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/test/smp/cmake/regression/CMakeLists.txt b/test/smp/cmake/regression/CMakeLists.txt index cdf0c5859..75d972896 100644 --- a/test/smp/cmake/regression/CMakeLists.txt +++ b/test/smp/cmake/regression/CMakeLists.txt @@ -132,7 +132,8 @@ set(regression_test_cases ${SOURCE_DIR}/threadx_timer_simple_test.c ${SOURCE_DIR}/threadx_trace_basic_test.c ${SOURCE_DIR}/threadx_trace_entry_update_test.c - ${SOURCE_DIR}/threadx_initialize_kernel_setup_test.c) + ${SOURCE_DIR}/threadx_initialize_kernel_setup_test.c + ${SOURCE_DIR}/threadx_safety_critical_test.c) add_custom_command( OUTPUT ${GENERATED_LOW_LEVEL_SOURCE} diff --git a/test/smp/regression/testcontrol.c b/test/smp/regression/testcontrol.c index c964dc03a..aa8c442e0 100644 --- a/test/smp/regression/testcontrol.c +++ b/test/smp/regression/testcontrol.c @@ -273,6 +273,7 @@ void threadx_timer_multiple_accuracy_application_define(void *); void threadx_timer_information_application_define(void *); void threadx_trace_basic_application_define(void *); +void threadx_safety_critical_application_define(void *); void threadx_smp_rebalance_exclustion_test(void *first_unused_memory); void threadx_smp_two_threads_one_core_test(void *first_unused_memory); @@ -422,6 +423,7 @@ TEST_ENTRY test_control_tests[] = threadx_timer_information_application_define, threadx_trace_basic_application_define, + threadx_safety_critical_application_define, #endif TX_NULL, diff --git a/test/smp/regression/threadx_safety_critical_test.c b/test/smp/regression/threadx_safety_critical_test.c new file mode 100644 index 000000000..59b3cfd60 --- /dev/null +++ b/test/smp/regression/threadx_safety_critical_test.c @@ -0,0 +1,143 @@ +/***************************************************************************/ +/* Copyright (c) 2024 Microsoft Corporation */ +/* Copyright (c) 2026 Eclipse ThreadX contributors */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the MIT License which is available at */ +/* https://opensource.org/licenses/MIT. */ +/* */ +/* SPDX-License-Identifier: MIT */ +/***************************************************************************/ + +/* This test is designed to test safety-critical build verification and + exception handling in ThreadX SMP. */ + +#include +#include + +#ifndef TX_SAFETY_CRITICAL_BUILD_CHECK +#define TX_SAFETY_CRITICAL_BUILD_CHECK +#endif + +#ifndef TX_SAFETY_CRITICAL_EXCEPTION_ENABLE +#define TX_SAFETY_CRITICAL_EXCEPTION_ENABLE +#endif + +#include "tx_api.h" + +static unsigned long thread_0_counter = 0; +static TX_THREAD thread_0; + +static unsigned long exception_handler_invoked = 0; +static CHAR *last_exception_file = TX_NULL; +static INT last_exception_line = 0; +static UINT last_exception_status = 0; + +/* Define custom exception handler for test verification. */ +VOID _tx_safety_critical_exception_handler(CHAR *file_name, INT line_number, UINT status) +{ + exception_handler_invoked++; + last_exception_file = file_name; + last_exception_line = line_number; + last_exception_status = status; +} + +/* Prototype for test control return. */ +void test_control_return(UINT status); + +/* Define thread prototypes. */ +static void thread_0_entry(ULONG thread_input); + +/* Define what the initial system looks like. */ +#ifdef CTEST +void test_application_define(void *first_unused_memory) +#else +void threadx_safety_critical_application_define(void *first_unused_memory) +#endif +{ +UINT status; +CHAR *pointer; + + /* Put first available memory address into a character pointer. */ + pointer = (CHAR *) first_unused_memory; + + /* Create test thread. */ + status = tx_thread_create(&thread_0, "thread 0", thread_0_entry, 1, + pointer, TEST_STACK_SIZE_PRINTF, + 16, 16, 3, TX_AUTO_START); + + /* Check for status. */ + if (status != TX_SUCCESS) + { + printf("Running Safety Critical Test........................................ ERROR #1\n"); + test_control_return(1); + } +} + +/* Define the test thread. */ +static void thread_0_entry(ULONG thread_input) +{ +TX_PARAMETER_NOT_USED(thread_input); + + /* Inform user. */ + printf("Running Safety Critical Test........................................ "); + + /* Increment thread 0 counter. */ + thread_0_counter++; + + /* Verify build-time configurations are satisfied. */ +#ifndef TX_MAX_PRIORITIES + printf("ERROR #2\n"); + test_control_return(1); + return; +#else + if ((TX_MAX_PRIORITIES % 32) != 0) + { + printf("ERROR #3\n"); + test_control_return(1); + return; + } +#endif + + /* Sleep for 1 tick to verify scheduling operates normally. */ + tx_thread_sleep(1); + + /* Verify that no exception has occurred so far. */ + if (exception_handler_invoked != 0) + { + printf("ERROR #4\n"); + test_control_return(1); + return; + } + + /* Test runtime safety-critical exception trap dispatch. */ + TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0x5A5A); + + /* Verify that the exception handler was called exactly once. */ + if (exception_handler_invoked != 1) + { + printf("ERROR #5\n"); + test_control_return(1); + return; + } + + /* Verify the recorded status value. */ + if (last_exception_status != 0x5A5A) + { + printf("ERROR #6\n"); + test_control_return(1); + return; + } + + /* Verify that file name and line number were passed correctly. */ + if (last_exception_file == TX_NULL || last_exception_line == 0) + { + printf("ERROR #7\n"); + test_control_return(1); + return; + } + + /* Successful test completion. */ + printf("SUCCESS!\n"); + test_control_return(0); +} diff --git a/test/tx/cmake/regression/CMakeLists.txt b/test/tx/cmake/regression/CMakeLists.txt index 6b94a8576..57193094a 100644 --- a/test/tx/cmake/regression/CMakeLists.txt +++ b/test/tx/cmake/regression/CMakeLists.txt @@ -113,7 +113,8 @@ set(regression_test_cases ${SOURCE_DIR}/threadx_timer_simple_test.c ${SOURCE_DIR}/threadx_trace_basic_test.c ${SOURCE_DIR}/threadx_trace_entry_update_test.c - ${SOURCE_DIR}/threadx_initialize_kernel_setup_test.c) + ${SOURCE_DIR}/threadx_initialize_kernel_setup_test.c + ${SOURCE_DIR}/threadx_safety_critical_test.c) add_custom_command( OUTPUT ${GENERATED_LOW_LEVEL_SOURCE} diff --git a/test/tx/regression/testcontrol.c b/test/tx/regression/testcontrol.c index bec50ee76..872f36113 100644 --- a/test/tx/regression/testcontrol.c +++ b/test/tx/regression/testcontrol.c @@ -244,6 +244,7 @@ void threadx_timer_multiple_accuracy_application_define(void *); void threadx_timer_information_application_define(void *); void threadx_trace_basic_application_define(void *); +void threadx_safety_critical_application_define(void *); void test_application_define(void *first_unused_memory); @@ -365,6 +366,7 @@ TEST_ENTRY test_control_tests[] = threadx_timer_information_application_define, threadx_trace_basic_application_define, + threadx_safety_critical_application_define, #endif TX_NULL, diff --git a/test/tx/regression/threadx_safety_critical_test.c b/test/tx/regression/threadx_safety_critical_test.c new file mode 100644 index 000000000..1d10cb93c --- /dev/null +++ b/test/tx/regression/threadx_safety_critical_test.c @@ -0,0 +1,143 @@ +/***************************************************************************/ +/* Copyright (c) 2024 Microsoft Corporation */ +/* Copyright (c) 2026 Eclipse ThreadX contributors */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the MIT License which is available at */ +/* https://opensource.org/licenses/MIT. */ +/* */ +/* SPDX-License-Identifier: MIT */ +/***************************************************************************/ + +/* This test is designed to test safety-critical build verification and + exception handling in ThreadX. */ + +#include +#include + +#ifndef TX_SAFETY_CRITICAL_BUILD_CHECK +#define TX_SAFETY_CRITICAL_BUILD_CHECK +#endif + +#ifndef TX_SAFETY_CRITICAL_EXCEPTION_ENABLE +#define TX_SAFETY_CRITICAL_EXCEPTION_ENABLE +#endif + +#include "tx_api.h" + +static unsigned long thread_0_counter = 0; +static TX_THREAD thread_0; + +static unsigned long exception_handler_invoked = 0; +static CHAR *last_exception_file = TX_NULL; +static INT last_exception_line = 0; +static UINT last_exception_status = 0; + +/* Define custom exception handler for test verification. */ +VOID _tx_safety_critical_exception_handler(CHAR *file_name, INT line_number, UINT status) +{ + exception_handler_invoked++; + last_exception_file = file_name; + last_exception_line = line_number; + last_exception_status = status; +} + +/* Prototype for test control return. */ +void test_control_return(UINT status); + +/* Define thread prototypes. */ +static void thread_0_entry(ULONG thread_input); + +/* Define what the initial system looks like. */ +#ifdef CTEST +void test_application_define(void *first_unused_memory) +#else +void threadx_safety_critical_application_define(void *first_unused_memory) +#endif +{ +UINT status; +CHAR *pointer; + + /* Put first available memory address into a character pointer. */ + pointer = (CHAR *) first_unused_memory; + + /* Create test thread. */ + status = tx_thread_create(&thread_0, "thread 0", thread_0_entry, 1, + pointer, TEST_STACK_SIZE_PRINTF, + 16, 16, 3, TX_AUTO_START); + + /* Check for status. */ + if (status != TX_SUCCESS) + { + printf("Running Safety Critical Test........................................ ERROR #1\n"); + test_control_return(1); + } +} + +/* Define the test thread. */ +static void thread_0_entry(ULONG thread_input) +{ +TX_PARAMETER_NOT_USED(thread_input); + + /* Inform user. */ + printf("Running Safety Critical Test........................................ "); + + /* Increment thread 0 counter. */ + thread_0_counter++; + + /* Verify build-time configurations are satisfied. */ +#ifndef TX_MAX_PRIORITIES + printf("ERROR #2\n"); + test_control_return(1); + return; +#else + if ((TX_MAX_PRIORITIES % 32) != 0) + { + printf("ERROR #3\n"); + test_control_return(1); + return; + } +#endif + + /* Sleep for 1 tick to verify scheduling operates normally. */ + tx_thread_sleep(1); + + /* Verify that no exception has occurred so far. */ + if (exception_handler_invoked != 0) + { + printf("ERROR #4\n"); + test_control_return(1); + return; + } + + /* Test runtime safety-critical exception trap dispatch. */ + TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0x5A5A); + + /* Verify that the exception handler was called exactly once. */ + if (exception_handler_invoked != 1) + { + printf("ERROR #5\n"); + test_control_return(1); + return; + } + + /* Verify the recorded status value. */ + if (last_exception_status != 0x5A5A) + { + printf("ERROR #6\n"); + test_control_return(1); + return; + } + + /* Verify that file name and line number were passed correctly. */ + if (last_exception_file == TX_NULL || last_exception_line == 0) + { + printf("ERROR #7\n"); + test_control_return(1); + return; + } + + /* Successful test completion. */ + printf("SUCCESS!\n"); + test_control_return(0); +} From 87501f18b5bf9edf55ee6f357e9207a9e2f6764e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Desbiens?= Date: Mon, 30 Nov 2026 12:48:53 -0500 Subject: [PATCH 2/3] Tested safety-critical configuration and kernel exceptions The regression tests enabled the new flags inside the test source and defined a handler that collided with the static kernel's handler. Older coverage probes also expected thread and timer entry routines to return. Built the three flag configurations and checked invalid options for both kernels. Exercised timer creation failure, notification, and retry through the single-core initializer. Kept probes that expect an entry routine to return in configurations with exceptions disabled. GCC 14 passed 122 single-core and 118 SMP tests in the standard builds, and 119 single-core and 118 SMP tests with static kernels and exceptions enabled. The timer initializer reached 100% line and branch coverage in all three test configurations. Cortex-M3 passed 3/3 QEMU module tests with a module-local exception handler. Assisted-by: Codex (GPT-6.2-Sol) --- test/smp/cmake/regression/CMakeLists.txt | 3 +- test/smp/regression/testcontrol.c | 6 +- .../regression/threadx_safety_critical_test.c | 143 ------------------ .../threadx_timer_activate_deactivate_test.c | 3 +- .../regression/threadx_timer_simple_test.c | 2 +- test/tx/cmake/CMakeLists.txt | 5 + test/tx/cmake/regression/CMakeLists.txt | 3 +- test/tx/cmake/safety_critical/CMakeLists.txt | 65 ++++++++ test/tx/cmake/safety_critical/configuration.c | 27 ++++ .../cmake/safety_critical/timer_initialize.c | 99 ++++++++++++ .../tx/cmake/thread_transition/CMakeLists.txt | 20 ++- test/tx/regression/testcontrol.c | 6 +- .../regression/threadx_safety_critical_test.c | 143 ------------------ .../threadx_timer_activate_deactivate_test.c | 3 +- .../tx/regression/threadx_timer_simple_test.c | 2 +- 15 files changed, 226 insertions(+), 304 deletions(-) delete mode 100644 test/smp/regression/threadx_safety_critical_test.c create mode 100644 test/tx/cmake/safety_critical/CMakeLists.txt create mode 100644 test/tx/cmake/safety_critical/configuration.c create mode 100644 test/tx/cmake/safety_critical/timer_initialize.c delete mode 100644 test/tx/regression/threadx_safety_critical_test.c diff --git a/test/smp/cmake/regression/CMakeLists.txt b/test/smp/cmake/regression/CMakeLists.txt index 75d972896..cdf0c5859 100644 --- a/test/smp/cmake/regression/CMakeLists.txt +++ b/test/smp/cmake/regression/CMakeLists.txt @@ -132,8 +132,7 @@ set(regression_test_cases ${SOURCE_DIR}/threadx_timer_simple_test.c ${SOURCE_DIR}/threadx_trace_basic_test.c ${SOURCE_DIR}/threadx_trace_entry_update_test.c - ${SOURCE_DIR}/threadx_initialize_kernel_setup_test.c - ${SOURCE_DIR}/threadx_safety_critical_test.c) + ${SOURCE_DIR}/threadx_initialize_kernel_setup_test.c) add_custom_command( OUTPUT ${GENERATED_LOW_LEVEL_SOURCE} diff --git a/test/smp/regression/testcontrol.c b/test/smp/regression/testcontrol.c index aa8c442e0..18653fa84 100644 --- a/test/smp/regression/testcontrol.c +++ b/test/smp/regression/testcontrol.c @@ -273,7 +273,6 @@ void threadx_timer_multiple_accuracy_application_define(void *); void threadx_timer_information_application_define(void *); void threadx_trace_basic_application_define(void *); -void threadx_safety_critical_application_define(void *); void threadx_smp_rebalance_exclustion_test(void *first_unused_memory); void threadx_smp_two_threads_one_core_test(void *first_unused_memory); @@ -423,7 +422,6 @@ TEST_ENTRY test_control_tests[] = threadx_timer_information_application_define, threadx_trace_basic_application_define, - threadx_safety_critical_application_define, #endif TX_NULL, @@ -547,7 +545,9 @@ void tx_application_define(void *first_unused_memory) { UCHAR *pointer; +#ifndef TX_SAFETY_CRITICAL_EXCEPTION_ENABLE VOID (*temp_mutex_release)(TX_THREAD *thread_ptr); +#endif TX_THREAD *temp_thread; UINT old_preemption; ULONG old_time_slice; @@ -740,6 +740,7 @@ TX_THREAD *thread_ptr; _tx_thread_time_slice(); _tx_thread_current_ptr[0] = TX_NULL; +#ifndef TX_SAFETY_CRITICAL_EXCEPTION_ENABLE /* Test to make sure _tx_thread_shell_entry can handle a NULL mutex release function pointer. */ temp_mutex_release = _tx_thread_mutex_release; temp_thread = _tx_thread_execute_ptr[0]; @@ -758,6 +759,7 @@ TX_THREAD *thread_ptr; _tx_thread_current_ptr[0] = TX_NULL; _tx_thread_execute_ptr[0] = temp_thread; _tx_thread_mutex_release = temp_mutex_release; /* Recover Mutex release pointer. */ +#endif /* Test _tx_thread_system_suspend when not current, preemption is needed but disabled. */ temp_thread = _tx_thread_execute_ptr[0]; diff --git a/test/smp/regression/threadx_safety_critical_test.c b/test/smp/regression/threadx_safety_critical_test.c deleted file mode 100644 index 59b3cfd60..000000000 --- a/test/smp/regression/threadx_safety_critical_test.c +++ /dev/null @@ -1,143 +0,0 @@ -/***************************************************************************/ -/* Copyright (c) 2024 Microsoft Corporation */ -/* Copyright (c) 2026 Eclipse ThreadX contributors */ -/* */ -/* This program and the accompanying materials are made available under */ -/* the terms of the MIT License which is available at */ -/* https://opensource.org/licenses/MIT. */ -/* */ -/* SPDX-License-Identifier: MIT */ -/***************************************************************************/ - -/* This test is designed to test safety-critical build verification and - exception handling in ThreadX SMP. */ - -#include -#include - -#ifndef TX_SAFETY_CRITICAL_BUILD_CHECK -#define TX_SAFETY_CRITICAL_BUILD_CHECK -#endif - -#ifndef TX_SAFETY_CRITICAL_EXCEPTION_ENABLE -#define TX_SAFETY_CRITICAL_EXCEPTION_ENABLE -#endif - -#include "tx_api.h" - -static unsigned long thread_0_counter = 0; -static TX_THREAD thread_0; - -static unsigned long exception_handler_invoked = 0; -static CHAR *last_exception_file = TX_NULL; -static INT last_exception_line = 0; -static UINT last_exception_status = 0; - -/* Define custom exception handler for test verification. */ -VOID _tx_safety_critical_exception_handler(CHAR *file_name, INT line_number, UINT status) -{ - exception_handler_invoked++; - last_exception_file = file_name; - last_exception_line = line_number; - last_exception_status = status; -} - -/* Prototype for test control return. */ -void test_control_return(UINT status); - -/* Define thread prototypes. */ -static void thread_0_entry(ULONG thread_input); - -/* Define what the initial system looks like. */ -#ifdef CTEST -void test_application_define(void *first_unused_memory) -#else -void threadx_safety_critical_application_define(void *first_unused_memory) -#endif -{ -UINT status; -CHAR *pointer; - - /* Put first available memory address into a character pointer. */ - pointer = (CHAR *) first_unused_memory; - - /* Create test thread. */ - status = tx_thread_create(&thread_0, "thread 0", thread_0_entry, 1, - pointer, TEST_STACK_SIZE_PRINTF, - 16, 16, 3, TX_AUTO_START); - - /* Check for status. */ - if (status != TX_SUCCESS) - { - printf("Running Safety Critical Test........................................ ERROR #1\n"); - test_control_return(1); - } -} - -/* Define the test thread. */ -static void thread_0_entry(ULONG thread_input) -{ -TX_PARAMETER_NOT_USED(thread_input); - - /* Inform user. */ - printf("Running Safety Critical Test........................................ "); - - /* Increment thread 0 counter. */ - thread_0_counter++; - - /* Verify build-time configurations are satisfied. */ -#ifndef TX_MAX_PRIORITIES - printf("ERROR #2\n"); - test_control_return(1); - return; -#else - if ((TX_MAX_PRIORITIES % 32) != 0) - { - printf("ERROR #3\n"); - test_control_return(1); - return; - } -#endif - - /* Sleep for 1 tick to verify scheduling operates normally. */ - tx_thread_sleep(1); - - /* Verify that no exception has occurred so far. */ - if (exception_handler_invoked != 0) - { - printf("ERROR #4\n"); - test_control_return(1); - return; - } - - /* Test runtime safety-critical exception trap dispatch. */ - TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0x5A5A); - - /* Verify that the exception handler was called exactly once. */ - if (exception_handler_invoked != 1) - { - printf("ERROR #5\n"); - test_control_return(1); - return; - } - - /* Verify the recorded status value. */ - if (last_exception_status != 0x5A5A) - { - printf("ERROR #6\n"); - test_control_return(1); - return; - } - - /* Verify that file name and line number were passed correctly. */ - if (last_exception_file == TX_NULL || last_exception_line == 0) - { - printf("ERROR #7\n"); - test_control_return(1); - return; - } - - /* Successful test completion. */ - printf("SUCCESS!\n"); - test_control_return(0); -} diff --git a/test/smp/regression/threadx_timer_activate_deactivate_test.c b/test/smp/regression/threadx_timer_activate_deactivate_test.c index ceaf79bf7..66044ed94 100644 --- a/test/smp/regression/threadx_timer_activate_deactivate_test.c +++ b/test/smp/regression/threadx_timer_activate_deactivate_test.c @@ -8,6 +8,7 @@ /* */ /* SPDX-License-Identifier: MIT */ /***************************************************************************/ +// Portions of this file were generated with AI assistance. /* This test is designed to test application timer activation/deactivation services from threads and the activation routines. */ @@ -96,7 +97,7 @@ TX_TIMER_INTERNAL **current_list_head; /* Inform user. */ printf("Running Timer Activate/Deactivate Test.............................. "); -#ifndef TX_TIMER_PROCESS_IN_ISR +#if !defined(TX_TIMER_PROCESS_IN_ISR) && !defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) /* Call the timer thread entry function with an invalid value to make sure the code simply returns. */ _tx_timer_thread_entry(0); diff --git a/test/smp/regression/threadx_timer_simple_test.c b/test/smp/regression/threadx_timer_simple_test.c index 5abd1d3c9..a54023ad2 100644 --- a/test/smp/regression/threadx_timer_simple_test.c +++ b/test/smp/regression/threadx_timer_simple_test.c @@ -221,7 +221,7 @@ CHAR *pointer; test_control_return(1); } -#ifndef TX_TIMER_PROCESS_IN_ISR +#if !defined(TX_TIMER_PROCESS_IN_ISR) && !defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) /* Call the timer thread entry function with a bad ID to test another path. */ _tx_timer_thread_entry(0); diff --git a/test/tx/cmake/CMakeLists.txt b/test/tx/cmake/CMakeLists.txt index 7ed620d9c..c6c8eb1e2 100644 --- a/test/tx/cmake/CMakeLists.txt +++ b/test/tx/cmake/CMakeLists.txt @@ -114,6 +114,11 @@ if(NOT ("TX_MISRA_ENABLE" IN_LIST ${CMAKE_BUILD_TYPE})) add_subdirectory(module_manager) endif() +# The safety-critical tests build both kernels' configurations independently. +if(THREADX_ARCH STREQUAL "linux" AND CMAKE_BUILD_TYPE STREQUAL "default_build_coverage") + add_subdirectory(safety_critical) +endif() + # Coverage # # The gate here used to be the build type alone, and only one of the five diff --git a/test/tx/cmake/regression/CMakeLists.txt b/test/tx/cmake/regression/CMakeLists.txt index 57193094a..6b94a8576 100644 --- a/test/tx/cmake/regression/CMakeLists.txt +++ b/test/tx/cmake/regression/CMakeLists.txt @@ -113,8 +113,7 @@ set(regression_test_cases ${SOURCE_DIR}/threadx_timer_simple_test.c ${SOURCE_DIR}/threadx_trace_basic_test.c ${SOURCE_DIR}/threadx_trace_entry_update_test.c - ${SOURCE_DIR}/threadx_initialize_kernel_setup_test.c - ${SOURCE_DIR}/threadx_safety_critical_test.c) + ${SOURCE_DIR}/threadx_initialize_kernel_setup_test.c) add_custom_command( OUTPUT ${GENERATED_LOW_LEVEL_SOURCE} diff --git a/test/tx/cmake/safety_critical/CMakeLists.txt b/test/tx/cmake/safety_critical/CMakeLists.txt new file mode 100644 index 000000000..5943455bd --- /dev/null +++ b/test/tx/cmake/safety_critical/CMakeLists.txt @@ -0,0 +1,65 @@ +# Copyright (c) 2026 Eclipse ThreadX contributors +# SPDX-License-Identifier: MIT +# Portions of this file were generated with AI assistance. + +set(repository ${CMAKE_CURRENT_LIST_DIR}/../../../..) +set(common_includes ${repository}/common/inc ${repository}/ports/linux/gnu/inc) +set(common_smp_includes ${repository}/common_smp/inc ${repository}/ports_smp/linux/gnu/inc) + +# Each target supplies its own safety options and uses the normal timer creation path. +add_compile_options(-UTX_REGRESSION_TEST + -UTX_SAFETY_CRITICAL + -UTX_SAFETY_CRITICAL_BUILD_CHECK + -UTX_SAFETY_CRITICAL_EXCEPTION_ENABLE) + +function(add_safety_critical_configuration name option build_check exceptions) + if(build_check) + set(profile_options -DTX_ENABLE_STACK_CHECKING + -DTX_ENABLE_EVENT_TRACE + -DTX_DISABLE_NOTIFY_CALLBACKS) + else() + set(profile_options -DTX_DISABLE_ERROR_CHECKING) + endif() + + # Compile the real kernel entry point, including its default handler where enabled. + foreach(kernel IN ITEMS common common_smp) + set(target safety_critical_${name}_${kernel}) + add_library(${target} OBJECT + configuration.c + ${repository}/${kernel}/src/tx_initialize_kernel_enter.c) + target_include_directories(${target} PRIVATE ${${kernel}_includes}) + target_compile_options(${target} PRIVATE -D${option} ${profile_options} -Werror=unused-parameter) + target_compile_definitions(${target} PRIVATE EXPECT_BUILD_CHECK=${build_check} + EXPECT_EXCEPTIONS=${exceptions}) + endforeach() + + # The single-core timer initializer has an error return to check and can retry + # if the application-supplied handler returns. + set(target safety_critical_${name}_timer) + add_executable(${target} timer_initialize.c ${repository}/common/src/tx_timer_initialize.c) + target_include_directories(${target} PRIVATE ${common_includes}) + target_compile_options(${target} PRIVATE -D${option}) + target_compile_definitions(${target} PRIVATE EXPECT_EXCEPTIONS=${exceptions}) + add_test(NAME ${target} COMMAND ${target}) + set_tests_properties(${target} PROPERTIES TIMEOUT 5) +endfunction() + +add_safety_critical_configuration(checks_only TX_SAFETY_CRITICAL_BUILD_CHECK 1 0) +add_safety_critical_configuration(exceptions_only TX_SAFETY_CRITICAL_EXCEPTION_ENABLE 0 1) +add_safety_critical_configuration(legacy TX_SAFETY_CRITICAL 1 1) + +# Check that the header rejects disabled error checking for each guarded configuration. +set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) +foreach(kernel IN ITEMS common common_smp) + foreach(option IN ITEMS TX_SAFETY_CRITICAL_BUILD_CHECK TX_SAFETY_CRITICAL) + try_compile(accepted "${CMAKE_CURRENT_BINARY_DIR}/${kernel}-${option}" + "${CMAKE_CURRENT_LIST_DIR}/configuration.c" + CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${${kernel}_includes}" + COMPILE_DEFINITIONS -D${option} -DTX_DISABLE_ERROR_CHECKING + OUTPUT_VARIABLE diagnostic) + if(accepted OR NOT diagnostic MATCHES "TX_DISABLE_ERROR_CHECKING must not be defined") + message(FATAL_ERROR "${kernel}: ${option} must reject TX_DISABLE_ERROR_CHECKING\n${diagnostic}") + endif() + unset(accepted CACHE) + endforeach() +endforeach() diff --git a/test/tx/cmake/safety_critical/configuration.c b/test/tx/cmake/safety_critical/configuration.c new file mode 100644 index 000000000..e219ce502 --- /dev/null +++ b/test/tx/cmake/safety_critical/configuration.c @@ -0,0 +1,27 @@ +/*************************************************************************** + * Copyright (c) 2026 Eclipse ThreadX contributors + * + * This program and the accompanying materials are made available under the + * terms of the MIT License which is available at + * https://opensource.org/licenses/MIT. + * + * AI Disclosure: This file was largely AI-generated by Codex (GPT-6.2-Sol). + * The AI-generated portions may be considered public domain (CC0-1.0) + * and not subject to the project's licence. The human contributor has + * reviewed and verified that the code is correct. + * + * SPDX-License-Identifier: MIT and CC0-1.0 + **************************************************************************/ + +#include "tx_api.h" + +#ifdef EXPECT_BUILD_CHECK +#if defined(TX_SAFETY_CRITICAL_BUILD_CHECK) != EXPECT_BUILD_CHECK +#error "Unexpected safety-critical build-check setting." +#endif + +#if (defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) != EXPECT_EXCEPTIONS) || \ + (defined(TX_SAFETY_CRITICAL_EXCEPTION) != EXPECT_EXCEPTIONS) +#error "Unexpected safety-critical exception setting." +#endif +#endif diff --git a/test/tx/cmake/safety_critical/timer_initialize.c b/test/tx/cmake/safety_critical/timer_initialize.c new file mode 100644 index 000000000..23cf83999 --- /dev/null +++ b/test/tx/cmake/safety_critical/timer_initialize.c @@ -0,0 +1,99 @@ +/*************************************************************************** + * Copyright (c) 2026 Eclipse ThreadX contributors + * + * This program and the accompanying materials are made available under the + * terms of the MIT License which is available at + * https://opensource.org/licenses/MIT. + * + * AI Disclosure: This file was largely AI-generated by Codex (GPT-6.2-Sol). + * The AI-generated portions may be considered public domain (CC0-1.0) + * and not subject to the project's licence. The human contributor has + * reviewed and verified that the code is correct. + * + * SPDX-License-Identifier: MIT and CC0-1.0 + **************************************************************************/ + +/* MISRA C:2023 Rule 21.6 deviation: stderr identifies failed host assertions. */ + +#include +#include +#include + +#include "tx_api.h" +#include "tx_timer.h" + +static UINT create_status; +static UINT create_attempts; +static UINT exception_count; +static UINT exception_status; +static UINT timer_location_reported; + +/* Record the exception reported by the kernel timer initializer. */ +VOID _tx_safety_critical_exception_handler(CHAR *file_name, INT line_number, UINT status) +{ + exception_count++; + exception_status = status; + timer_location_reported = ((file_name != TX_NULL) && (line_number > 0) && + (strstr(file_name, "tx_timer_initialize.c") != TX_NULL)) ? TX_TRUE : TX_FALSE; +} + +/* Simulate one failed timer-thread creation and allow the next attempt. */ +UINT _tx_thread_create(TX_THREAD *thread_ptr, TX_NAME_CONST CHAR *name_ptr, + VOID (*entry_function)(ULONG), ULONG entry_input, + VOID *stack_start, ULONG stack_size, UINT priority, UINT preempt_threshold, + ULONG time_slice, UINT auto_start) +{ +UINT status = create_status; + + TX_PARAMETER_NOT_USED(thread_ptr); + TX_PARAMETER_NOT_USED(name_ptr); + TX_PARAMETER_NOT_USED(entry_function); + TX_PARAMETER_NOT_USED(entry_input); + TX_PARAMETER_NOT_USED(stack_start); + TX_PARAMETER_NOT_USED(stack_size); + TX_PARAMETER_NOT_USED(priority); + TX_PARAMETER_NOT_USED(preempt_threshold); + TX_PARAMETER_NOT_USED(time_slice); + TX_PARAMETER_NOT_USED(auto_start); + + create_status = TX_SUCCESS; + create_attempts++; + return(status); +} + +/* Supply the entry address that the timer initializer passes to thread creation. */ +VOID _tx_timer_thread_entry(ULONG timer_thread_input) +{ + TX_PARAMETER_NOT_USED(timer_thread_input); +} + +/* A failed creation is retried, with a notification in exception-enabled builds. */ +int main(void) +{ +const UINT expected_exceptions = (UINT) EXPECT_EXCEPTIONS; +int result = EXIT_SUCCESS; + + _tx_timer_initialize(); + if ((create_attempts != 1U) || (exception_count != 0U)) + { + (void) fprintf(stderr, "Normal timer initialization failed.\n"); + result = EXIT_FAILURE; + } + + create_status = TX_THREAD_ERROR; + _tx_timer_initialize(); + if (create_attempts != 3U) + { + (void) fprintf(stderr, "Timer initialization did not retry after failure.\n"); + result = EXIT_FAILURE; + } + + if ((exception_count != expected_exceptions) || + ((expected_exceptions != 0U) && ((exception_status != TX_THREAD_ERROR) || (timer_location_reported == TX_FALSE)))) + { + (void) fprintf(stderr, "Unexpected timer initialization exception.\n"); + result = EXIT_FAILURE; + } + + return(result); +} diff --git a/test/tx/cmake/thread_transition/CMakeLists.txt b/test/tx/cmake/thread_transition/CMakeLists.txt index 342ca839c..cd3eeeeab 100644 --- a/test/tx/cmake/thread_transition/CMakeLists.txt +++ b/test/tx/cmake/thread_transition/CMakeLists.txt @@ -62,12 +62,18 @@ if(MSVC) set(transition_kernel_compile_options "/FI${SOURCE_DIR}/threadx_thread_transition_host_test_port.h") set(transition_undefine_options /UTX_ENABLE_EVENT_TRACE - /UTX_ENABLE_EVENT_LOG) + /UTX_ENABLE_EVENT_LOG + /UTX_SAFETY_CRITICAL + /UTX_SAFETY_CRITICAL_BUILD_CHECK + /UTX_SAFETY_CRITICAL_EXCEPTION_ENABLE) else() set(transition_kernel_compile_options "-include;${SOURCE_DIR}/threadx_thread_transition_host_test_port.h") set(transition_undefine_options -UTX_ENABLE_EVENT_TRACE - -UTX_ENABLE_EVENT_LOG) + -UTX_ENABLE_EVENT_LOG + -UTX_SAFETY_CRITICAL + -UTX_SAFETY_CRITICAL_BUILD_CHECK + -UTX_SAFETY_CRITICAL_EXCEPTION_ENABLE) endif() set_source_files_properties( @@ -111,8 +117,8 @@ foreach(configuration ${transition_configurations}) # This directory is configured once per build configuration of the tree, so # these executables inherit whichever feature macros that configuration sets -- # which is useful, since it means the two configurations above are also seen in - # combination with stack checking and with the other four. The one that cannot - # be inherited is event tracing: the trace macros in these sources reference the + # combination with stack checking and with the other four. Event tracing + # cannot be inherited: the trace macros in these sources reference the # trace component's buffer and registry, and this harness links four kernel # sources rather than the library, so the references would not resolve. The # trace insertions in these same sources are covered by the tree's own @@ -120,8 +126,12 @@ foreach(configuration ${transition_configurations}) # lost by turning tracing off here. Event logging is turned off for the same # reason; no configuration of the tree enables it. # + # Safety-critical build checks reject options these tests exercise. The + # kernel entry point that defines the exception handler is also outside + # this harness. + # # The undefine options have to reach the test source as well as the kernel sources, - # because TX_ENABLE_EVENT_TRACE is visible to tx_api.h and the two must agree on + # because these macros are visible to tx_api.h and the two must agree on # what the headers declare. Target compile options land after the directory's # definition flags on the command line, which is what makes them effective. target_compile_options(${test_target} PRIVATE ${transition_undefine_options}) diff --git a/test/tx/regression/testcontrol.c b/test/tx/regression/testcontrol.c index 872f36113..9b54f5dc7 100644 --- a/test/tx/regression/testcontrol.c +++ b/test/tx/regression/testcontrol.c @@ -244,7 +244,6 @@ void threadx_timer_multiple_accuracy_application_define(void *); void threadx_timer_information_application_define(void *); void threadx_trace_basic_application_define(void *); -void threadx_safety_critical_application_define(void *); void test_application_define(void *first_unused_memory); @@ -366,7 +365,6 @@ TEST_ENTRY test_control_tests[] = threadx_timer_information_application_define, threadx_trace_basic_application_define, - threadx_safety_critical_application_define, #endif TX_NULL, @@ -490,7 +488,9 @@ void tx_application_define(void *first_unused_memory) { UCHAR *pointer; +#if !defined(TX_DISABLE_NOTIFY_CALLBACKS) && !defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) VOID (*temp_mutex_release)(TX_THREAD *thread_ptr); +#endif TX_THREAD *temp_thread; UINT old_preemption; UINT status; @@ -609,7 +609,7 @@ TX_THREAD *thread_ptr; init_test_thread.tx_thread_ready_previous = &init_test_thread; _tx_thread_time_slice(); _tx_thread_current_ptr = TX_NULL; -#ifndef TX_DISABLE_NOTIFY_CALLBACKS +#if !defined(TX_DISABLE_NOTIFY_CALLBACKS) && !defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) /* Test to make sure _tx_thread_shell_entry can handle a NULL mutex release function pointer. */ temp_mutex_release = _tx_thread_mutex_release; temp_thread = _tx_thread_execute_ptr; diff --git a/test/tx/regression/threadx_safety_critical_test.c b/test/tx/regression/threadx_safety_critical_test.c deleted file mode 100644 index 1d10cb93c..000000000 --- a/test/tx/regression/threadx_safety_critical_test.c +++ /dev/null @@ -1,143 +0,0 @@ -/***************************************************************************/ -/* Copyright (c) 2024 Microsoft Corporation */ -/* Copyright (c) 2026 Eclipse ThreadX contributors */ -/* */ -/* This program and the accompanying materials are made available under */ -/* the terms of the MIT License which is available at */ -/* https://opensource.org/licenses/MIT. */ -/* */ -/* SPDX-License-Identifier: MIT */ -/***************************************************************************/ - -/* This test is designed to test safety-critical build verification and - exception handling in ThreadX. */ - -#include -#include - -#ifndef TX_SAFETY_CRITICAL_BUILD_CHECK -#define TX_SAFETY_CRITICAL_BUILD_CHECK -#endif - -#ifndef TX_SAFETY_CRITICAL_EXCEPTION_ENABLE -#define TX_SAFETY_CRITICAL_EXCEPTION_ENABLE -#endif - -#include "tx_api.h" - -static unsigned long thread_0_counter = 0; -static TX_THREAD thread_0; - -static unsigned long exception_handler_invoked = 0; -static CHAR *last_exception_file = TX_NULL; -static INT last_exception_line = 0; -static UINT last_exception_status = 0; - -/* Define custom exception handler for test verification. */ -VOID _tx_safety_critical_exception_handler(CHAR *file_name, INT line_number, UINT status) -{ - exception_handler_invoked++; - last_exception_file = file_name; - last_exception_line = line_number; - last_exception_status = status; -} - -/* Prototype for test control return. */ -void test_control_return(UINT status); - -/* Define thread prototypes. */ -static void thread_0_entry(ULONG thread_input); - -/* Define what the initial system looks like. */ -#ifdef CTEST -void test_application_define(void *first_unused_memory) -#else -void threadx_safety_critical_application_define(void *first_unused_memory) -#endif -{ -UINT status; -CHAR *pointer; - - /* Put first available memory address into a character pointer. */ - pointer = (CHAR *) first_unused_memory; - - /* Create test thread. */ - status = tx_thread_create(&thread_0, "thread 0", thread_0_entry, 1, - pointer, TEST_STACK_SIZE_PRINTF, - 16, 16, 3, TX_AUTO_START); - - /* Check for status. */ - if (status != TX_SUCCESS) - { - printf("Running Safety Critical Test........................................ ERROR #1\n"); - test_control_return(1); - } -} - -/* Define the test thread. */ -static void thread_0_entry(ULONG thread_input) -{ -TX_PARAMETER_NOT_USED(thread_input); - - /* Inform user. */ - printf("Running Safety Critical Test........................................ "); - - /* Increment thread 0 counter. */ - thread_0_counter++; - - /* Verify build-time configurations are satisfied. */ -#ifndef TX_MAX_PRIORITIES - printf("ERROR #2\n"); - test_control_return(1); - return; -#else - if ((TX_MAX_PRIORITIES % 32) != 0) - { - printf("ERROR #3\n"); - test_control_return(1); - return; - } -#endif - - /* Sleep for 1 tick to verify scheduling operates normally. */ - tx_thread_sleep(1); - - /* Verify that no exception has occurred so far. */ - if (exception_handler_invoked != 0) - { - printf("ERROR #4\n"); - test_control_return(1); - return; - } - - /* Test runtime safety-critical exception trap dispatch. */ - TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0x5A5A); - - /* Verify that the exception handler was called exactly once. */ - if (exception_handler_invoked != 1) - { - printf("ERROR #5\n"); - test_control_return(1); - return; - } - - /* Verify the recorded status value. */ - if (last_exception_status != 0x5A5A) - { - printf("ERROR #6\n"); - test_control_return(1); - return; - } - - /* Verify that file name and line number were passed correctly. */ - if (last_exception_file == TX_NULL || last_exception_line == 0) - { - printf("ERROR #7\n"); - test_control_return(1); - return; - } - - /* Successful test completion. */ - printf("SUCCESS!\n"); - test_control_return(0); -} diff --git a/test/tx/regression/threadx_timer_activate_deactivate_test.c b/test/tx/regression/threadx_timer_activate_deactivate_test.c index ceaf79bf7..66044ed94 100644 --- a/test/tx/regression/threadx_timer_activate_deactivate_test.c +++ b/test/tx/regression/threadx_timer_activate_deactivate_test.c @@ -8,6 +8,7 @@ /* */ /* SPDX-License-Identifier: MIT */ /***************************************************************************/ +// Portions of this file were generated with AI assistance. /* This test is designed to test application timer activation/deactivation services from threads and the activation routines. */ @@ -96,7 +97,7 @@ TX_TIMER_INTERNAL **current_list_head; /* Inform user. */ printf("Running Timer Activate/Deactivate Test.............................. "); -#ifndef TX_TIMER_PROCESS_IN_ISR +#if !defined(TX_TIMER_PROCESS_IN_ISR) && !defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) /* Call the timer thread entry function with an invalid value to make sure the code simply returns. */ _tx_timer_thread_entry(0); diff --git a/test/tx/regression/threadx_timer_simple_test.c b/test/tx/regression/threadx_timer_simple_test.c index f9c93ee42..d81930e20 100644 --- a/test/tx/regression/threadx_timer_simple_test.c +++ b/test/tx/regression/threadx_timer_simple_test.c @@ -221,7 +221,7 @@ CHAR *pointer; test_control_return(1); } -#ifndef TX_TIMER_PROCESS_IN_ISR +#if !defined(TX_TIMER_PROCESS_IN_ISR) && !defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) /* Call the timer thread entry function with a bad ID to test another path. */ _tx_timer_thread_entry(0); From d023374948e46bfb551d19bf7771f034db584ed2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Desbiens?= Date: Mon, 30 Nov 2026 12:59:10 -0500 Subject: [PATCH 3/3] Covered safety-critical halts and retained legacy return traps The new exception flag enabled traps on kernel paths that cannot return by design. The regression tests also left both default handlers untested. Keep the return traps under the legacy flag. The new flag exposes the exception hook in both kernels and reports single-core timer-thread creation failure. Exercise the real default handlers in Linux tests. GCC 14 covered every executable line in both default handlers and every line and conditional branch in the single-core timer initializer across the three profiles. The Linux suites passed 124 single-core and 118 SMP tests in the standard builds, and 119 single-core and 118 SMP tests in each exceptions-only and legacy build. Cortex-M3 QEMU passed 3/3 module tests in each of the two exception profiles. Assisted-by: Codex (GPT-6.2-Sol) --- common/src/tx_initialize_kernel_enter.c | 3 +- common/src/tx_thread_shell_entry.c | 2 +- common/src/tx_timer_thread_entry.c | 2 +- common_smp/src/tx_initialize_kernel_enter.c | 3 +- common_smp/src/tx_thread_shell_entry.c | 2 +- common_smp/src/tx_timer_thread_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- .../src/txm_module_thread_shell_entry.c | 2 +- test/smp/regression/testcontrol.c | 4 +- .../threadx_timer_activate_deactivate_test.c | 2 +- .../regression/threadx_timer_simple_test.c | 2 +- test/tx/cmake/safety_critical/CMakeLists.txt | 16 ++++++- .../cmake/safety_critical/default_exception.c | 46 +++++++++++++++++++ .../tx/cmake/thread_transition/CMakeLists.txt | 6 +-- test/tx/regression/testcontrol.c | 4 +- .../threadx_timer_activate_deactivate_test.c | 2 +- .../tx/regression/threadx_timer_simple_test.c | 2 +- 51 files changed, 115 insertions(+), 55 deletions(-) create mode 100644 test/tx/cmake/safety_critical/default_exception.c diff --git a/common/src/tx_initialize_kernel_enter.c b/common/src/tx_initialize_kernel_enter.c index e16192d1a..494c8632c 100644 --- a/common/src/tx_initialize_kernel_enter.c +++ b/common/src/tx_initialize_kernel_enter.c @@ -8,6 +8,7 @@ * * SPDX-License-Identifier: MIT **************************************************************************/ +// Portions of this file were generated with AI assistance. /**************************************************************************/ @@ -147,7 +148,7 @@ VOID _tx_initialize_kernel_enter(VOID) /* Enter the scheduling loop to start executing threads! */ _tx_thread_schedule(); -#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) +#ifdef TX_SAFETY_CRITICAL /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/common/src/tx_thread_shell_entry.c b/common/src/tx_thread_shell_entry.c index 3d61f9d88..2a16a00b6 100644 --- a/common/src/tx_thread_shell_entry.c +++ b/common/src/tx_thread_shell_entry.c @@ -208,7 +208,7 @@ VOID (*entry_exit_notify)(TX_THREAD *notify_thread_ptr, UINT type); #endif -#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) +#ifdef TX_SAFETY_CRITICAL /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/common/src/tx_timer_thread_entry.c b/common/src/tx_timer_thread_entry.c index bb9912400..971a0703f 100644 --- a/common/src/tx_timer_thread_entry.c +++ b/common/src/tx_timer_thread_entry.c @@ -463,7 +463,7 @@ TX_TIMER *timer_ptr; } } -#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) +#ifdef TX_SAFETY_CRITICAL /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/common_smp/src/tx_initialize_kernel_enter.c b/common_smp/src/tx_initialize_kernel_enter.c index 5fe32b629..6ab6576ab 100644 --- a/common_smp/src/tx_initialize_kernel_enter.c +++ b/common_smp/src/tx_initialize_kernel_enter.c @@ -8,6 +8,7 @@ * * SPDX-License-Identifier: MIT **************************************************************************/ +// Portions of this file were generated with AI assistance. /**************************************************************************/ @@ -176,7 +177,7 @@ ULONG other_core_status, i; /* Enter the scheduling loop to start executing threads! */ _tx_thread_schedule(); -#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) +#ifdef TX_SAFETY_CRITICAL /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/common_smp/src/tx_thread_shell_entry.c b/common_smp/src/tx_thread_shell_entry.c index 3d61f9d88..2a16a00b6 100644 --- a/common_smp/src/tx_thread_shell_entry.c +++ b/common_smp/src/tx_thread_shell_entry.c @@ -208,7 +208,7 @@ VOID (*entry_exit_notify)(TX_THREAD *notify_thread_ptr, UINT type); #endif -#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) +#ifdef TX_SAFETY_CRITICAL /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/common_smp/src/tx_timer_thread_entry.c b/common_smp/src/tx_timer_thread_entry.c index 85433a27d..51b165b23 100644 --- a/common_smp/src/tx_timer_thread_entry.c +++ b/common_smp/src/tx_timer_thread_entry.c @@ -530,7 +530,7 @@ UINT status; } } -#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) +#ifdef TX_SAFETY_CRITICAL /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_arch/ARMv7-M/threadx_modules/ac5/module_lib/src/txm_module_thread_shell_entry.c b/ports_arch/ARMv7-M/threadx_modules/ac5/module_lib/src/txm_module_thread_shell_entry.c index 230950141..0e46caea5 100644 --- a/ports_arch/ARMv7-M/threadx_modules/ac5/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_arch/ARMv7-M/threadx_modules/ac5/module_lib/src/txm_module_thread_shell_entry.c @@ -160,7 +160,7 @@ VOID _txm_module_thread_shell_entry(TX_THREAD *thread_ptr, TXM_MODULE_THREAD_EN /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) +#ifdef TX_SAFETY_CRITICAL /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_arch/ARMv7-M/threadx_modules/ac6/module_lib/src/txm_module_thread_shell_entry.c b/ports_arch/ARMv7-M/threadx_modules/ac6/module_lib/src/txm_module_thread_shell_entry.c index c32b4f928..cd286c2dc 100644 --- a/ports_arch/ARMv7-M/threadx_modules/ac6/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_arch/ARMv7-M/threadx_modules/ac6/module_lib/src/txm_module_thread_shell_entry.c @@ -161,7 +161,7 @@ VOID _txm_module_thread_shell_entry(TX_THREAD *thread_ptr, TXM_MODULE_THREAD_EN /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) +#ifdef TX_SAFETY_CRITICAL /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_arch/ARMv7-M/threadx_modules/gnu/module_lib/src/txm_module_thread_shell_entry.c b/ports_arch/ARMv7-M/threadx_modules/gnu/module_lib/src/txm_module_thread_shell_entry.c index 7bae2e7d9..01f2f9093 100644 --- a/ports_arch/ARMv7-M/threadx_modules/gnu/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_arch/ARMv7-M/threadx_modules/gnu/module_lib/src/txm_module_thread_shell_entry.c @@ -159,7 +159,7 @@ VOID _txm_module_thread_shell_entry(TX_THREAD *thread_ptr, TXM_MODULE_THREAD_EN /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) +#ifdef TX_SAFETY_CRITICAL /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_arch/ARMv7-M/threadx_modules/iar/module_lib/src/txm_module_thread_shell_entry.c b/ports_arch/ARMv7-M/threadx_modules/iar/module_lib/src/txm_module_thread_shell_entry.c index 188f58b79..0f892ce5f 100644 --- a/ports_arch/ARMv7-M/threadx_modules/iar/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_arch/ARMv7-M/threadx_modules/iar/module_lib/src/txm_module_thread_shell_entry.c @@ -159,7 +159,7 @@ VOID _txm_module_thread_shell_entry(TX_THREAD *thread_ptr, TXM_MODULE_THREAD_EN /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) +#ifdef TX_SAFETY_CRITICAL /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_module/cortex_a35/ac6/module_lib/src/txm_module_thread_shell_entry.c b/ports_module/cortex_a35/ac6/module_lib/src/txm_module_thread_shell_entry.c index 690c9a966..adf4163f7 100644 --- a/ports_module/cortex_a35/ac6/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_module/cortex_a35/ac6/module_lib/src/txm_module_thread_shell_entry.c @@ -165,7 +165,7 @@ VOID (*entry_exit_notify)(TX_THREAD *notify_thread_ptr, UINT type); /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) +#ifdef TX_SAFETY_CRITICAL /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_module/cortex_a35/gnu/module_lib/src/txm_module_thread_shell_entry.c b/ports_module/cortex_a35/gnu/module_lib/src/txm_module_thread_shell_entry.c index 602ea5cbc..922b9306f 100644 --- a/ports_module/cortex_a35/gnu/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_module/cortex_a35/gnu/module_lib/src/txm_module_thread_shell_entry.c @@ -165,7 +165,7 @@ VOID (*entry_exit_notify)(TX_THREAD *notify_thread_ptr, UINT type); /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) +#ifdef TX_SAFETY_CRITICAL /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_module/cortex_a35_smp/ac6/module_lib/src/txm_module_thread_shell_entry.c b/ports_module/cortex_a35_smp/ac6/module_lib/src/txm_module_thread_shell_entry.c index 1f88d27e1..4559ac0ea 100644 --- a/ports_module/cortex_a35_smp/ac6/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_module/cortex_a35_smp/ac6/module_lib/src/txm_module_thread_shell_entry.c @@ -157,7 +157,7 @@ VOID (*entry_exit_notify)(TX_THREAD *notify_thread_ptr, UINT type); /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) +#ifdef TX_SAFETY_CRITICAL /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_module/cortex_a35_smp/gnu/module_lib/src/txm_module_thread_shell_entry.c b/ports_module/cortex_a35_smp/gnu/module_lib/src/txm_module_thread_shell_entry.c index 29b8aceb4..ba56d9e3d 100644 --- a/ports_module/cortex_a35_smp/gnu/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_module/cortex_a35_smp/gnu/module_lib/src/txm_module_thread_shell_entry.c @@ -157,7 +157,7 @@ VOID (*entry_exit_notify)(TX_THREAD *notify_thread_ptr, UINT type); /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) +#ifdef TX_SAFETY_CRITICAL /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_module/cortex_a7/ac5/module_lib/src/txm_module_thread_shell_entry.c b/ports_module/cortex_a7/ac5/module_lib/src/txm_module_thread_shell_entry.c index 78c26c654..4925fe47b 100644 --- a/ports_module/cortex_a7/ac5/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_module/cortex_a7/ac5/module_lib/src/txm_module_thread_shell_entry.c @@ -160,7 +160,7 @@ VOID _txm_module_thread_shell_entry(TX_THREAD *thread_ptr, TXM_MODULE_THREAD_EN /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) +#ifdef TX_SAFETY_CRITICAL /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_module/cortex_a7/gnu/module_lib/src/txm_module_thread_shell_entry.c b/ports_module/cortex_a7/gnu/module_lib/src/txm_module_thread_shell_entry.c index 7d89ff456..73a38340d 100644 --- a/ports_module/cortex_a7/gnu/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_module/cortex_a7/gnu/module_lib/src/txm_module_thread_shell_entry.c @@ -166,7 +166,7 @@ VOID (*entry_exit_notify)(TX_THREAD *, UINT); /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) +#ifdef TX_SAFETY_CRITICAL /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_module/cortex_a7/iar/module_lib/src/txm_module_thread_shell_entry.c b/ports_module/cortex_a7/iar/module_lib/src/txm_module_thread_shell_entry.c index 5e0cc5419..cfe18ef19 100644 --- a/ports_module/cortex_a7/iar/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_module/cortex_a7/iar/module_lib/src/txm_module_thread_shell_entry.c @@ -161,7 +161,7 @@ VOID _txm_module_thread_shell_entry(TX_THREAD *thread_ptr, TXM_MODULE_THREAD_EN /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) +#ifdef TX_SAFETY_CRITICAL /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_module/cortex_m0+/ac6/module_lib/src/txm_module_thread_shell_entry.c b/ports_module/cortex_m0+/ac6/module_lib/src/txm_module_thread_shell_entry.c index d2e489234..13f57b8de 100644 --- a/ports_module/cortex_m0+/ac6/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_module/cortex_m0+/ac6/module_lib/src/txm_module_thread_shell_entry.c @@ -159,7 +159,7 @@ VOID _txm_module_thread_shell_entry(TX_THREAD *thread_ptr, TXM_MODULE_THREAD_EN /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) +#ifdef TX_SAFETY_CRITICAL /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_module/cortex_m0+/gnu/module_lib/src/txm_module_thread_shell_entry.c b/ports_module/cortex_m0+/gnu/module_lib/src/txm_module_thread_shell_entry.c index ba18c8d16..2bb3bf7eb 100644 --- a/ports_module/cortex_m0+/gnu/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_module/cortex_m0+/gnu/module_lib/src/txm_module_thread_shell_entry.c @@ -159,7 +159,7 @@ VOID _txm_module_thread_shell_entry(TX_THREAD *thread_ptr, TXM_MODULE_THREAD_EN /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) +#ifdef TX_SAFETY_CRITICAL /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_module/cortex_m0+/iar/module_lib/src/txm_module_thread_shell_entry.c b/ports_module/cortex_m0+/iar/module_lib/src/txm_module_thread_shell_entry.c index a545d2b80..8983b8329 100644 --- a/ports_module/cortex_m0+/iar/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_module/cortex_m0+/iar/module_lib/src/txm_module_thread_shell_entry.c @@ -159,7 +159,7 @@ VOID _txm_module_thread_shell_entry(TX_THREAD *thread_ptr, TXM_MODULE_THREAD_EN /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) +#ifdef TX_SAFETY_CRITICAL /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_module/cortex_m23/ac6/module_lib/src/txm_module_thread_shell_entry.c b/ports_module/cortex_m23/ac6/module_lib/src/txm_module_thread_shell_entry.c index 55975ed07..0be91d63c 100644 --- a/ports_module/cortex_m23/ac6/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_module/cortex_m23/ac6/module_lib/src/txm_module_thread_shell_entry.c @@ -161,7 +161,7 @@ VOID _txm_module_thread_shell_entry(TX_THREAD *thread_ptr, TXM_MODULE_THREAD_EN /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) +#ifdef TX_SAFETY_CRITICAL /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_module/cortex_m23/gnu/module_lib/src/txm_module_thread_shell_entry.c b/ports_module/cortex_m23/gnu/module_lib/src/txm_module_thread_shell_entry.c index a78ae20e3..b4e753782 100644 --- a/ports_module/cortex_m23/gnu/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_module/cortex_m23/gnu/module_lib/src/txm_module_thread_shell_entry.c @@ -159,7 +159,7 @@ VOID _txm_module_thread_shell_entry(TX_THREAD *thread_ptr, TXM_MODULE_THREAD_EN /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) +#ifdef TX_SAFETY_CRITICAL /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_module/cortex_m23/iar/module_lib/src/txm_module_thread_shell_entry.c b/ports_module/cortex_m23/iar/module_lib/src/txm_module_thread_shell_entry.c index 2ab9fdc7f..1bcfe689b 100644 --- a/ports_module/cortex_m23/iar/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_module/cortex_m23/iar/module_lib/src/txm_module_thread_shell_entry.c @@ -159,7 +159,7 @@ VOID _txm_module_thread_shell_entry(TX_THREAD *thread_ptr, TXM_MODULE_THREAD_EN /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) +#ifdef TX_SAFETY_CRITICAL /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_module/cortex_m3/ac5/module_lib/src/txm_module_thread_shell_entry.c b/ports_module/cortex_m3/ac5/module_lib/src/txm_module_thread_shell_entry.c index 8833ff0df..b1e803f9d 100644 --- a/ports_module/cortex_m3/ac5/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_module/cortex_m3/ac5/module_lib/src/txm_module_thread_shell_entry.c @@ -160,7 +160,7 @@ VOID _txm_module_thread_shell_entry(TX_THREAD *thread_ptr, TXM_MODULE_THREAD_EN /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) +#ifdef TX_SAFETY_CRITICAL /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_module/cortex_m3/ac6/module_lib/src/txm_module_thread_shell_entry.c b/ports_module/cortex_m3/ac6/module_lib/src/txm_module_thread_shell_entry.c index e2efcbe0f..518704d74 100644 --- a/ports_module/cortex_m3/ac6/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_module/cortex_m3/ac6/module_lib/src/txm_module_thread_shell_entry.c @@ -161,7 +161,7 @@ VOID _txm_module_thread_shell_entry(TX_THREAD *thread_ptr, TXM_MODULE_THREAD_EN /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) +#ifdef TX_SAFETY_CRITICAL /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_module/cortex_m3/gnu/module_lib/src/txm_module_thread_shell_entry.c b/ports_module/cortex_m3/gnu/module_lib/src/txm_module_thread_shell_entry.c index 2a34487cc..e8af97a97 100644 --- a/ports_module/cortex_m3/gnu/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_module/cortex_m3/gnu/module_lib/src/txm_module_thread_shell_entry.c @@ -159,7 +159,7 @@ VOID _txm_module_thread_shell_entry(TX_THREAD *thread_ptr, TXM_MODULE_THREAD_EN /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) +#ifdef TX_SAFETY_CRITICAL /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_module/cortex_m3/iar/module_lib/src/txm_module_thread_shell_entry.c b/ports_module/cortex_m3/iar/module_lib/src/txm_module_thread_shell_entry.c index f7b0419ce..d4fd04ec6 100644 --- a/ports_module/cortex_m3/iar/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_module/cortex_m3/iar/module_lib/src/txm_module_thread_shell_entry.c @@ -159,7 +159,7 @@ VOID _txm_module_thread_shell_entry(TX_THREAD *thread_ptr, TXM_MODULE_THREAD_EN /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) +#ifdef TX_SAFETY_CRITICAL /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_module/cortex_m33/ac6/module_lib/src/txm_module_thread_shell_entry.c b/ports_module/cortex_m33/ac6/module_lib/src/txm_module_thread_shell_entry.c index 6805cc9fc..bf6fcb5f7 100644 --- a/ports_module/cortex_m33/ac6/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_module/cortex_m33/ac6/module_lib/src/txm_module_thread_shell_entry.c @@ -161,7 +161,7 @@ VOID _txm_module_thread_shell_entry(TX_THREAD *thread_ptr, TXM_MODULE_THREAD_EN /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) +#ifdef TX_SAFETY_CRITICAL /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_module/cortex_m33/gnu/module_lib/src/txm_module_thread_shell_entry.c b/ports_module/cortex_m33/gnu/module_lib/src/txm_module_thread_shell_entry.c index c006d4a84..0fa4f2de5 100644 --- a/ports_module/cortex_m33/gnu/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_module/cortex_m33/gnu/module_lib/src/txm_module_thread_shell_entry.c @@ -159,7 +159,7 @@ VOID _txm_module_thread_shell_entry(TX_THREAD *thread_ptr, TXM_MODULE_THREAD_EN /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) +#ifdef TX_SAFETY_CRITICAL /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_module/cortex_m33/iar/module_lib/src/txm_module_thread_shell_entry.c b/ports_module/cortex_m33/iar/module_lib/src/txm_module_thread_shell_entry.c index e21062175..1d2e17201 100644 --- a/ports_module/cortex_m33/iar/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_module/cortex_m33/iar/module_lib/src/txm_module_thread_shell_entry.c @@ -159,7 +159,7 @@ VOID _txm_module_thread_shell_entry(TX_THREAD *thread_ptr, TXM_MODULE_THREAD_EN /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) +#ifdef TX_SAFETY_CRITICAL /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_module/cortex_m4/ac5/module_lib/src/txm_module_thread_shell_entry.c b/ports_module/cortex_m4/ac5/module_lib/src/txm_module_thread_shell_entry.c index 12d6ad045..b7bccaa82 100644 --- a/ports_module/cortex_m4/ac5/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_module/cortex_m4/ac5/module_lib/src/txm_module_thread_shell_entry.c @@ -160,7 +160,7 @@ VOID _txm_module_thread_shell_entry(TX_THREAD *thread_ptr, TXM_MODULE_THREAD_EN /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) +#ifdef TX_SAFETY_CRITICAL /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_module/cortex_m4/ac6/module_lib/src/txm_module_thread_shell_entry.c b/ports_module/cortex_m4/ac6/module_lib/src/txm_module_thread_shell_entry.c index bd953f53e..e75e693d6 100644 --- a/ports_module/cortex_m4/ac6/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_module/cortex_m4/ac6/module_lib/src/txm_module_thread_shell_entry.c @@ -161,7 +161,7 @@ VOID _txm_module_thread_shell_entry(TX_THREAD *thread_ptr, TXM_MODULE_THREAD_EN /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) +#ifdef TX_SAFETY_CRITICAL /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_module/cortex_m4/gnu/module_lib/src/txm_module_thread_shell_entry.c b/ports_module/cortex_m4/gnu/module_lib/src/txm_module_thread_shell_entry.c index cbeb0597d..30632c1e1 100644 --- a/ports_module/cortex_m4/gnu/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_module/cortex_m4/gnu/module_lib/src/txm_module_thread_shell_entry.c @@ -159,7 +159,7 @@ VOID _txm_module_thread_shell_entry(TX_THREAD *thread_ptr, TXM_MODULE_THREAD_EN /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) +#ifdef TX_SAFETY_CRITICAL /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_module/cortex_m4/iar/module_lib/src/txm_module_thread_shell_entry.c b/ports_module/cortex_m4/iar/module_lib/src/txm_module_thread_shell_entry.c index 49888b5af..5d7767aed 100644 --- a/ports_module/cortex_m4/iar/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_module/cortex_m4/iar/module_lib/src/txm_module_thread_shell_entry.c @@ -159,7 +159,7 @@ VOID _txm_module_thread_shell_entry(TX_THREAD *thread_ptr, TXM_MODULE_THREAD_EN /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) +#ifdef TX_SAFETY_CRITICAL /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_module/cortex_m7/ac5/module_lib/src/txm_module_thread_shell_entry.c b/ports_module/cortex_m7/ac5/module_lib/src/txm_module_thread_shell_entry.c index e8db65447..48f5b3a8d 100644 --- a/ports_module/cortex_m7/ac5/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_module/cortex_m7/ac5/module_lib/src/txm_module_thread_shell_entry.c @@ -160,7 +160,7 @@ VOID _txm_module_thread_shell_entry(TX_THREAD *thread_ptr, TXM_MODULE_THREAD_EN /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) +#ifdef TX_SAFETY_CRITICAL /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_module/cortex_m7/ac6/module_lib/src/txm_module_thread_shell_entry.c b/ports_module/cortex_m7/ac6/module_lib/src/txm_module_thread_shell_entry.c index d06a980b8..bd3c0c7ce 100644 --- a/ports_module/cortex_m7/ac6/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_module/cortex_m7/ac6/module_lib/src/txm_module_thread_shell_entry.c @@ -161,7 +161,7 @@ VOID _txm_module_thread_shell_entry(TX_THREAD *thread_ptr, TXM_MODULE_THREAD_EN /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) +#ifdef TX_SAFETY_CRITICAL /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_module/cortex_m7/gnu/module_lib/src/txm_module_thread_shell_entry.c b/ports_module/cortex_m7/gnu/module_lib/src/txm_module_thread_shell_entry.c index 9feba2d0f..3eb08b2b3 100644 --- a/ports_module/cortex_m7/gnu/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_module/cortex_m7/gnu/module_lib/src/txm_module_thread_shell_entry.c @@ -159,7 +159,7 @@ VOID _txm_module_thread_shell_entry(TX_THREAD *thread_ptr, TXM_MODULE_THREAD_EN /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) +#ifdef TX_SAFETY_CRITICAL /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_module/cortex_m7/iar/module_lib/src/txm_module_thread_shell_entry.c b/ports_module/cortex_m7/iar/module_lib/src/txm_module_thread_shell_entry.c index 4a6d05084..c858fb2b9 100644 --- a/ports_module/cortex_m7/iar/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_module/cortex_m7/iar/module_lib/src/txm_module_thread_shell_entry.c @@ -159,7 +159,7 @@ VOID _txm_module_thread_shell_entry(TX_THREAD *thread_ptr, TXM_MODULE_THREAD_EN /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) +#ifdef TX_SAFETY_CRITICAL /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_module/cortex_r4/ac6/module_lib/src/txm_module_thread_shell_entry.c b/ports_module/cortex_r4/ac6/module_lib/src/txm_module_thread_shell_entry.c index 7f765faf3..ec0d81c63 100644 --- a/ports_module/cortex_r4/ac6/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_module/cortex_r4/ac6/module_lib/src/txm_module_thread_shell_entry.c @@ -161,7 +161,7 @@ VOID _txm_module_thread_shell_entry(TX_THREAD *thread_ptr, TXM_MODULE_THREAD_EN /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) +#ifdef TX_SAFETY_CRITICAL /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_module/cortex_r4/iar/module_lib/src/txm_module_thread_shell_entry.c b/ports_module/cortex_r4/iar/module_lib/src/txm_module_thread_shell_entry.c index 90b7e0fc4..b27e06e3b 100644 --- a/ports_module/cortex_r4/iar/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_module/cortex_r4/iar/module_lib/src/txm_module_thread_shell_entry.c @@ -159,7 +159,7 @@ VOID _txm_module_thread_shell_entry(TX_THREAD *thread_ptr, TXM_MODULE_THREAD_EN /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) +#ifdef TX_SAFETY_CRITICAL /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_module/cortex_r52/gnu/module_lib/src/txm_module_thread_shell_entry.c b/ports_module/cortex_r52/gnu/module_lib/src/txm_module_thread_shell_entry.c index e866742a9..4f01b7a8c 100644 --- a/ports_module/cortex_r52/gnu/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_module/cortex_r52/gnu/module_lib/src/txm_module_thread_shell_entry.c @@ -159,7 +159,7 @@ VOID _txm_module_thread_shell_entry(TX_THREAD *thread_ptr, TXM_MODULE_THREAD_EN /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) +#ifdef TX_SAFETY_CRITICAL /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/ports_module/rxv2/iar/module_lib/src/txm_module_thread_shell_entry.c b/ports_module/rxv2/iar/module_lib/src/txm_module_thread_shell_entry.c index a6ac34777..1242184cc 100644 --- a/ports_module/rxv2/iar/module_lib/src/txm_module_thread_shell_entry.c +++ b/ports_module/rxv2/iar/module_lib/src/txm_module_thread_shell_entry.c @@ -159,7 +159,7 @@ VOID _txm_module_thread_shell_entry(TX_THREAD *thread_ptr, TXM_MODULE_THREAD_EN /* Call actual thread suspension routine. */ _txm_module_thread_system_suspend(thread_ptr); -#if defined(TX_SAFETY_CRITICAL) || defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) +#ifdef TX_SAFETY_CRITICAL /* If we ever get here, raise safety critical exception. */ TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0); diff --git a/test/smp/regression/testcontrol.c b/test/smp/regression/testcontrol.c index 18653fa84..cda2b58a0 100644 --- a/test/smp/regression/testcontrol.c +++ b/test/smp/regression/testcontrol.c @@ -545,7 +545,7 @@ void tx_application_define(void *first_unused_memory) { UCHAR *pointer; -#ifndef TX_SAFETY_CRITICAL_EXCEPTION_ENABLE +#ifndef TX_SAFETY_CRITICAL VOID (*temp_mutex_release)(TX_THREAD *thread_ptr); #endif TX_THREAD *temp_thread; @@ -740,7 +740,7 @@ TX_THREAD *thread_ptr; _tx_thread_time_slice(); _tx_thread_current_ptr[0] = TX_NULL; -#ifndef TX_SAFETY_CRITICAL_EXCEPTION_ENABLE +#ifndef TX_SAFETY_CRITICAL /* Test to make sure _tx_thread_shell_entry can handle a NULL mutex release function pointer. */ temp_mutex_release = _tx_thread_mutex_release; temp_thread = _tx_thread_execute_ptr[0]; diff --git a/test/smp/regression/threadx_timer_activate_deactivate_test.c b/test/smp/regression/threadx_timer_activate_deactivate_test.c index 66044ed94..ba31577d4 100644 --- a/test/smp/regression/threadx_timer_activate_deactivate_test.c +++ b/test/smp/regression/threadx_timer_activate_deactivate_test.c @@ -97,7 +97,7 @@ TX_TIMER_INTERNAL **current_list_head; /* Inform user. */ printf("Running Timer Activate/Deactivate Test.............................. "); -#if !defined(TX_TIMER_PROCESS_IN_ISR) && !defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) +#if !defined(TX_TIMER_PROCESS_IN_ISR) && !defined(TX_SAFETY_CRITICAL) /* Call the timer thread entry function with an invalid value to make sure the code simply returns. */ _tx_timer_thread_entry(0); diff --git a/test/smp/regression/threadx_timer_simple_test.c b/test/smp/regression/threadx_timer_simple_test.c index a54023ad2..af3b156da 100644 --- a/test/smp/regression/threadx_timer_simple_test.c +++ b/test/smp/regression/threadx_timer_simple_test.c @@ -221,7 +221,7 @@ CHAR *pointer; test_control_return(1); } -#if !defined(TX_TIMER_PROCESS_IN_ISR) && !defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) +#if !defined(TX_TIMER_PROCESS_IN_ISR) && !defined(TX_SAFETY_CRITICAL) /* Call the timer thread entry function with a bad ID to test another path. */ _tx_timer_thread_entry(0); diff --git a/test/tx/cmake/safety_critical/CMakeLists.txt b/test/tx/cmake/safety_critical/CMakeLists.txt index 5943455bd..1a52af092 100644 --- a/test/tx/cmake/safety_critical/CMakeLists.txt +++ b/test/tx/cmake/safety_critical/CMakeLists.txt @@ -28,7 +28,8 @@ function(add_safety_critical_configuration name option build_check exceptions) configuration.c ${repository}/${kernel}/src/tx_initialize_kernel_enter.c) target_include_directories(${target} PRIVATE ${${kernel}_includes}) - target_compile_options(${target} PRIVATE -D${option} ${profile_options} -Werror=unused-parameter) + target_compile_options(${target} PRIVATE -D${option} ${profile_options} + -ffunction-sections -Werror=unused-parameter) target_compile_definitions(${target} PRIVATE EXPECT_BUILD_CHECK=${build_check} EXPECT_EXCEPTIONS=${exceptions}) endforeach() @@ -48,6 +49,19 @@ add_safety_critical_configuration(checks_only TX_SAFETY_CRITICAL_BUILD_CHECK 1 0 add_safety_critical_configuration(exceptions_only TX_SAFETY_CRITICAL_EXCEPTION_ENABLE 0 1) add_safety_critical_configuration(legacy TX_SAFETY_CRITICAL 1 1) +# Link and exercise the default handler compiled from each kernel's entry point. +find_package(Threads REQUIRED) +foreach(kernel IN ITEMS common common_smp) + set(target safety_critical_default_${kernel}) + add_executable(${target} default_exception.c $) + target_include_directories(${target} PRIVATE ${${kernel}_includes}) + target_compile_options(${target} PRIVATE -DTX_SAFETY_CRITICAL_EXCEPTION_ENABLE -DTX_DISABLE_ERROR_CHECKING) + target_link_libraries(${target} PRIVATE Threads::Threads) + target_link_options(${target} PRIVATE -Wl,--gc-sections) + add_test(NAME ${target} COMMAND ${target}) + set_tests_properties(${target} PROPERTIES TIMEOUT 5) +endforeach() + # Check that the header rejects disabled error checking for each guarded configuration. set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) foreach(kernel IN ITEMS common common_smp) diff --git a/test/tx/cmake/safety_critical/default_exception.c b/test/tx/cmake/safety_critical/default_exception.c new file mode 100644 index 000000000..bd1a26fa5 --- /dev/null +++ b/test/tx/cmake/safety_critical/default_exception.c @@ -0,0 +1,46 @@ +/*************************************************************************** + * Copyright (c) 2026 Eclipse ThreadX contributors + * + * This program and the accompanying materials are made available under the + * terms of the MIT License which is available at + * https://opensource.org/licenses/MIT. + * + * AI Disclosure: This file was largely AI-generated by Codex (GPT-6.2-Sol). + * The AI-generated portions may be considered public domain (CC0-1.0) + * and not subject to the project's licence. The human contributor has + * reviewed and verified that the code is correct. + * + * SPDX-License-Identifier: MIT and CC0-1.0 + **************************************************************************/ + +#define _POSIX_C_SOURCE 200809L + +#include +#include +#include + +#include "tx_api.h" + +/* MISRA C:2023 Rule 21.8 deviation: exit ends the Linux test process and + lets the coverage runtime write its counters while the handler is halted. */ + +/* End the test after giving an incorrectly returning handler time to fail. */ +static void *finish_test(void *argument) +{ +const struct timespec delay = {0, 100000000L}; + + TX_PARAMETER_NOT_USED(argument); + exit((nanosleep(&delay, NULL) == 0) ? EXIT_SUCCESS : EXIT_FAILURE); +} + +/* Invoke the kernel's real default handler. Returning here is a failure. */ +int main(void) +{ +pthread_t watchdog; + + if (pthread_create(&watchdog, NULL, finish_test, NULL) == 0) + { + TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, TX_SUCCESS); + } + return(EXIT_FAILURE); +} diff --git a/test/tx/cmake/thread_transition/CMakeLists.txt b/test/tx/cmake/thread_transition/CMakeLists.txt index cd3eeeeab..6dc52dade 100644 --- a/test/tx/cmake/thread_transition/CMakeLists.txt +++ b/test/tx/cmake/thread_transition/CMakeLists.txt @@ -64,16 +64,14 @@ if(MSVC) set(transition_undefine_options /UTX_ENABLE_EVENT_TRACE /UTX_ENABLE_EVENT_LOG /UTX_SAFETY_CRITICAL - /UTX_SAFETY_CRITICAL_BUILD_CHECK - /UTX_SAFETY_CRITICAL_EXCEPTION_ENABLE) + /UTX_SAFETY_CRITICAL_BUILD_CHECK) else() set(transition_kernel_compile_options "-include;${SOURCE_DIR}/threadx_thread_transition_host_test_port.h") set(transition_undefine_options -UTX_ENABLE_EVENT_TRACE -UTX_ENABLE_EVENT_LOG -UTX_SAFETY_CRITICAL - -UTX_SAFETY_CRITICAL_BUILD_CHECK - -UTX_SAFETY_CRITICAL_EXCEPTION_ENABLE) + -UTX_SAFETY_CRITICAL_BUILD_CHECK) endif() set_source_files_properties( diff --git a/test/tx/regression/testcontrol.c b/test/tx/regression/testcontrol.c index 9b54f5dc7..3ef3991cd 100644 --- a/test/tx/regression/testcontrol.c +++ b/test/tx/regression/testcontrol.c @@ -488,7 +488,7 @@ void tx_application_define(void *first_unused_memory) { UCHAR *pointer; -#if !defined(TX_DISABLE_NOTIFY_CALLBACKS) && !defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) +#if !defined(TX_DISABLE_NOTIFY_CALLBACKS) && !defined(TX_SAFETY_CRITICAL) VOID (*temp_mutex_release)(TX_THREAD *thread_ptr); #endif TX_THREAD *temp_thread; @@ -609,7 +609,7 @@ TX_THREAD *thread_ptr; init_test_thread.tx_thread_ready_previous = &init_test_thread; _tx_thread_time_slice(); _tx_thread_current_ptr = TX_NULL; -#if !defined(TX_DISABLE_NOTIFY_CALLBACKS) && !defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) +#if !defined(TX_DISABLE_NOTIFY_CALLBACKS) && !defined(TX_SAFETY_CRITICAL) /* Test to make sure _tx_thread_shell_entry can handle a NULL mutex release function pointer. */ temp_mutex_release = _tx_thread_mutex_release; temp_thread = _tx_thread_execute_ptr; diff --git a/test/tx/regression/threadx_timer_activate_deactivate_test.c b/test/tx/regression/threadx_timer_activate_deactivate_test.c index 66044ed94..ba31577d4 100644 --- a/test/tx/regression/threadx_timer_activate_deactivate_test.c +++ b/test/tx/regression/threadx_timer_activate_deactivate_test.c @@ -97,7 +97,7 @@ TX_TIMER_INTERNAL **current_list_head; /* Inform user. */ printf("Running Timer Activate/Deactivate Test.............................. "); -#if !defined(TX_TIMER_PROCESS_IN_ISR) && !defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) +#if !defined(TX_TIMER_PROCESS_IN_ISR) && !defined(TX_SAFETY_CRITICAL) /* Call the timer thread entry function with an invalid value to make sure the code simply returns. */ _tx_timer_thread_entry(0); diff --git a/test/tx/regression/threadx_timer_simple_test.c b/test/tx/regression/threadx_timer_simple_test.c index d81930e20..f3fa8f22f 100644 --- a/test/tx/regression/threadx_timer_simple_test.c +++ b/test/tx/regression/threadx_timer_simple_test.c @@ -221,7 +221,7 @@ CHAR *pointer; test_control_return(1); } -#if !defined(TX_TIMER_PROCESS_IN_ISR) && !defined(TX_SAFETY_CRITICAL_EXCEPTION_ENABLE) +#if !defined(TX_TIMER_PROCESS_IN_ISR) && !defined(TX_SAFETY_CRITICAL) /* Call the timer thread entry function with a bad ID to test another path. */ _tx_timer_thread_entry(0);