While compiling freeRTOS for the LPC2000 port, first of I get way more warnings than what I used to get when I compiled for the VC++ port. Most of the warnings are generated from the port, thus as somehow dependent on the toolchain.
Here’s a subset of the warnings I get:
FreeRTOS/Source/portable/GCC/ARM7_LPC2000/portmacro.h:108:1: warning: multi-line comment
FreeRTOS/Source/portable/GCC/ARM7_LPC2000/portmacro.h:146:1: warning: multi-line comment
FreeRTOS/Source/portable/GCC/ARM7_LPC2000/portISR.c: In function ‘vPortISRStartFirstTask’:
FreeRTOS/Source/portable/GCC/ARM7_LPC2000/portISR.c:120: warning: no previous prototype for ‘swi_handler’
FreeRTOS/Source/portable/GCC/ARM7_LPC2000/portISR.c:120: warning: declaration of ‘swi_handler’ shadows a global declaration
FreeRTOS/Source/portable/GCC/ARM7_LPC2000/portISR.c:94: warning: shadowed declaration is here
FreeRTOS/Source/portable/GCC/ARM7_LPC2000/portISR.c: In function ‘swi_handler’:
FreeRTOS/Source/portable/GCC/ARM7_LPC2000/portISR.c:140: warning: nested extern declaration of ‘vTickISR’
However I get critical errors:
- For example, I had to modify the prototype declaration of pxCurrentTCB in portmacro.h, which did not seem to match the declaration in tasks.c. - I’ve fixed this issue, I believe.
- I get this error I can’t seem to fix:
FreeRTOS/Source/portable/GCC/ARM7_LPC2000/portISR.c:142: error: static declaration of ‘vTickISR’ follows non-static declaration
FreeRTOS/Source/portable/GCC/ARM7_LPC2000/portISR.c:140: error: previous declaration of ‘vTickISR’ was here
and here is what portISR.c looks like between line 140 and 142 (this code is unchanged from the downloaded version):
So considering I wasn’t expecting so many warnings, and these errors, I am thinking I don’t have the appropriate compiler options (I use a make file that was initially written for winARM).
Any help fixing this error, and cleaning up a bit the warnings would be appreciated.
It is not clear what you are attempting here. It looks like you have built your own MAC version of arm-elf-gcc, and are trying to build a FreeRTOS demo. Which demo? Have you modified anything (linker script, source files, etc.), or are you trying a clean build?
Yes I built my own version of arm-elf-gcc, and for now I am trying to
compile the freeRTOS source code.
I am starting with a clean build, meaning I am not trying to compile a
demo project for now. I do have linker scripts and startup code that
do work on my platform. I understand that eventually I will need to
get startup code that initialize the CPU into a mode suitable for
freeRTOS. I guess that will be another issue, as I have to use a
bootloader that comes with specific startup code too. Some kind of
merging will be necessary.
Anyhow for now I’m just trying to have freeRTOS to compile on the
arm-elf toolchain I have installed on my Mac OS X machine. While doing
so, as explained in my initial email, I observed several critical
errors, like the one I pointed out.
The search path and definitions defined in the makefile have to be right to ensure the right header files get included in the right order. I would recommend starting with a makefile from a demo app, even if you don’t use the demo app main.c
Alright following your advice I am now reusing the LPC2106-GCC port.
Something must not be right with my install because now I am guessing this error:
command-line>: error: macro names must be identifiers
In file included from …/…/Source/include/portable.h:307,
from …/…/Source/include/FreeRTOS.h:70,
from …/…/Source/portable/GCC/ARM7_LPC2000/portISR.c:82:
From the comment in portable.h, I believe this is happening because portENTER_CRITICAL is not defined, because portMacro.h is not included yet.
However, I am now using all the code provided as is from the port. It seems portmacro.h has to be included before compiling freeRTOS. From what I see happening during the compilation process, portIsr.c is compiled first. portIsr.h includes “freeRTOS.h”, which includes “portable.h”, which seems to be generating this error because portENTER_CRITICAL is not defined (portMacro.h not included?).
Shouldn’t main.c be compiled first, as it includes all the freeRTOS headers? How do you control this? I guess portISR.c is compiled first because this is the only code compiled in ARM mode? - the rest being compiled in Thumb mode…
That demo can be built in one of four ways, each of which has a batch file to configure the definitions. Look at the .bat files in the Demo\ARM7_LPC2106_GCC directory. One of the batch files must be executed before make is called.
ok, I now use the content of the bat files to setup my environment.
While this cleared the error with portable.h not being included, I am now back to having the following error:
…/…/Source/portable/GCC/ARM7_LPC2000/portISR.c:143: error: static declaration of ‘vTickISR’ follows non-static declaration
…/…/Source/portable/GCC/ARM7_LPC2000/portISR.c:141: error: previous declaration of ‘vTickISR’ was here
I read on a forum that gcc treats this as an error while it should be a warning instead… I’m not to sure how to fix this is this is the case.
Alright, so there must be something wrong with my arm-elf version. I’m compiling from OS X.
arm-elf-gcc -version
arm-elf-gcc (GCC) 4.2.2
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
arm-elf-g++ -version
arm-elf-g++ (GCC) 4.2.2
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
The C compiler seems to consider that the __attribute__((naked)) makes the first prototype static., while the body of the function (next line) does not specify the attribute, and thus is not considered static…
I can compile and run code that uses ISRs. The code both does not use the naked attribute and also uses direct names for interrupt vector: void UNDEF_Routine(void) __attribute__ ((interrupt(“UNDEF”)));