# FreeRTOS SAM7 Port

**URL:** <https://forums.freertos.org/t/freertos-sam7-port/2591>\
**Category:** Kernel\
**Created:** [March 1, 2008, 8:22pm UTC](https://forums.freertos.org/t/freertos-sam7-port/2591 "2008-03-01T20:22:33Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [March 1, 2008, 8:22pm UTC](https://forums.freertos.org/t/freertos-sam7-port/2591/1 "2008-03-01T20:22:33Z")

</div>

**[adriancarpenter](https://sourceforge.net/u/adriancarpenter/)** wrote on [Saturday, March 01, 2008](https://sourceforge.net/p/freertos/discussion/382005/thread/7298bde6/#1856):

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 (  
&nbsp;&nbsp;&nbsp; AT91PS\_AIC pAic,&nbsp; // \arg pointer to the AIC registers  
&nbsp;&nbsp;&nbsp; unsigned int irq\_id,&nbsp;&nbsp;&nbsp;&nbsp; // \arg interrupt number to initialize  
&nbsp;&nbsp;&nbsp; unsigned int priority,&nbsp;&nbsp; // \arg priority to give to the interrupt  
&nbsp;&nbsp;&nbsp; unsigned int src\_type,&nbsp;&nbsp; // \arg activation and sense of activation  
&nbsp;&nbsp;&nbsp; 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

---

<div class="post-metadata">

**Author:** ![rtel](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rtel/32/31_2.png) [@rtel](https://forums.freertos.org/u/rtel)\
**Post date:** [March 3, 2008, 8:47am UTC](https://forums.freertos.org/t/freertos-sam7-port/2591/2 "2008-03-03T08:47:01Z")

</div>

**[rtel](https://sourceforge.net/u/rtel/)** wrote on [Monday, March 03, 2008](https://sourceforge.net/p/freertos/discussion/382005/thread/7298bde6/#1856/1291):

Is this using GCC?&nbsp; 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.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [March 3, 2008, 9:46pm UTC](https://forums.freertos.org/t/freertos-sam7-port/2591/3 "2008-03-03T21:46:40Z")

</div>

**[adriancarpenter](https://sourceforge.net/u/adriancarpenter/)** wrote on [Monday, March 03, 2008](https://sourceforge.net/p/freertos/discussion/382005/thread/7298bde6/#1856/ba05):

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.&nbsp; -Ihardware/include -IFreeRTOS/Source/include -I/Common/include -IFreeRTOS/Source/portable/GCC/ARM7\_AT91SAM7S -O0 -Wall -fomit-frame-pointer -Wcast-align -Wimplicit&nbsp; -Wpointer-arith -Wswitch -Wredundant-decls -Wreturn-type -Wshadow -Wunused -Wa,-adhlns=FreeRTOS/Source/portable/GCC/ARM7\_AT91SAM7S/portISR.lst&nbsp;&nbsp; -MD -MP -MF .dep/portISR.o.d -Wnested-externs&nbsp; -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

---

<div class="post-metadata">

**Author:** ![rtel](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rtel/32/31_2.png) [@rtel](https://forums.freertos.org/u/rtel)\
**Post date:** [March 3, 2008, 10:06pm UTC](https://forums.freertos.org/t/freertos-sam7-port/2591/4 "2008-03-03T22:06:33Z")

</div>

**[rtel](https://sourceforge.net/u/rtel/)** wrote on [Monday, March 03, 2008](https://sourceforge.net/p/freertos/discussion/382005/thread/7298bde6/#1856/ba05/e75e):

? I have never seen these warnings before.

Regards.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [March 3, 2008, 10:09pm UTC](https://forums.freertos.org/t/freertos-sam7-port/2591/5 "2008-03-03T22:09:56Z")

</div>

**[adriancarpenter](https://sourceforge.net/u/adriancarpenter/)** wrote on [Monday, March 03, 2008](https://sourceforge.net/p/freertos/discussion/382005/thread/7298bde6/#1856/b18b):

Ahh wait, I have a warning turned on:

-Wnested-externs

That’ll probably explain that!

Adrian

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [March 3, 2008, 10:12pm UTC](https://forums.freertos.org/t/freertos-sam7-port/2591/6 "2008-03-03T22:12:11Z")

</div>

**[adriancarpenter](https://sourceforge.net/u/adriancarpenter/)** wrote on [Monday, March 03, 2008](https://sourceforge.net/p/freertos/discussion/382005/thread/7298bde6/#1856/0d73):

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.&nbsp; -Ihardware/include -IFreeRTOS/Source/include -I/Common/include -IFreeRTOS/Source/portable/GCC/ARM7\_AT91SAM7S -O0 -Wall -fomit-frame-pointer -Wcast-align -Wimplicit&nbsp; -Wpointer-arith -Wswitch -Wredundant-decls -Wreturn-type -Wshadow -Wunused -Wa,-adhlns=FreeRTOS/Source/portable/GCC/ARM7\_AT91SAM7S/portISR.lst&nbsp;&nbsp; -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

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [March 3, 2008, 10:14pm UTC](https://forums.freertos.org/t/freertos-sam7-port/2591/7 "2008-03-03T22:14:26Z")

</div>

**[adriancarpenter](https://sourceforge.net/u/adriancarpenter/)** wrote on [Monday, March 03, 2008](https://sourceforge.net/p/freertos/discussion/382005/thread/7298bde6/#1856/6f27):

Ok…Sorry for the traffic here!

-Wredundant-decls

It was that warning what was generating the warnings…

Adrian
