From 50958c1659b2edffdb38180ac112921d82495e68 Mon Sep 17 00:00:00 2001 From: Angel Cascarino Date: Wed, 19 Jun 2024 17:56:27 +0100 Subject: [PATCH] Create dummy pxCurrentTCBs for xcore.ai port --- portable/ThirdParty/xClang/XCOREAI/port.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/portable/ThirdParty/xClang/XCOREAI/port.c b/portable/ThirdParty/xClang/XCOREAI/port.c index ba4598b6b..59db73251 100644 --- a/portable/ThirdParty/xClang/XCOREAI/port.c +++ b/portable/ThirdParty/xClang/XCOREAI/port.c @@ -12,6 +12,17 @@ static hwtimer_t xKernelTimer; uint32_t ulPortYieldRequired[ portMAX_CORE_COUNT ] = { pdFALSE }; +#if ( configNUMBER_OF_CORES == 1 ) +/* This port was written assuming that pxCurrentTCBs always exists and that, in + single-core FreeRTOS, it would just have simply one element. That is not the + case in v11 - in single-core FreeRTOS the symbol pxCurrentTCB is defined + instead. This breaks this port in a number of ways. A quick solution is to + define pxCurrentTCBs here - it simply needs to be a pointer to pxCurrentTCB. + We will actually populate this pointer in the RTOS kernel entry function. + */ +void * pxCurrentTCBs; +#endif + /*-----------------------------------------------------------*/ void vIntercoreInterruptISR( void ) @@ -140,6 +151,17 @@ DEFINE_RTOS_KERNEL_ENTRY( void, vPortStartSchedulerOnCore, void ) } #endif + #if ( configNUMBER_OF_CORES == 1 ) + { + asm volatile ( + "ldaw %0, dp[pxCurrentTCB]\n\t" + : "=r"(pxCurrentTCBs) + : /* no inputs */ + : /* no clobbers */ + ); + } + #endif + debug_printf( "FreeRTOS Core %d initialized\n", xCoreID ); /*