From c191c0a5fb567ea44bad65171d836419c72923de Mon Sep 17 00:00:00 2001 From: aymenjebalibmw Date: Tue, 6 Oct 2026 14:57:31 +0200 Subject: [PATCH] name the memory section of stack and TCB of timer task This allows to link the named memory section to a dedicated partition of the RAM. For example for performance reasons, we can link the stack region into a low latency RAM memory. This feature is also useful to protect Task Stacks from overflowing each others, considering that we protect by MPU each stack. --- common/src/tx_timer_initialize.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/common/src/tx_timer_initialize.c b/common/src/tx_timer_initialize.c index 210888a1e..7a28d395a 100644 --- a/common/src/tx_timer_initialize.c +++ b/common/src/tx_timer_initialize.c @@ -92,8 +92,15 @@ TX_TIMER_INTERNAL *_tx_timer_expired_timer_ptr; /* Define the timer thread's control block. */ +#ifdef TX_TIMER_TCB_SECTION_NAME + +TX_THREAD _tx_timer_thread __attribute__((section(TX_TIMER_TCB_SECTION_NAME))); + +#else + TX_THREAD _tx_timer_thread; +#endif /* Define the variable that holds the timer thread's starting stack address. */ @@ -112,8 +119,17 @@ UINT _tx_timer_priority; /* Define the system timer thread's stack. The default size is defined in tx_port.h. */ +#ifdef TX_TIMER_STACK_SECTION_NAME + +ULONG _tx_timer_thread_stack_area[(((UINT) TX_TIMER_THREAD_STACK_SIZE)+((sizeof(ULONG))- ((UINT) 1)))/(sizeof(ULONG))] __attribute__((section(TX_TIMER_STACK_SECTION_NAME))); + +#else + ULONG _tx_timer_thread_stack_area[(((UINT) TX_TIMER_THREAD_STACK_SIZE)+((sizeof(ULONG))- ((UINT) 1)))/(sizeof(ULONG))]; +#endif + + #else