Repository navigation
Description
TX_SAFETY_CRITICAL is undocumented, untested, and mutually exclusive with most of the configurations the safety certification was produced from. Its name invites exactly the opposite conclusion, and at least one integrator has already reached it. This issue is to decide what the macro should become rather than to propose a particular answer.
What it does. Two unrelated things. It gates roughly sixteen build-time #error checks in tx_api.h, which reject TX_ENABLE_STACK_CHECKING, TX_ENABLE_EVENT_TRACE, TX_DISABLE_ERROR_CHECKING, TX_TIMER_PROCESS_IN_ISR, TX_DISABLE_NOTIFY_CALLBACKS, the performance-info options and several others, and it requires TX_MAX_PRIORITIES to be defined and a multiple of 32. Separately, it compiles TX_SAFETY_CRITICAL_EXCEPTION calls into _tx_initialize_kernel_enter, _tx_thread_shell_entry, _tx_timer_initialize and _tx_timer_thread_entry, and into txm_module_thread_shell_entry in every module library port. Three of those five sites are paths that cannot be reached by design; one, the timer thread create failure, is a genuine error check. The default handler is while(1) unless the application overrides TX_SAFETY_CRITICAL_EXCEPTION_HANDLER.
Where it appears: common, common_smp, and 33 module_lib port files across every architecture.
What is missing. It is named in no document. Zero occurrences in the ThreadX User Guide, which documents its sibling configuration options in the same section; zero in the current rtos-docs-asciidoc sources; and zero in any of the nine artefacts of the 6.1.1 certification package. It has no tests, at the 6.4.1 tag or on dev today, so none of the five sites and none of the sixteen build checks is exercised by the regression suite. git log -S traces it to the initial commit, so whatever rationale it had predates this repository.
Why the name is a problem. An integrator building a safety-critical system reads the name and concludes this is the configuration to use. The opposite is true: the certified test evidence is produced from configurations that enable stack checking, event tracing and disabled notify callbacks, and a library with this macro defined will not compile in four of the five. Defining it moves you away from the configuration the certification evidence covers, not towards it. The Safety Manual compounds this by describing the four functions as calling an endless-loop handler, which is only true when the macro is defined.
Worth separating, whatever is decided. The build-time lockdown is cheap, costs nothing at run time and is straightforward to test. The unreachable-path traps are neither: they cannot be covered by a test suite that is required to reach 100% line and branch, and manufacturing a state the kernel cannot reach is not a legitimate way to cover them. The two halves do not have to live under one macro.
Options, roughly in increasing order of disruption: document it as-is and state plainly that the certified configuration does not define it; split the build-time checks from the exception traps so the useful half can be tested and certified; revisit the option list, since forbidding stack checking in a configuration named for safety reads oddly today; rename it; or deprecate it. Renaming and deprecating both break existing builds, which argues for knowing first whether anyone is using it.
What would help most: if anyone knows of a product or a certification that was built with this macro defined, that would settle whether it has users and what it was originally for.
Activity
Separated safety-critical build checks from exception handling (#825)
fdesbiens commentedon Dec 1, 2026
I merged the safety-critical build-check and exception changes in #825. They will ship in ThreadX v6.5.3.202604.