Update FreeRTOS in Atmel Studio

anb80 wrote on Thursday, February 01, 2018:

I have an Arduino Due board which is available in Atmel Studio and it has a SAM3X chip. The FreeRTOS edition that comes with it is 7.3.0.
After downloading the FreeRTOS 10.0 I updated all the files in the OS sources of my Atmel Studio project.

However, now the compilation does not succeed and ends with an error:
implicit declaration of function ‘sysclk_get_cpu_hz’ [-Werror=implicit-function-declaration] in …\src\config\FreeRTOSConfig.h 74

However, this function is declared in sysclk.h as:
static inline uint32_t sysclk_get_cpu_hz(void)
{
/* CONFIG_SYSCLK_PRES is the register value for setting the expected /
/
prescaler, not an immediate value. */
return sysclk_get_main_hz() /
((CONFIG_SYSCLK_PRES == SYSCLK_PRES_3) ? 3 :
(1 << (CONFIG_SYSCLK_PRES >> PMC_MCKR_PRES_Pos)));
}

During the compilation I get various other warnings such as:

Warning nested extern declaration of ‘sysclk_get_cpu_hz’
Warning nested extern declaration of ‘FLASH_segment_end
Warning nested extern declaration of ‘SRAM_segment_start
Warning pointer targets in passing argument 1 of ‘MPU_vTaskGetRunTimeStats’ differ in signedness
Warning pointer targets in passing argument 2 of ‘MPU_xTaskCreate’ differ in signedness

Is there any recommended way how to be updating the FreeRTOS to latest version under Atmel Studio? I always struggle with this and drop-in replacement is usually not possible.

Thank you.

rtel wrote on Thursday, February 01, 2018:

What was it you replaced? Did you keep the FreeRTOSConfig.h the same
(which would be the right thing to do)? Other than the one starting
MPU_ the variables mentioned in your post are not used by FreeRTOS
itself so I’m not sure why updating the FreeRTOS .c and .h files would
effect the build unless Atmel had changed something in the core kernel
files.

The references to variables starting MPU_ are suspicious though. Are
you using the MPU version of FreeRTOS? I doubt you are intentionally,
in which case either you have included the wrong FreeRTOS port layer, or
you have configUSE_MPU_WRAPPERS set to 1 in FreeRTOSConfig.h.

The SAM3X has a Cortex-M3 core, and Atmel Studio uses GCC, so you should
have picked the port layer files from FreeRTOS/Source/portable/GCC/ARM_CM3.