Updated Xtensa support (#525)

* Add LX8 support for > 32 interrupts

Also fix inconsistent SWPRI define in interrupt handler

* ThreadX: Fix context switch logic

- Disable interrupts prior to allocating a large exception frame;
  only reenable them after deallocating the extra memory.
- Any user tasks with stacks based on TX_MINIMUM_STACK do not
  have sufficient space for both a context switch frame and an ISR
  frame; ill-timed interrupts were causing stack overruns.

* ThreadX: Interrupt fixes for TX_ENABLE_EXECUTION_CHANGE_NOTIFY

- Must reload register trashed by notify hook function call
- Must ensure PS.WOE is set before using call8
- Remove unused XT_USE_INT_WRAPPER define and associated changes,
  which had a bug in XEA2 usage
- Fix another case where enabling the thread notify hooks for
  call0 ABI corrupted a register

* ThreadX: Support for __DYNAMIC_REENT__

- ThreadX change to handle dynamic reent for both newlib and xclib
- Adapt ThreadX xclib interface code to handle dynamic reent pointers

* ThreadX: Xtensa execution profiling support

- Update upstream execution profiling for Xtensa port

* ThreadX: Update xtensa port readme

* ThreadX: Add Xtensa example to EPK

- tx_execution_profile.h now defines an Xtensa example
  in addition to the existing Cortex example

* ThreadX: Add xtensa.cmake

* ThreadX: Update XSHAL_CLIB ifdefs in __getreent()

- Prevent a fall-through with no return value when neither
  xclib nor newlib are used.
This commit is contained in:
Ian Thompson
2026-05-19 11:11:37 -04:00
committed by GitHub
parent c1e3678797
commit 9ccdd5d822
16 changed files with 507 additions and 239 deletions
@@ -56,10 +56,28 @@ typedef unsigned long EXECUTION_TIME_SOURCE_TYPE;
/* Define basic constants for the execution profile kit. */
#if defined(__XTENSA__)
/* Example for Xtensa targets: */
#ifndef TX_EXECUTION_TIME_SOURCE
#include <xtensa/config/core.h>
#if XCHAL_HAVE_CCOUNT
#include <xtensa/tie/xt_timer.h>
#define TX_EXECUTION_TIME_SOURCE (EXECUTION_TIME_SOURCE_TYPE) XT_RSR_CCOUNT()
#else
#define TX_EXECUTION_TIME_SOURCE 0
#endif
#endif
#else /* __XTENSA__ */
/* Example for Cortex-M targets: */
#ifndef TX_EXECUTION_TIME_SOURCE
#define TX_EXECUTION_TIME_SOURCE (EXECUTION_TIME_SOURCE_TYPE) *((volatile ULONG *) 0xE0001004)
#endif
#endif /* __XTENSA__ */
#ifndef TX_EXECUTION_MAX_TIME_SOURCE
#define TX_EXECUTION_MAX_TIME_SOURCE 0xFFFFFFFF
#endif