2024-05-10 01:21 AM
Hi, i'm trying to use execution profile kit in threadx. I use STM32H750VBT6 and STM32CubeIDE1.12.0
firstly, i use stm32cubemx to generate the code include threadx. I can't find execution profile file in the code. So I get tx_execution_profile.h and tx_execution_profile.c from the rtos threadx in github. And I put them in Middlewares\ST\threadx\common\inc and src.
Secondly, I define TX_EXECUTION_PROFILE_ENABLE in tx_user.h, init DWT and use _tx_execution_initialize().
In the end, I try to use _tx_execution_thread_time_get() to get time. Unfortunately, I alway get 0.
I debug the project and find that the problem is in tx_thread_schedule.S . It seems that the program did not run under this condition:
#if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE))
even if I already define TX_EXECUTION_PROFILE_ENABLE in tx_user.h. That makes me confused. because the .S includes tx_user.h .
However, I directly define TX_EXECUTION_PROFILE_ENABLE in tx_thread_schedule.S . The problem is solved. But it's dangerous because the changes disappear when I use stm32cubemx to regenerate the code.
So how can I do to solve it?
This is my frist time to post. Hope i do it correctly. hhh...
Solved! Go to Solution.
2024-05-10 09:49 AM
Hi @xixi,
since the flag TX_EXECUTION_PROFILE_ENABLE is being used in ".S" you'll need to add that define in the assembly preporcessor rather than the C/C++ one.
regards
Haithem.
2024-05-10 01:37 AM
Hello @xixi, Welcome to ST Community,
Instead of defining TX_EXECUTION_PROFILE_ENABLE in tx_user.h, you can define it project-wide in STM32CubeIDE under C/C++ Build settings> processor sections> symbols, you have to re-apply that after regeneration.
This can be related to how the preprocessor handles include files in the compilation order, so, ensure that tx_user.h is included at the beginning of oftx_thread_schedule.S or any other relevant source files.
Also, ensure that the compiler's include paths are correctly set up in STM32CubeIDE so that tx_user.h can be found by the preprocessor when compiling tx_thread_schedule.S.
Regarding missing files when generating code, I'll try to reproduce that on my end!
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2024-05-10 02:24 AM
thank you for your reply. so quickly. I do as you said.
I notice the TX_EXECUTION_PROFILE_ENABLE is redefined when i build the project, because I don't delete the define in tx_user.h. but I decided to continue.
Unfortunately, the result is the same problem. tx_thread_schedule.S didn't run under
#if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE))
I don't know where I make a mistake. Sad...
Anyway, I don't change tx_thread_schedule.S . it was automatically generated by stm32cubemx. And the path of tx_user.h also was added by stm32cubemx. Maybe the problem comes from the setting about gcc or else. I don't know.
2024-05-10 09:49 AM
Hi @xixi,
since the flag TX_EXECUTION_PROFILE_ENABLE is being used in ".S" you'll need to add that define in the assembly preporcessor rather than the C/C++ one.
regards
Haithem.
2024-05-12 07:49 PM
Thank you so much. Now I know what my problem is. I confused GCC Assembler with GCC Compiler.
when I add TX_INCLUDE_USER_DEFINE_FILE macro and include path in GCC Assembler. The program runs well. The macro and include path in GCC Assembler need to be added manually by programmer. They don't like the ones in GCC Compiler where they are automatically added.
Have a good day.