Building FreeRTOS for Tensilica/Xtensa using the latest Xtensa 9.0.18 toolset

Here’s an odd one for y’all.
I just downloaded the 202112.00 full package (not the LTS libraries), and I tried to build the Full Kernnel Demo for Tensilca_Simulator_Xplorer_XCC using the 9.0.18 version of the Xplorer. This uses a newer LVM based compiler (not XCC), so the libraries may be different.
When I build the kernel, I get an error at this point in task.c at line 3955

#if ( INCLUDE_vTaskDelete == 1 )
static void prvDeleteTCB( TCB_t * pxTCB )
{
    /* This call is required specifically for the TriCore port.  It must be
     * above the vPortFree() calls.  The call is also used by ports/demos that
     * want to allocate and clean RAM statically. */
    portCLEAN_UP_TCB( pxTCB );  --> This causes an exception, can't find the structure member

    /* Free up the memory allocated by the scheduler for the task.  It is up
     * to the task to free any memory allocated at the application level.
     * See the third party link http://www.nadler.com/embedded/newlibAndFreeRTOS.html
     * for additional information. */
    #if ( configUSE_NEWLIB_REENTRANT == 1 ) ....

Upon further examination, this was caused by a configuration flag not being set, and some issues in portable/ThirdParty/XCC/Xtensa/portmacro.h. Seems the configUSE_NEWLIB_REENTRANT flag is always set to zero in this configuration.

If I comment out the macro in the code above, then it will build. However, the simulation has problems. This is a tool configuration issue, I believe.

I know there are “10s of” people working on these processors (LX-6). I was wondering if anybody is using such a processor, and what luck you have had doing this port.

Why am I using such a processor? Not my choice. But I would like something like FreeRTOS running on it to replace the (licensed per unit) RTOS running on it now.

For the Xtensa simulation, this flag is obviously set to zero in several places.

You should not need to comment out the macro. Can you not set it to 1 in your FreeRTOSConfig.h?

Can you describe the problems that you face?

Hi Gaurav,
Seem that if I select the proper chip configuration (sample_controller) I can build without commenting out that line. I’m getting the following lines in the simulator:

No errors - tick count 5000 - free heap 171012 - min free heap 160960

No errors - tick count 10000 - free heap 170936 - min free heap 160920

So it seems it works with the right Xplorer configuration. Sorry for the confusion.
If I want to run it on the chip configuration I’m using, probably need to look at some other parameters. But, simulator working OK.

Thank you for taking time to report back.