Hello all. I’ll try to be brief with my problem.
I’m working on a zynq 702 board which is programmed with a custom hardware. Currently i’m adapting the CORTEX
A9ZYNQ demo for my purposes.
The hardware, on certain occasions, raises an interrupt which i’m trying to catch and by using a semaphore to synchronize my task with my hardware. So far i have managed to catch the interrupt but i’m getting an assertion failure at tasks.c:2360 (configASSERT( pxUnblockedTCB );)
My code:
Modified Demo/CORTEX
A9Zynq
ZC702/RTOSDemo/src/FreeRTOStick_config.c: vConfigureTickInterrupt()
// Install the foo ISR.
extern void rtos_fooISR(void *data) /*__attribute__ ((isr))*/;
/// (notice i don't use the __attribute__ (isr), more on this later)
XScuGic_SetPriorityTriggerType( &xInterruptController, 90, (configMAX_API_CALL_INTERRUPT_PRIORITY) << portPRIORITY_SHIFT, ucRisingEdge);
xStatus = XScuGic_Connect( &xInterruptController, 90, (Xil_ExceptionHandler) rtos_fooISR, NULL);
configASSERT( xStatus == XST_SUCCESS );
( void ) xStatus;
XScuGic_Enable(&xInterruptController, 90);
Somewhere in main i initialize the binary semaphore:
BaseType_t status;
(void) status;
/// Initialize semaphore
foo_Semaphore = xSemaphoreCreateBinary();
configASSERT(foo_Semaphore != NULL);
status = xSemaphoreGive(foo_Semaphore);
configASSERT(status == pdTRUE);
Here is the ISR:
void rtos
fooISR(void *data)
{
static BaseTypet xHigherPriorityTaskWoken = 0;
static volatile unsigned int *reg_addr = (unsigned int *)(BASE + foo_INTERRUPT);
(void) data;
/// Clear interrupt
*reg_addr = 0x1;
/// “give” semaphore
/// xil_printf(“gnr”);
xSemaphoreGiveFromISR(foo_Semaphore, &xHigherPriorityTaskWoken);
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
}
And this is the function the task calls when it wants to synchronize with the hardware
void rtos
waitForfoo(void)
{
xilprintf(“tnr”);
xSemaphoreTake(foo
Semaphore, portMAXDELAY);
}
Is my code correct or i’m using a hack without being aware of it? Any idea why i get the assertion failure?
Also when i declare the rtos_fooISR function with the
attribute((isr)) it appears that the interrupt stays on for ever. Why is that?
Thanks for your time.