Azure RTOS Execution Profile Kit with STM32U5/B-U585I-IOT02A

Domenico Condemi 1 Reputation point
2022-09-05T21:40:09.213+00:00

Hi,
Does ThreadX Execution Profile Kit support STM32U5? I am using IAR Embedded Workbench with B-U585I-IOT02A board and my project has TrustZone enabled but when I call the Execution Profile Kit functions I always get zero as a value, the parameters monitored by Execution Profile Kit are not updated.
To compile the code, in the IAR project I added the file tx_execution_profile.c, inserted the path to the folder "Middlewares\ST\threadx\utility\execution_profile_kit" (where the files tx_execution_profile.c and tx_execution_profile.h are contained) and compiled ThreadX with TX_EXECUTION_PROFILE_ENABLE.
I'm also trying with STM32CubeIDE and without enabling TrustZone but I keep reading zero all the time when I call for example the _tx_execution_thread_total_time_get, _tx_execution_isr_time_get and _tx_execution_idle_time_get functions.
Thank you

Azure RTOS
Azure RTOS
An Azure embedded development suite including a small but powerful operating system for resource-constrained devices.
341 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Scott Azure RTOS 4,051 Reputation points
    2022-09-06T16:25:00.107+00:00

    Are you following all the instructions in the EPK? https://github.com/azure-rtos/threadx/blob/master/utility/execution_profile_kit/tx_execution_profile.h#L28-L47

    It sounds like you don't have a hardware timer set up (or it is not enabled/running). Here's an example for the Cortex-M that uses the DWT_CYCCNT register: https://github.com/azure-rtos/threadx/blob/master/utility/execution_profile_kit/tx_execution_profile.h#L59-L65

    1 person found this answer helpful.
    0 comments No comments

  2. Domenico Condemi 1 Reputation point
    2022-09-06T20:10:19.467+00:00

    Hi @Scott Azure RTOS ,
    Thank you for your reply.
    I follow the instructions in the EPK (https://github.com/azure-rtos/threadx/blob/master/utility/execution_profile_kit/tx_execution_profile.h#L28-L47):

    1. For TX_EXECUTION_TIME_SOURCE and TX_EXECUTION_MAX_TIME_SOURCE, I use the values defined in the file tx_execution_profile.h
    2. "The following routines are called from assembly code [...]" -> I do nothing as they should already be defined in the assembly files
    3. I rebuilt ThreadX library with TX_EXECUTION_PROFILE_ENABLE
    4. I add tx_execution_profile.c to the application build

    I initially notice that the call to TX_EXECUTION_TIME_SOURCE always returns zero. I check the tx_initialize_low_level.s file and with respect to the tx_initialize_low_level.s file in "\Middlewares\ST\threadx\ports\cortex_m33\iar\src" the following lines of code are missing.

    In __tx_IntHandler:  
    #if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE))  
        BL      _tx_execution_isr_enter             // Call the ISR enter function  
    #endif  
      
    #if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE))  
        BL      _tx_execution_isr_exit              // Call the ISR exit function  
    #endif  
      
    In SysTick_Handler:  
    #if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE))  
        BL      _tx_execution_isr_enter             // Call the ISR enter function  
    #endif  
      
    #if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE))  
        BL      _tx_execution_isr_exit              // Call the ISR exit function  
    #endif  
    

    I integrate the lines of code into the tx_initialize_low_level.s file in my project and remove the comment from the following lines of code in the tx_initialize_low_level.s file.

    /* Enable the cycle count register.  */  
    LDR     r0, =0xE0001000              ; Build address of DWT register  
    LDR     r1, [r0]                               ; Pickup the current value  
    ORR     r1, r1, #1                           ; Set the CYCCNTENA bit  
    STR     r1, [r0]                                ; Enable the cycle count register  
    

    After these changes the call to TX_EXECUTION_TIME_SOURCE returns a value that increases with each call but the fuctions _tx_execution_thread_total_time_get, _tx_execution_isr_time_get and _tx_execution_idle_time_get always give zero.

    I create a simpler project and include EPK following the instructions. I debug instruction by instruction and it is as if the EPK fuctions of the assembly file are not called. I enter define TX_EXECUTION_PROFILE_ENABLE in the tx_initialize_low_level.s file and I get a compile-time error for the _tx_execution_isr_enter and _tx_execution_isr_exit fuctions that are undefined. I define the fuctions _tx_execution_isr_enter and _tx_execution_isr_exit in tx_initialize_low_level.s with EXTERN, I can compile the code successfully. However, calls to _tx_execution_thread_total_time_get, _tx_execution_isr_time_get and _tx_execution_idle_time_get always return zero. It is as if the EPK function calls do not occur.

    Thanks


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.