Skip to main content
Explorer II
May 10, 2024
Solved

a bug about using execution profile kit in threadx

  • May 10, 2024
  • 1 reply
  • 1838 views

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...

 

 

    This topic has been closed for replies.
    Best answer by Haithem Rahmani

    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.

     

    HaithemRahmani_0-1715359767290.png

    regards

    Haithem.

    1 reply

    ST Employee
    May 10, 2024

    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!

    xixiAuthor
    Explorer II
    May 10, 2024

    thank you for your reply. so quickly. I do as you said.

    xixi_0-1715332097052.png

    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.

    xixi_2-1715332314209.png

    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)) 

    xixi_3-1715333056736.png

     

    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.

     

     

    ST Employee
    May 10, 2024

    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.

     

    HaithemRahmani_0-1715359767290.png

    regards

    Haithem.