Compiling FreeRTOS 9.0.0 for Atmel SAMD20

Hi, I have a problem when compiling FreeRTOS for an Atmel SAMD20 microcontroller. I’ve modified the SetupTimerInterrupt with the attribute weak in the port.c file. ~~~ static void vPortSetupTimerInterrupt( void ); attribute(( weak )) void vPortSetupTimerInterrupt( void ) { /* Configure SysTick to interrupt at the requested rate. / *(portNVIC_SYSTICK_VAL) = 0; / Load the SysTick Counter Value */ *(portNVIC_SYSTICK_LOAD) = ( configCPU_CLOCK_HZ / configTICK_RATE_HZ ) – 1UL; *(portNVIC_SYSTICK_CTRL) = portNVIC_SYSTICK_CLK | portNVIC_SYSTICK_INT | portNVIC_SYSTICK_ENABLE; } ~~~ In other file of my source code I have the actual implementation. ~~~ void vPortSetupTimerInterrupt(void) { // Struct for configuring TC struct tc_config tcconf; // Set up configuration values tc_get_config_defaults(&tcconf); tcconf.counter_size = TC_COUNTER_SIZE_32BIT; tcconf.run_in_standby = true; tcconf.clock_prescaler = TC_CLOCK_PRESCALER_DIV1; tcconf.wave_generation = TC_WAVE_GENERATION_MATCH_FREQ;
// Initialize the TC
tc_init(&tc, TICK_TC, &tcconf);

// Register and enable callback for freeRTOS tick handler
tc_register_callback(&tc, (tc_callback_t) xPortSysTickHandler, TC_CALLBACK_CC_CHANNEL0);
tc_enable_callback(&tc, TC_CALLBACK_CC_CHANNEL0);

// Set top value equal to one os tick
tc_set_top_value(&tc, TIMER_RELOAD_VALUE_ONE_TICK);

// Enable the timer
tc_enable(&tc);
} ~~~ The output of the compiler is the following: ~~~ Building file: ../src/ASF/thirdparty/freertos/freertos-9.0.0/Source/portable/GCC/ARMCM0/port.c Invoking: ARM/GNU C Compiler : 6.2.1 In file included from ../src/ASF/thirdparty/freertos/freertos-9.0.0/Source/include/FreeRTOS.h:98:0, from ../src/ASF/thirdparty/freertos/freertos-9.0.0/Source/portable/GCC/ARMCM0/port.c:75: C:Usersjose.gonzalezDesktopdocuments4MicrocontrollerAtmelworkspaceUCFPGAboardFreeRTOSTempSMtestsrcconfigFreeRTOSConfig.h(120,49): warning: redundant redeclaration of ‘PendSVHandler’ [-Wredundant-decls] #define xPortPendSVHandler PendSVHandler ^ C:Usersjose.gonzalezDesktopdocuments4MicrocontrollerAtmelworkspaceUCFPGAboardFreeRTOSTempSMtestsrcASFthirdpartyfreertosfreertos-9.0.0SourceportableGCCARMCM0port.c(116,6): info: in expansion of macro ‘xPortPendSVHandler’ void xPortPendSVHandler( void ) attribute (( naked )); ^~~~~~~~~~~~~~~~~~ In file included from ../src/ASF/sam0/utils/cmsis/samd20/include/samd20.h:76:0, from ../src/ASF/sam0/utils/headerfiles/io.h:58, from ../src/ASF/sam0/utils/compiler.h:65, from ../src/ASF/sam0/drivers/system/clock/gclk.h:55, from ../src/config/FreeRTOSConfig.h:52, from ../src/ASF/thirdparty/freertos/freertos-9.0.0/Source/include/FreeRTOS.h:98, from ../src/ASF/thirdparty/freertos/freertos-9.0.0/Source/portable/GCC/ARMCM0/port.c:75: C:Usersjose.gonzalezDesktopdocuments4MicrocontrollerAtmelworkspaceUCFPGAboardFreeRTOSTempSMtestsrcASFsam0utilscmsissamd20includesamd20g18.h(184,6): info: previous declaration of ‘PendSVHandler’ was here void PendSVHandler ( void ); ^~~~~~~~~~~~~~ In file included from ../src/ASF/thirdparty/freertos/freertos-9.0.0/Source/include/FreeRTOS.h:98:0, from ../src/ASF/thirdparty/freertos/freertos-9.0.0/Source/portable/GCC/ARMCM0/port.c:75: C:Usersjose.gonzalezDesktopdocuments4MicrocontrollerAtmelworkspaceUCFPGAboardFreeRTOSTempSMtestsrcconfigFreeRTOSConfig.h(119,49): warning: redundant redeclaration of ‘SVCHandler’ [-Wredundant-decls] #define vPortSVCHandler SVCHandler ^ C:Usersjose.gonzalezDesktopdocuments4MicrocontrollerAtmelworkspaceUCFPGAboardFreeRTOSTempSMtestsrcASFthirdpartyfreertosfreertos-9.0.0SourceportableGCCARMCM0port.c(118,6): info: in expansion of macro ‘vPortSVCHandler’ void vPortSVCHandler( void ); ^~~~~~~~~~~~~~~ “C:Program Files (x86)AtmelStudio7.0toolchainarmarm-gnu-toolchainbinarm-none-eabi-gcc.exe” -x c -mthumb -DSAMD20G18 -DDEBUG -DTCASYNC=true -DSAMD20G18 -DBOARD=USERBOARD -DARMMATHCM0PLUS=true -DFREERTOS -DI2CMASTERCALLBACKMODE=true -DSYSTICKMODE -I”../src/ASF/common/boards” -I”../src/ASF/sam0/utils” -I”../src/ASF/sam0/utils/headerfiles” -I”../src/ASF/sam0/utils/preprocessor” -I”../src/ASF/thirdparty/CMSIS/Include” -I”../src/ASF/thirdparty/CMSIS/Lib/GCC” -I”../src/ASF/common/utils” -I”../src/ASF/sam0/utils/cmsis/samd20/include” -I”../src/ASF/sam0/utils/cmsis/samd20/source” -I”../src/ASF/sam0/drivers/system” -I”../src/ASF/sam0/drivers/system/clock/clocksamd20″ -I”../src/ASF/sam0/drivers/system/clock” -I”../src/ASF/sam0/drivers/system/interrupt” -I”../src/ASF/sam0/drivers/system/interrupt/systeminterruptsamd20″ -I”../src/ASF/sam0/drivers/system/pinmux” -I”../src/ASF/sam0/drivers/system/power” -I”../src/ASF/sam0/drivers/system/power/powersamdrh” -I”../src/ASF/sam0/drivers/system/reset” -I”../src/ASF/sam0/drivers/system/reset/resetsamdrh” -I”../src/ASF/common2/boards/userboard” -I”../src/ASF/thirdparty/freertos/freertos-9.0.0/Source/include” -I”../src/ASF/thirdparty/freertos/freertos-9.0.0/Source/portable/GCC/ARMCM0″ -I”../src” -I”../src/config” -I”../src/ASF/sam0/drivers/sercom” -I”../src/ASF/sam0/drivers/sercom/i2c” -I”../src/ASF/sam0/drivers/sercom/i2c/i2csamd20″ -I”../src/ASF/sam0/drivers/port” -I”../src/ASF/sam0/drivers/tc” -I”../src/ASF/sam0/drivers/tc/tcsamdrh” -I”../src/AED/APPtasks” -I”../src/AED/i2c” -I”../src/AED/Callbacks” -I”../src/AED/GPIO” -I”../src/AED/FMCstatemachine” -I”../src/AED/Linkedlist” -O0 -fdata-sections -ffunction-sections -mlong-calls -g3 -Wall -mcpu=cortex-m0plus -c -pipe -fno-strict-aliasing -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror-implicit-function-declaration -Wpointer-arith -std=gnu99 -ffunction-sections -fdata-sections -Wchar-subscripts -Wcomment -Wformat=2 -Wimplicit-int -Wmain -Wparentheses -Wsequence-point -Wreturn-type -Wswitch -Wtrigraphs -Wunused -Wuninitialized -Wunknown-pragmas -Wfloat-equal -Wundef -Wshadow -Wbad-function-cast -Wwrite-strings -Wsign-compare -Waggregate-return -Wmissing-declarations -Wformat -Wmissing-format-attribute -Wno-deprecated-declarations -Wpacked -Wredundant-decls -Wnested-externs -Wlong-long -Wunreachable-code -Wcast-align –param max-inline-insns-single=500 -MD -MP -MF “src/ASF/thirdparty/freertos/freertos-9.0.0/Source/portable/GCC/ARMCM0/port.d” -MT”src/ASF/thirdparty/freertos/freertos-9.0.0/Source/portable/GCC/ARMCM0/port.d” -MT”src/ASF/thirdparty/freertos/freertos-9.0.0/Source/portable/GCC/ARMCM0/port.o” -o “src/ASF/thirdparty/freertos/freertos-9.0.0/Source/portable/GCC/ARMCM0/port.o” “../src/ASF/thirdparty/freertos/freertos-9.0.0/Source/portable/GCC/ARMCM0/port.c” C:Usersjose.gonzalezDesktopdocuments4MicrocontrollerAtmelworkspaceUCFPGAboardFreeRTOSTempSMtestDebugMakefile(444,1): error: recipe for target ‘src/ASF/thirdparty/freertos/freertos-9.0.0/Source/portable/GCC/ARMCM0/port.o’ failed In file included from ../src/ASF/sam0/utils/cmsis/samd20/include/samd20.h:76:0, from ../src/ASF/sam0/utils/headerfiles/io.h:58, from ../src/ASF/sam0/utils/compiler.h:65, from ../src/ASF/sam0/drivers/system/clock/gclk.h:55, from ../src/config/FreeRTOSConfig.h:52, from ../src/ASF/thirdparty/freertos/freertos-9.0.0/Source/include/FreeRTOS.h:98, from ../src/ASF/thirdparty/freertos/freertos-9.0.0/Source/portable/GCC/ARMCM0/port.c:75: C:Usersjose.gonzalezDesktopdocuments4MicrocontrollerAtmelworkspaceUCFPGAboardFreeRTOSTempSMtestsrcASFsam0utilscmsissamd20includesamd20g18.h(183,6): info: previous declaration of ‘SVCHandler’ was here void SVCHandler ( void ); ^~~~~~~~~~~ C:Usersjose.gonzalezDesktopdocuments4MicrocontrollerAtmelworkspaceUCFPGAboardFreeRTOSTempSMtestsrcASFthirdpartyfreertosfreertos-9.0.0SourceportableGCCARMCM0port.c(371,1): error: in functionandvariablevisibility, at ipa-visibility.c:596 } ^ Please submit a full bug report, with preprocessed source if appropriate. See http://gcc.gnu.org/bugs.html for instructions. make: *** [src/ASF/thirdparty/freertos/freertos-9.0.0/Source/portable/GCC/ARM_CM0/port.o] Error 1 make: *** Waiting for unfinished jobs…. ~~~ I have other project with FreeRTOS v8.0.1. and it works. Unfortunately I need the new version, Any help would be welcome. Thanks in advance, Jose

Compiling FreeRTOS 9.0.0 for Atmel SAMD20

I can see the compiler seems to crash and think it has a bug, but I can’t see what the error it is reporting in the source code is (only warnings).

Compiling FreeRTOS 9.0.0 for Atmel SAMD20

Just 2 guesses: what does the compiler do when you comment-out the original vPortSetupTimerInterrupt() function? And what if you leave out -Wredundant-decls ( an option that gave me head-aches ) ?