Update FreeRTOS v8.0.1 to FreeRTOS v9.0.0 in Atmel Studio 7 ASF

alvaromuro wrote on Wednesday, October 18, 2017:

I am using Atmel SAM L21 Xplained pro A board, with Atmel Studio 7. I opened the demo project OLED1 XPRO example with the ASF(3.35.1) FreeRTOS module, which is v8.0.1.

The standard demo works perfectly. However, I want to use pdMS_TO_TICK() function, but it’s not defined, and it seems it was introduced in a later version of FreeRTOS which is not directly accesible from the ASF wizard in Atmel Studio 7.

What are the steps needed to update the FreeRTOS version to use v9 in Atmel Studio 7 for SAM L21 board?

rtel wrote on Wednesday, October 18, 2017:

Once Atmel studio has created the project you can just copy the latest
FreeRTOS source files and header files over the top of the same files in
the generated project.

alvaromuro wrote on Monday, October 23, 2017:

I have done that replacement. I see there is still FreeRTOSConfig.h header, which was created by the demo for V8.0.1. There is no demo for SAML21 with v9.0.0 where I can copy this file from, only for SAMD20.
How should this file be updated so the OLED demo can function with V9?

Moreover, asf.h from the original demo calls several FreeRTOSheader files, and the ASF wizard shows only v8.0.1. Should something be updated in the ASF header or anywhere else, to configure the ASF to use v9?

rtel wrote on Monday, October 23, 2017:

I have done that replacement. I see there is still FreeRTOSConfig.h
header, which was created by the demo for V8.0.1.

That should be backward compatible.

There is no demo for
SAML21 with v9.0.0 where I can copy this file from, only for SAMD20.

There is no difference between the SAMD20 and SAML21 as far as the
FreeRTOS code goes, use the same port files on both.

How should this file be updated so the OLED demo can function with V9?

I don’t know what the OLED demo is, presumably Atmel code.

Moreover, asf.h from the original demo calls several FreeRTOSheader
files, and the ASF wizard shows only v8.0.1. Should something be updated
in the ASF header or anywhere else, to configure the ASF to use v9?

You need to copy the V9 source (.c) and header (.h) files into the
project. Did you do that? If so, then they are the files being built.
Nothing in Atmel Studio will change, it won’t know you have updated the
files so may still say the old version.

alvaromuro wrote on Thursday, October 26, 2017:

I have copied the source and header files into the project, and updated FreeRTOSConfig.h.

When I build, I get the error "undefined reference to ‘vApplicationGetTimerTaskMemory’ and ‘vApplicationGetIdleTaskMemory’ ‘’. I have added both declarations following the instructions here: http://www.freertos.org/a00110.html#configSUPPORT_STATIC_ALLOCATION

I added the two declarations into timers.c and tasks.c respectively copying the code from the previous link, but I get same error. I noticed the prototype in tasks.c says:

#if( configSUPPORT_STATIC_ALLOCATION == 1 )
	extern void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize );
#endif

I guess it’s just simply a matter of knowing where and how this functions should be defined… could a knowledgeable mind shed some light in here?

rtel wrote on Thursday, October 26, 2017:

vApplicationGetIdleTaskMemory() (and the timer task equivalent) can be
implemented in any C file that is built, provided they are not declared
static. Grep the FreeRTOS/Demo directory to find several examples. For
example line 247 (at the time of writing) here:
https://sourceforge.net/p/freertos/code/HEAD/tree/trunk/FreeRTOS/Demo/WIN32-MSVC-Static-Allocation-Only/main.c