I am trying to configure FreeRTOS(V10.0.1)to run on ARM Cortex-A9( on cyclone V’s processor 0 ) and using Mentor toolchain’ arm-altera-eabi-gcc to compile/link my code.
Followed most of the step as defined at and referred to demo code for Cyclone V :
https://www.freertos.org/Using-FreeRTOS-on-Cortex-A-proprietary-interrupt-controller.html
I want to setup an interrupt to run every few ms (say 1ms) and to release sempahore that blocks the task from ISR servicing this interrupt.
Want to use task notificaion API to synchronise this ISR and a task. I have set the interrupts priority at (portLOWEST
USABLEINTERRUPT
PRIORITY << portPRIORITYSHIFT) (tried with slightly higher priority also)
I have defined ALT
INTPROVISION
VECTORSUPPORT in my project so to disable defination of void
attribute ((interrupt)) __cs3
isrirq(void) in alt_interrupt.c and defined a handler like:
void
attribute ((interrupt)) __cs3
isrirq(void)
{
FreeRTOS
IRQHandler();
}
and defined FreeRTOS
IRQHandler in FreeRTOSConfig.h as void FreeRTOS
IRQHandler ();
Similarly I have defined :
void
attribute ((interrupt)) __cs3
isrswi (void)
{
FreeRTOS
SWIHandler();
}
I am facing 2 problems:
i) Moment I enable FreeRTOS
IRQHandler using above approach, I see software abort and looping in
cs3isr_dabort. If I step through, software it does not abort(though task does not releases, see point ii below), but if I press F8 (on DS-5) software immediately goes in abort. Used vApplicationIRQHandler as in the demo project.
ii) The reason I want use portASM.S implementation was I was unable to release the semaphore in the task, it is always stuck in ulTaskNotifyTake(). I cannot see any defination of configKERNEL
INTERRUPTPRIORITY in the demo supplied, so I have also not defined it. (Even setting it to 255 did not help). I tried binarys semphore (xSemaphoreGiveFromISR/ xSemaphoreTake), but with same result. Saw somewhere it is deprecated so moved to Task notificaion approach.
iii) Also timeout mechansim of ulTaskNotifyTake does not seems to work, though timertick/ timer1 are enabled.
iv)If I don’t modify my software to use portASM.s’s FreeRTOS
IRQHandler and use the one defined in Altera’s code software does not abort, but I cannot release the task from sempahore.
What is that I have missed or doing wrong ? Any help will be of great help.
Following is snapshot of ISR code:
…
/* At this point xTaskToNotify should not be NULL as a transmission was
in progress. */
configASSERT( xTaskToNotify != NULL );
BaseType_t xHigherPriorityTaskWoken;
/* The xHigherPriorityTaskWoken parameter must be initialized to pdFALSE as
* it will get set to pdTRUE inside the interrupt safe API function if a
* context switch is required. */
xHigherPriorityTaskWoken = pdFALSE;
/* 'Give' the semaphore to unblock the task, passing in the address of xHigherPriorityTaskWoken
* as the interrupt safe API function's pxHigherPriorityTaskWoken parameter. */
/* Notify the task that the transmission is complete. */
vTaskNotifyGiveFromISR( xTaskToNotify, &xHigherPriorityTaskWoken );
portYIELD_FROM_ISR( xHigherPriorityTaskWoken );
…
and following of the task:
uint32
t testcount = 0;
void vTask1( void *pvParameters ) {
/* As per most tasks, this task is implemented within an infinite loop. */
uint32_t ulNotificationValue = 1;
const TickType_t xMaxBlockTime = pdMS_TO_TICKS(200);
configASSERT( xTaskToNotify == NULL );
xTaskToNotify = xTaskGetCurrentTaskHandle();
ALT_STATUS_CODE status = alt_int_dist_pending_clear(72);
status = alt_int_dist_enable(72);
for( ;; )
{
ulNotificationValue = ulTaskNotifyTake( pdTRUE,
xMaxBlockTime );
if( ulNotificationValue == 1 )
{
/* The transmission ended as expected. */
ALT_PRINTF( "Handler task - Processing event .rn" );
}
else
{
/* The call to ulTaskNotifyTake() timed out. */
ALT_PRINTF( "Handler task - Processing event timeout.rn" );
}
test_count++;
}
}