FreeRTOS on a ZYNQ board

mmsanchez wrote on Wednesday, May 01, 2013:

Hi

I am working with an AMP configuration on a Zynq ZC702 board, based on the FreeRTOS-Linux AMP demo provided by Xilinx (http://www.xilinx.com/support/documentation/sw_manuals/petalinux2012_12/ug978-petalinux-zynq-amp.pdf).

I customized the demo, in order to work with the FPGA fabric. I already use a couple of switches and leds, and the idea now is to configure the axi_timer IP on XPS, which already works, but i haven’t been successful on the configuration on SDK for my FreeRTOS application (Because the interrupt is never acknowledged)

The timer is configured in FreeRTOS, and if I check the registers associated to the timer, I see that the interrupt is generated (a bit sets to 1), but somehow FreeRTOS doesnt recognize the interrupt…

I will post the code parts related to this topic… maybe any of you find what am I missing. Thank you in advance.

/* ------------------------------------------------- */

AXI Timer Configuration:

void prvSetAXITimer( void )
{
/* Initialize the AXI GPIO driver.*/
/*AXI GPIO configuration*/
xStatus = XTmrCtr_Initialize(&TimerInstancePtr,XPAR_AXI_TIMER_0_DEVICE_ID);
if(XST_SUCCESS != xStatus)
xputs(“TIMER INIT FAILED \\n\\r”);

XTmrCtr_SetHandler(&TimerInstancePtr,axi_timer_handler,&TimerInstancePtr);
XTmrCtr_SetResetValue(&TimerInstancePtr,0,0x10000000);
XTmrCtr_SetOptions(&TimerInstancePtr,XPAR_AXI_TIMER_0_DEVICE_ID,
(XTC_INT_MODE_OPTION|XTC_DOWN_COUNT_OPTION));
}
/* ------------------------------------------------- */

Interrupt Handler

void axi_timer_handler(void *data)
{
XTmrCtr_Stop(data,0);
XTmrCtr_Reset(data,0);
InterruptFlag = 1;
}

/* ------------------------------------------------- */

Setup IRQs by using the following function:

setupIRQhandler(91, &axi_timer_handler, NULL);

/* ------------------------------------------------- */

The function setupIRQhandler in the port.c file is:

#define XScuGic_ClearPending(DistBaseAddress, Int_Id) \\
XScuGic_WriteReg((DistBaseAddress), \\
XSCUGIC_PENDING_CLR_OFFSET + ((Int_Id / 32) * 4), \\
(1 << (Int_Id % 32)))

void setupIRQhandler(int int_no, void *fce, void *param)
{
int Status;

clearIRQhandler(int_no);

Status = XScuGic_Connect(&InterruptController, int_no,
    (Xil_ExceptionHandler)fce, param);
if (Status != XST_SUCCESS) {
    return;
}
XScuGic_ClearPending(&InterruptController, int_no);
XScuGic_Enable(&InterruptController, int_no);
}

rtel wrote on Wednesday, May 01, 2013:

Although this may change shortly, currently the Zynq port is provided by a third party and I don’t have access to Zynq hardware so I’m afraid I cannot provide any suggestions.

Regards.