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):
- For
TX_EXECUTION_TIME_SOURCE
and TX_EXECUTION_MAX_TIME_SOURCE
, I use the values defined in the file tx_execution_profile.h
- "The following routines are called from assembly code [...]" -> I do nothing as they should already be defined in the assembly files
- I rebuilt ThreadX library with
TX_EXECUTION_PROFILE_ENABLE
- 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