We have a Polaris FPGA board in which I am able to port FreeRTOS to some extent and able to see a task with high priority running. However this execution doesn’t last long as after the first tick interrupt is occured (&serviced) my high priority task should resume. This is not happening.
I have tried two tasks with same priority but still neither of the tasks were able to run after tick interrupt is handled.
Following are my two tasks built and run on CORTEX-M4F port in IAR workbench.
/* Create task to monitor processor activity */
if (xTaskCreate(prvSampleTask, "Sample", configMINIMAL_STACK_SIZE, NULL, 1, NULL) != pdPASS) {
printf("Failed to create Sample task\r\n");
}
/* Create task to monitor processor activity */
if (xTaskCreate(prvSecond, "Secondtask", configMINIMAL_STACK_SIZE, NULL, 1, NULL) != pdPASS) {
printf("Failed to create Second task\r\n");
}
vTaskStartScheduler();
Have you installed the tick interrupt handler? Search for the text
“Special note to ARM Cortex-M users” on this page http://www.freertos.org/FAQHelp.html
Also, have you tried without the calls to printf()? I’m not sure how
your printf() works but (as noted in the book) often non-thread safe or
extremely stack hungry implementations of printf are actually the root
cause of issues, which users then try and debug by adding even more
calls to printf().
On printf, I just implemented function putchar() as shown in attached file.
I don’t think this has something to do with the task resuming after a tick interrupt. Am I right?
My problem here is suppose if I have only one high priority task, the scheduler should resume same task after tick interrupt is seved(no preemption of task is required).
When I debug line by line, controller reached end of tick handler (SysTick_Handler()) and doesn’t start/resume high priority task. Instead it executes instructions that follows tick handler.
As fas as I understand in FreeRTOS xTaskIncrementTick() has some logic which decides whether the current running task should be preempted or not.
Two possible values returned by this function are:
False (means no pre emption is required), now who will bring the same task to running state? which is paused by tick handler.
True, preemption is happened with setting PENDSV bit, even this is also not helping for me. Setting PENDSV bit doesn’t trigger pendsv interrupt for my CORTEX_M4F
With this setting you would need to call the FreeRTOS handlers the same
names as the handlers you have actually installed (each of which ends
with “_Handler” in the code snippet above). Have you done that? The
code needing to be added to FreeRTOSConfig.h to map the FreeRTOS names
to the names you have actually installed is provided on the link from
the first reply above in this thread.