From b2622dcf2b512066e79d31d3f3f9876719e0485b Mon Sep 17 00:00:00 2001 From: Dev10-sys Date: Sat, 24 Oct 2026 22:05:26 +0530 Subject: [PATCH] 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); +}