Skip to main content
Nicholas Parker
Associate III
Mar 18, 2026 7:34 PM UTC
Solved

Changing the ThreadX SYSTEM_CLOCK symbol (via threadX itself)


What is recommended way to change or override the 'SYSTEM_CLOCK' symbol defined in 'tx_initialize_low_level.S' , that feeds into the threadX systick period calculation? 

I could change the SysTick after threadX is started -- that is probably the easist fix.

I dont want to modify the threadX submodule in my project, as its pulled from the internet at some pinned version.

I've currently made a local copy of 'tx_initialize_low_level.S', and then I use CMake to select that particular S file - so that solves the problem, but I dont like having a personal copy of a file from the submodule.

After experimenting for some time, and then scouring the web, I cant find any suggestions on this issue, there are some changes that can be imported via having your own 'tx_user.h' -- but I cant see anything that can override the SYSTEM_CLOCK.  

Cheers, Nick

Nicholas Parker
Nicholas ParkerBest answer
Associate III
Mar 22, 2026 8:52 PM UTC
Well, it seems like the cleanest way forwards is to update the SysTick LOAD register from one of the threads after ThreadX has started.    I wanted a 1msec tick.
 
I think it would be cleaner if you were able to do with via the tx_user.h system, but the '.S' is not configured to allow symbols to be overriden.
 
Don't use 'SysTick_Config()' as this plays with the NVIC settings and is not compatible with how ThreadX is configured.

However, either of 
 
HAL_SYSTICK_Config(SystemCoreClock / 1000);        or
SysTick->LOAD  = (uint32_t)(SystemCoreClock / 1000 - 1);
 
is acceptable. (You don't need the minus one for HAL_SYSTICK_Config()).
 
Nick.

1 reply

Nicholas Parker
Nicholas ParkerAuthorBest answer
Associate III
Mar 22, 2026 8:52 PM UTC
Well, it seems like the cleanest way forwards is to update the SysTick LOAD register from one of the threads after ThreadX has started.    I wanted a 1msec tick.
 
I think it would be cleaner if you were able to do with via the tx_user.h system, but the '.S' is not configured to allow symbols to be overriden.
 
Don't use 'SysTick_Config()' as this plays with the NVIC settings and is not compatible with how ThreadX is configured.

However, either of 
 
HAL_SYSTICK_Config(SystemCoreClock / 1000);        or
SysTick->LOAD  = (uint32_t)(SystemCoreClock / 1000 - 1);
 
is acceptable. (You don't need the minus one for HAL_SYSTICK_Config()).
 
Nick.