Xtensa Port out of Sync with latest XTOS

The Cadence XTOS APIs change over time. I believe that is the root cause for the following.

In the Xtensa file “portasm.S” there is a routine

  _frxt_tick_timer_init:

that uses the XTOS API
xtos_ints_on

Unfortunately, this API does not work with the API xtos_interrupt_enable. An application that calls xtos_interrupt_enable will, inadvertently, disable the tick timer interrupt. A solution that works for us to to change the code as follows

diff --git a/FreeRTOS/V10.4.6/portable/portasm.S b/FreeRTOS/V10.4.6/portable/portasm.S
index 06a657a..fd269a2 100644
--- a/FreeRTOS/V10.4.6/portable/portasm.S
+++ b/FreeRTOS/V10.4.6/portable/portasm.S
@@ -324,11 +324,11 @@ _frxt_tick_timer_init:
     to the INTENABLE register because it may be virtualized.
     */
     #ifdef __XTENSA_CALL0_ABI__
-    movi    a2, XT_TIMER_INTEN
-    call0   xt_ints_on
+    movi    a2, XT_TIMER_INDEX
+    call0   xtos_interrupt_enable
     #else
-    movi    a6, XT_TIMER_INTEN
-    call4   xt_ints_on
+    movi    a6, XT_TIMER_INDEX
+    call4   xtos_interrupt_enable
     #endif
 RET(16)

To go along with this the header file also needs to change



diff --git a/FreeRTOS/V10.4.6/portable/xtensa_api.h b/FreeRTOS/V10.4.6/portable/xtensa_api.h
index e124102…08817cb 100644
— a/FreeRTOS/V10.4.6/portable/xtensa_api.h
+++ b/FreeRTOS/V10.4.6/portable/xtensa_api.h
@@ -86,7 +86,7 @@ extern xt_handler xt_set_interrupt_handler(int n, xt_handler f, void * arg);
Returns the previous state of the interrupt enables.

*/
-extern unsigned int xt_ints_on(unsigned int mask);
+extern unsigned int xtos_interrupt_enable(unsigned int mask);

/*

Hi Stephen,

Thank you for bringing this to our attention. I would suggest forking the repository and creating a PR with your changes to the repository. That way we can review and update accordingly. Let me know if this works for you.

Best,

Jason