Skip to content

Commit dca8bf1

Browse files
committed
ThreadX: Xtensa execution profiling support
- Update upstream execution profiling for Xtensa port
1 parent 901701e commit dca8bf1

3 files changed

Lines changed: 13 additions & 4 deletions

File tree

ports/xtensa/xcc/inc/tx_port.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,10 @@ typedef unsigned short USHORT;
340340
#define TX_THREAD_EXTENSION_2
341341

342342
/* Execution profile related */
343-
#define TX_THREAD_EXTENSION_3
343+
#define TX_THREAD_EXTENSION_3 \
344+
unsigned long long tx_thread_execution_time_total; \
345+
unsigned long tx_thread_execution_time_last_start;
346+
344347

345348
/* Define the port extensions of the remaining ThreadX objects. */
346349

ports/xtensa/xcc/src/xtensa_intr_wrapper.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
#include "tx_thread.h"
4141

4242
#ifdef TX_ENABLE_EXECUTION_CHANGE_NOTIFY
43-
#include "tx_execution_profile.h"
43+
#include "../../utility/execution_profile_kit/tx_execution_profile.h"
4444
#endif
4545

4646

utility/execution_profile_kit/tx_execution_profile.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,15 @@ typedef unsigned long EXECUTION_TIME_SOURCE_TYPE;
5656

5757
/* Define basic constants for the execution profile kit. */
5858

59-
/* Example for Cortex-M targets: */
59+
/* Xtensa target definition */
6060
#ifndef TX_EXECUTION_TIME_SOURCE
61-
#define TX_EXECUTION_TIME_SOURCE (EXECUTION_TIME_SOURCE_TYPE) *((volatile ULONG *) 0xE0001004)
61+
#include <xtensa/config/core.h>
62+
#if XCHAL_HAVE_CCOUNT
63+
#include <xtensa/tie/xt_timer.h>
64+
#define TX_EXECUTION_TIME_SOURCE (EXECUTION_TIME_SOURCE_TYPE) XT_RSR_CCOUNT()
65+
#else
66+
#define TX_EXECUTION_TIME_SOURCE 0
67+
#endif
6268
#endif
6369
#ifndef TX_EXECUTION_MAX_TIME_SOURCE
6470
#define TX_EXECUTION_MAX_TIME_SOURCE 0xFFFFFFFF

0 commit comments

Comments
 (0)