FreeRTOS SAM7 Port

adriancarpenter wrote on Saturday, March 01, 2008:

Hi,

There is something which catches me out nearly everytime I update my FreeRTOS.

The vesion of the lib_SAM7S256.h is not compatible with the latest ones from Atmel.

In port.c where the rtos tick is installed, the following function call is used:

AT91F_AIC_ConfigureIt( AT91C_ID_SYS, AT91C_AIC_PRIOR_HIGHEST, portINT_LEVEL_SENSITIVE, ( void (*)(void) ) vNonPreemptiveTick );

The convention in the current atmel header file is:

__inline unsigned int AT91F_AIC_ConfigureIt (
    AT91PS_AIC pAic,  // \arg pointer to the AIC registers
    unsigned int irq_id,     // \arg interrupt number to initialize
    unsigned int priority,   // \arg priority to give to the interrupt
    unsigned int src_type,   // \arg activation and sense of activation
    void (*newHandler) () ) // \arg address of the interrupt handler

Where the AIC peripheral is passed in as well.

Is there any chance that you can update the library version in the distribution so that it uses the library functions that are compatible with the current atmel standard.

What happens is that everytime I drop in a new FreeRTOS release into my source tree I end up wondering why it crashes and then I remember that I have to go in and modify the port.c file so that it passes the correct parameters to the configure call.

Thanks

Adrian

rtel wrote on Monday, March 03, 2008:

Is this using GCC?  I seem to recall in GCC the macro was altered and placed in the application code (rather than using the one in the header) as the headers are written for IAR and are not to easy to include in GCC builds due to their inline statements.

Regards.

adriancarpenter wrote on Monday, March 03, 2008:

Yes, GCC.

The headers certainly compile fine now without alteration under gcc, not sure about older versions.

I’ve just downloaded the latest freertos and dropped in the latest atmel header that I have here and modified port.c and it compiles fine.

Well, actually under gcc 4.1.0 I get some warnings:

ompiling C (ARM-only): FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c
arm-elf-gcc -c -mcpu=arm7tdmi -mthumb-interwork -I. -gdwarf-2 -DROM_RUN -DSAM7_GCC -DTHUMB_INTERWORK -DVECTORS_IN_RAM -I.  -Ihardware/include -IFreeRTOS/Source/include -I/Common/include -IFreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S -O0 -Wall -fomit-frame-pointer -Wcast-align -Wimplicit  -Wpointer-arith -Wswitch -Wredundant-decls -Wreturn-type -Wshadow -Wunused -Wa,-adhlns=FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.lst   -MD -MP -MF .dep/portISR.o.d -Wnested-externs  -std=gnu99 FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c -o FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.o
FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c: In function ‘vPortISRStartFirstTask’:
FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c:87: warning: nested extern declaration of ‘pxCurrentTCB’
FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c:87: warning: nested extern declaration of ‘ulCriticalNesting’
FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c:87: warning: redundant redeclaration of ‘ulCriticalNesting’
FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c:69: warning: previous definition of ‘ulCriticalNesting’ was here
FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c: In function ‘SWI_Handler’:
FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c:107: warning: nested extern declaration of ‘pxCurrentTCB’
FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c:107: warning: redundant redeclaration of ‘pxCurrentTCB’
FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c:87: warning: previous declaration of ‘pxCurrentTCB’ was here
FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c:107: warning: nested extern declaration of ‘ulCriticalNesting’
FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c:107: warning: redundant redeclaration of ‘ulCriticalNesting’
FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c:69: warning: previous definition of ‘ulCriticalNesting’ was here
FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c:113: warning: nested extern declaration of ‘pxCurrentTCB’
FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c:113: warning: redundant redeclaration of ‘pxCurrentTCB’
FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c:107: warning: previous declaration of ‘pxCurrentTCB’ was here
FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c:113: warning: nested extern declaration of ‘ulCriticalNesting’
FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c:113: warning: redundant redeclaration of ‘ulCriticalNesting’
FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c:69: warning: previous definition of ‘ulCriticalNesting’ was here
FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c: In function ‘vPreemptiveTick’:
FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c:151: warning: nested extern declaration of ‘pxCurrentTCB’
FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c:151: warning: redundant redeclaration of ‘pxCurrentTCB’
FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c:113: warning: previous declaration of ‘pxCurrentTCB’ was here
FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c:151: warning: nested extern declaration of ‘ulCriticalNesting’
FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c:151: warning: redundant redeclaration of ‘ulCriticalNesting’
FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c:69: warning: previous definition of ‘ulCriticalNesting’ was here
FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c:162: warning: nested extern declaration of ‘pxCurrentTCB’
FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c:162: warning: redundant redeclaration of ‘pxCurrentTCB’
FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c:151: warning: previous declaration of ‘pxCurrentTCB’ was here
FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c:162: warning: nested extern declaration of ‘ulCriticalNesting’
FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c:162: warning: redundant redeclaration of ‘ulCriticalNesting’
FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c:69: warning: previous definition of ‘ulCriticalNesting’ was here
FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c: At top level:
FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c:174: warning: redundant redeclaration of ‘vPortDisableInterruptsFromThumb’
FreeRTOS/Source/include/…/…/Source/portable/GCC/ARM7_AT91SAM7S/portmacro.h:218: warning: previous declaration of ‘vPortDisableInterruptsFromThumb’ was here
FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c:175: warning: redundant redeclaration of ‘vPortEnableInterruptsFromThumb’
FreeRTOS/Source/include/…/…/Source/portable/GCC/ARM7_AT91SAM7S/portmacro.h:219: warning: previous declaration of ‘vPortEnableInterruptsFromThumb’ was here

