0

I am trying to compile ThreadX with Clang. Compiling with Clang all the ThreadX code is normally built except for the tx_timer_thread_entry.c file.
If that file is compiled with GCC and the rest of the files are compiled with Clang everything works fine. If I compile the specified file with Clang along with the other files the application hangs on thread sleep functionality. It enters into a forever loop.

Did anyone try to compile ThreadX with Clang? What could be the difference with the tx_timer_thread_entry.c from the others? And why would only that file give issues when compiling with Clang?

double-beep
  • 5,031
  • 17
  • 33
  • 41

1 Answers1

0

It is hard to say without more details. I would guess that maybe compiler defaults are different, and the generated code with these defaults in one of the compilers is non compliant.

Which version of Clang are you using? There are ThreadX examples available on GitHub that are compiled using the ARM compiler, that is Clang based, so that should give you a better starting point, you can check the options used there.

Andrés
  • 51
  • 3
  • Thank you for your reply. I addressed the solution in the Azure RTOS web page [link](https://learn.microsoft.com/en-us/answers/questions/1025537/compiling-threadx-with-clang-for-arm9.html). The problem was Clang's optimization of "tx_timer_thread_entry" function. The function will operate normally only if the optimization is -O0 or -O1. Though I addressed several questions like why would higher optimizations impact only for the main thread. (But that I guess is more an issue from Clang compiler) – Artur Petrosyan Oct 06 '22 at 06:47