FreeRTOS 4.0.4 uses on AT91SAM7X256 the Periodic Interval Timer (PIT) which triggers the system interrupt (sys_irq). But sys_irq is triggered by some other peripherals as well like Debug Unit (DBGU), or Watchdog Timer (WDT). So ‘vTaskIncrementTick’ is allowed to be called only if the interrupt is triggered by the PIT. If the interrupt is triggered by another peripheral a hook function should be called. As I use the DBGU I had to modify the function ‘void vPreemptiveTick( void )’ as follows
void vPreemptiveTick( void ) __attribute__((naked));
void vPreemptiveTick( void )
/* Save the context of the current task. */
/* Increment the tick count - this may wake a task. */
if ((AT91C_BASE_PITC->PITC_PISR & AT91C_PITC_PITS) > 0) /* N E W */
serveDBGUFunc(); /* N E W */
/* Find the highest priority task that is ready to run. */
/* Clear PITS and end the interrupt in the AIC. */
AT91C_BASE_AIC->AIC_EOICR = AT91C_BASE_PITC->PITC_PIVR;
Perhaps you may want to adopt these modifications to FreeRTOS.
Hardware details can be found in Atmel’s manual ‘AT91 ARM Thumb-based Microcontrollers AT91SAM7X256/AT91SAMX128 Preliminary’, Version ‘6120D-ATARM-02-Feb-06’ (document name ‘doc6120.pdf’), fig. 10-1 'System Controller Block Diagram (http://www.atmel.com/dyn/resources/prod_documents/6120s.pdf).