But these are due to a change in the freertos code that nests some external declarations that wern’t like that in previous versions.

best regards

Adrian

rtel wrote on Monday, March 03, 2008:

? I have never seen these warnings before.

Regards.

adriancarpenter wrote on Monday, March 03, 2008:

Ahh wait, I have a warning turned on:

-Wnested-externs

That’ll probably explain that!

Adrian

adriancarpenter wrote on Monday, March 03, 2008:

Humn…turning that off still didn’t fix those warnings:

Compiling C (ARM-only): FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c
arm-elf-gcc -c -mcpu=arm7tdmi -mthumb-interwork -I. -gdwarf-2 -DROM_RUN -DSAM7_GCC -DTHUMB_INTERWORK -DVECTORS_IN_RAM -I.  -Ihardware/include -IFreeRTOS/Source/include -I/Common/include -IFreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S -O0 -Wall -fomit-frame-pointer -Wcast-align -Wimplicit  -Wpointer-arith -Wswitch -Wredundant-decls -Wreturn-type -Wshadow -Wunused -Wa,-adhlns=FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.lst   -MD -MP -MF .dep/portISR.o.d -std=gnu99 FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c -o FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.o
FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c: In function ‘vPortISRStartFirstTask’:
FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c:87: warning: redundant redeclaration of ‘ulCriticalNesting’
FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c:69: warning: previous definition of ‘ulCriticalNesting’ was here
FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c: In function ‘SWI_Handler’:
FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c:107: warning: redundant redeclaration of ‘pxCurrentTCB’
FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c:87: warning: previous declaration of ‘pxCurrentTCB’ was here
FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c:107: warning: redundant redeclaration of ‘ulCriticalNesting’
FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c:69: warning: previous definition of ‘ulCriticalNesting’ was here
FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c:113: warning: redundant redeclaration of ‘pxCurrentTCB’
FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c:107: warning: previous declaration of ‘pxCurrentTCB’ was here
FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c:113: warning: redundant redeclaration of ‘ulCriticalNesting’
FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c:69: warning: previous definition of ‘ulCriticalNesting’ was here
FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c: In function ‘vPreemptiveTick’:
FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c:151: warning: redundant redeclaration of ‘pxCurrentTCB’
FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c:113: warning: previous declaration of ‘pxCurrentTCB’ was here
FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c:151: warning: redundant redeclaration of ‘ulCriticalNesting’
FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c:69: warning: previous definition of ‘ulCriticalNesting’ was here
FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c:162: warning: redundant redeclaration of ‘pxCurrentTCB’
FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c:151: warning: previous declaration of ‘pxCurrentTCB’ was here
FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c:162: warning: redundant redeclaration of ‘ulCriticalNesting’
FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c:69: warning: previous definition of ‘ulCriticalNesting’ was here
FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c: At top level:
FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c:174: warning: redundant redeclaration of ‘vPortDisableInterruptsFromThumb’
FreeRTOS/Source/include/…/…/Source/portable/GCC/ARM7_AT91SAM7S/portmacro.h:218: warning: previous declaration of ‘vPortDisableInterruptsFromThumb’ was here
FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c:175: warning: redundant redeclaration of ‘vPortEnableInterruptsFromThumb’
FreeRTOS/Source/include/…/…/Source/portable/GCC/ARM7_AT91SAM7S/portmacro.h:219: warning: previous declaration of ‘vPortEnableInterruptsFromThumb’ was here

Adrian

adriancarpenter wrote on Monday, March 03, 2008:

Ok…Sorry for the traffic here!

-Wredundant-decls

It was that warning what was generating the warnings…

Adrian