Porting from FreeRTOS v4.7.2 to v5.0

vnilsson wrote on Friday, December 12, 2008:


I am using the Control Panel Demo for my EVK1100 board for the cpu : AVR32UC3A0512.
I am using AVR Studio with GCC which includes Software Framework 1.3 and FreeRTOS v4.7.2 for the example project.

I need to upgrade into FreeRtos v5.0 and have tried it by replacing the files and followed the guide at : http://www.freertos.org/upgrading.html

I replaced the third parameter into the ISR functions by doing the following :

xSwitchRequired = xSemaphoreGiveFromISR( xSemaphore, &xHigherPriorityTaskWoken );

instead of sending pdFalse as a third parameter.

The GCC compiler builds fine without warning but now my control panel demo hangs.
If I try to debug the demo it get stucks at the following module in the file macb.c

// wait for PHY to be ready
  do {
    status = macb->nsr;
  } while (!(status & AVR32_MACB_NSR_IDLE_MASK));

Have I missed something for my upgrade?

davedoors wrote on Friday, December 12, 2008:

Set xHigherPriorityTaskWoken to false before calling xSemaphoreGiveFromISR, then use its value after the function call to determine if a context switch is required.  The return value is now a true or false as to whether the ‘give’ passed or not.

To upgrade the code you should be able to drop the Source directory from the latest FreeRTOS download into your project. Back up your original files first though!

Also make sure you do a clean build.

vnilsson wrote on Friday, December 12, 2008:

Thnx for the reply.

I have tried to use the value of xHigherPriorityTaskWoken to determine if a context switch is required after I am calling xSemaphoreGiveFromISR, but still my application hangs at the same place. I have no idea why it is.

rtel wrote on Friday, December 12, 2008:

Which port are you using?


vnilsson wrote on Friday, December 12, 2008:

I am using AVR32UC3 for GCC

vnilsson wrote on Friday, December 12, 2008:

in port.c for freertos v4.7.2 the function prvSetupTimerInterrupt used to call on the following function : INTC_register_interrupt(&vTick, AVR32_CORE_COMPARE_IRQ, AVR32_INTC_INT0);

but in freertos v5.0.0 the function was called like this INTC_register_interrupt(&vTick, AVR32_CORE_COMPARE_IRQ, INT0);

I didnt have the INT0 defined anywhere, so I had to change it back like it was for the version 4.7.2.  AVR32_INTC_INT0 I found defined as 0x00000000 in intc.h in my avr toolchain lib.

It feels like my application receives a strange interrupt somewhere, maybe this is why it occurs ?

vnilsson wrote on Tuesday, December 16, 2008:

I solved it by replacing all my files, except port.c which is written specifically for my demo project by atmel.