pxCurrentTCB gets NULL and trigger VInternalProtectionTrap

We are using Aurix TC27x as a microcontroller.
Lwip Version: 2.1.3
OpenRTOS version: V9.0.0
Some IMP macros:

#define configSYSTEM_INTERRUPT_PRIORITY      ( 64 )   /* Interrupt above priority 64 are not effected by critical sections, but cannot call interrupt safe FreeRTOS functions. */
#define configKERNEL_INTERRUPT_PRIORITY      ( 1 )  

We have Ethernet interrupt with priority 85 which is above configSYSTEM_INTERRUPT_PRIORITY. Everything works fine for some time but after some time, hard fault comes with VInternalProtectionTrap with xTin = 6 (portTIN_IPT_MEMORY_PROTECTION_NULL_ADDRESS). This is most probably initiated from __trap( portSYSCALL_TRAP ) void vFreeRTOSTrapHandler( void ) function where pxCurrentTCB has NULL value after vTaskSwitchContext() function.
We are using single Core.

Thank you for your support.

Hello @Chinmay

Can you share a link to the FreeRTOS port you are using? Perhaps you mean configMAX_SYSCALL_INTERRUPT_PRIORITY rather than configSYSTEM_INTERRUPT_PRIORITY?

In general though, the guidance regarding interrupt priority on the FreeRTOS website applies the same here. Namely, if an ISR is calling FreeRTOS functions, it must have a lower priority than configMAX_SYSCALL_INTERRUPT_PRIORITY so that the ISR can be masked by the kernel during critical sections.

The closest we have to an Aurix port would be this TC1782 port, and there are some usage instructions at the bottom of that page (although I don’t know how close that would be to the Aurix). However, if you have an OpenRTOS port you should be able to get support specific to your port from WITTENSTEIN.