Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training




Loading

Compiling the LPC2000 port on OS X

Posted by ARMinator on May 16, 2010
Hello,

I've installed the arm-elf toolchain on my MAC OS X machine following these instructions: http://www.ethernut.de/en/documents/cross-toolchain-osx.html
I'm able to compile and I've checked the compiled file runs on my microcontroller.

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):

void vTickISR( void ) __attribute__((naked));
void vTickISR( void )


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.

Thanks!
Jean

RE: Compiling the LPC2000 port on OS X

Posted by Dave on May 16, 2010
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?

RE: Compiling the LPC2000 port on OS X

Posted by ARMinator on May 16, 2010
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.

Jean

RE: Compiling the LPC2000 port on OS X

Posted by Dave on May 16, 2010
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

RE: Compiling the LPC2000 port on OS X

Posted by ARMinator on May 16, 2010
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...



RE: Compiling the LPC2000 port on OS X

Posted by Dave on May 16, 2010
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.

RE: Compiling the LPC2000 port on OS X

Posted by ARMinator on May 16, 2010
Thank you for your reply.

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.

RE: Compiling the LPC2000 port on OS X

Posted by Dave on May 16, 2010
I just tried building that project with arm-elf-gcc V4.4.2 and did not get any warnings or errors output.

arm-elf-gcc -c -Wall -Wextra -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wsign-compare -Waggregate-return -Wstrict-prototypes
-Wmissing-prototypes -Wmissing-declarations -Wunused -D RUN_FROM_ROM -D GCC_ARM7 -I. -I../../Source/include -I../Common/include -mcpu=arm7
tdmi -Tlpc2106-rom.ld -O3 -fomit-frame-pointer -fno-strict-aliasing -fno-dwarf2-cfi-asm ../../Source/portable/GCC/ARM7_LPC2000/portISR.c -o
../../Source/portable/GCC/ARM7_LPC2000/portISR.o
arm-elf-gcc -c -Wall -Wextra -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wsign-compare -Waggregate-return -Wstrict-prototypes
-Wmissing-prototypes -Wmissing-declarations -Wunused -D RUN_FROM_ROM -D GCC_ARM7 -I. -I../../Source/include -I../Common/include -mcpu=arm7
tdmi -Tlpc2106-rom.ld -O3 -fomit-frame-pointer -fno-strict-aliasing -fno-dwarf2-cfi-asm serial/serialISR.c -o serial/serialISR.o
arm-elf-gcc -c -Wall -Wextra -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wsign-compare -Waggregate-return -Wstrict-prototype
s -Wmissing-prototypes -Wmissing-declarations -Wunused -D RUN_FROM_ROM -D GCC_ARM7 -I. -I../../Source/include -I../Common/include -mcpu=arm
7tdmi -Tlpc2106-rom.ld -O3 -fomit-frame-pointer -fno-strict-aliasing -fno-dwarf2-cfi-asm main.c -o main.o
arm-elf-gcc -c -Wall -Wextra -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wsign-compare -Waggregate-return -Wstrict-prototype
s -Wmissing-prototypes -Wmissing-declarations -Wunused -D RUN_FROM_ROM -D GCC_ARM7 -I. -I../../Source/include -I../Common/include -mcpu=arm
7tdmi -Tlpc2106-rom.ld -O3 -fomit-frame-pointer -fno-strict-aliasing -fno-dwarf2-cfi-asm serial/serial.c -o serial/serial.o
arm-elf-gcc -c -Wall -Wextra -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wsign-compare -Waggregate-return -Wstrict-prototype
s -Wmissing-prototypes -Wmissing-declarations -Wunused -D RUN_FROM_ROM -D GCC_ARM7 -I. -I../../Source/include -I../Common/include -mcpu=arm
7tdmi -Tlpc2106-rom.ld -O3 -fomit-frame-pointer -fno-strict-aliasing -fno-dwarf2-cfi-asm ParTest/ParTest.c -o ParTest/ParTest.o
arm-elf-gcc -c -Wall -Wextra -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wsign-compare -Waggregate-return -Wstrict-prototype
s -Wmissing-prototypes -Wmissing-declarations -Wunused -D RUN_FROM_ROM -D GCC_ARM7 -I. -I../../Source/include -I../Common/include -mcpu=arm
7tdmi -Tlpc2106-rom.ld -O3 -fomit-frame-pointer -fno-strict-aliasing -fno-dwarf2-cfi-asm ../Common/Minimal/integer.c -o ../Common/Minimal/in
teger.o
arm-elf-gcc -c -Wall -Wextra -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wsign-compare -Waggregate-return -Wstrict-prototype
s -Wmissing-prototypes -Wmissing-declarations -Wunused -D RUN_FROM_ROM -D GCC_ARM7 -I. -I../../Source/include -I../Common/include -mcpu=arm
7tdmi -Tlpc2106-rom.ld -O3 -fomit-frame-pointer -fno-strict-aliasing -fno-dwarf2-cfi-asm ../Common/Minimal/flash.c -o ../Common/Minimal/flas
h.o
arm-elf-gcc -c -Wall -Wextra -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wsign-compare -Waggregate-return -Wstrict-prototype
s -Wmissing-prototypes -Wmissing-declarations -Wunused -D RUN_FROM_ROM -D GCC_ARM7 -I. -I../../Source/include -I../Common/include -mcpu=arm
7tdmi -Tlpc2106-rom.ld -O3 -fomit-frame-pointer -fno-strict-aliasing -fno-dwarf2-cfi-asm ../Common/Minimal/PollQ.c -o ../Common/Minimal/Poll
Q.o
arm-elf-gcc -c -Wall -Wextra -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wsign-compare -Waggregate-return -Wstrict-prototype
s -Wmissing-prototypes -Wmissing-declarations -Wunused -D RUN_FROM_ROM -D GCC_ARM7 -I. -I../../Source/include -I../Common/include -mcpu=arm
7tdmi -Tlpc2106-rom.ld -O3 -fomit-frame-pointer -fno-strict-aliasing -fno-dwarf2-cfi-asm ../Common/Minimal/comtest.c -o ../Common/Minimal/co
mtest.o
arm-elf-gcc -c -Wall -Wextra -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wsign-compare -Waggregate-return -Wstrict-prototype
s -Wmissing-prototypes -Wmissing-declarations -Wunused -D RUN_FROM_ROM -D GCC_ARM7 -I. -I../../Source/include -I../Common/include -mcpu=arm
7tdmi -Tlpc2106-rom.ld -O3 -fomit-frame-pointer -fno-strict-aliasing -fno-dwarf2-cfi-asm ../Common/Minimal/flop.c -o ../Common/Minimal/flop.
o
arm-elf-gcc -c -Wall -Wextra -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wsign-compare -Waggregate-return -Wstrict-prototype
s -Wmissing-prototypes -Wmissing-declarations -Wunused -D RUN_FROM_ROM -D GCC_ARM7 -I. -I../../Source/include -I../Common/include -mcpu=arm
7tdmi -Tlpc2106-rom.ld -O3 -fomit-frame-pointer -fno-strict-aliasing -fno-dwarf2-cfi-asm ../Common/Minimal/semtest.c -o ../Common/Minimal/se
mtest.o
arm-elf-gcc -c -Wall -Wextra -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wsign-compare -Waggregate-return -Wstrict-prototype
s -Wmissing-prototypes -Wmissing-declarations -Wunused -D RUN_FROM_ROM -D GCC_ARM7 -I. -I../../Source/include -I../Common/include -mcpu=arm
7tdmi -Tlpc2106-rom.ld -O3 -fomit-frame-pointer -fno-strict-aliasing -fno-dwarf2-cfi-asm ../Common/Minimal/dynamic.c -o ../Common/Minimal/dy
namic.o
arm-elf-gcc -c -Wall -Wextra -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wsign-compare -Waggregate-return -Wstrict-prototype
s -Wmissing-prototypes -Wmissing-declarations -Wunused -D RUN_FROM_ROM -D GCC_ARM7 -I. -I../../Source/include -I../Common/include -mcpu=arm
7tdmi -Tlpc2106-rom.ld -O3 -fomit-frame-pointer -fno-strict-aliasing -fno-dwarf2-cfi-asm ../Common/Minimal/BlockQ.c -o ../Common/Minimal/Blo
ckQ.o
arm-elf-gcc -c -Wall -Wextra -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wsign-compare -Waggregate-return -Wstrict-prototype
s -Wmissing-prototypes -Wmissing-declarations -Wunused -D RUN_FROM_ROM -D GCC_ARM7 -I. -I../../Source/include -I../Common/include -mcpu=arm
7tdmi -Tlpc2106-rom.ld -O3 -fomit-frame-pointer -fno-strict-aliasing -fno-dwarf2-cfi-asm ../../Source/tasks.c -o ../../Source/tasks.o
arm-elf-gcc -c -Wall -Wextra -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wsign-compare -Waggregate-return -Wstrict-prototype
s -Wmissing-prototypes -Wmissing-declarations -Wunused -D RUN_FROM_ROM -D GCC_ARM7 -I. -I../../Source/include -I../Common/include -mcpu=arm
7tdmi -Tlpc2106-rom.ld -O3 -fomit-frame-pointer -fno-strict-aliasing -fno-dwarf2-cfi-asm ../../Source/queue.c -o ../../Source/queue.o
arm-elf-gcc -c -Wall -Wextra -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wsign-compare -Waggregate-return -Wstrict-prototype
s -Wmissing-prototypes -Wmissing-declarations -Wunused -D RUN_FROM_ROM -D GCC_ARM7 -I. -I../../Source/include -I../Common/include -mcpu=arm
7tdmi -Tlpc2106-rom.ld -O3 -fomit-frame-pointer -fno-strict-aliasing -fno-dwarf2-cfi-asm ../../Source/list.c -o ../../Source/list.o
arm-elf-gcc -c -Wall -Wextra -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wsign-compare -Waggregate-return -Wstrict-prototype
s -Wmissing-prototypes -Wmissing-declarations -Wunused -D RUN_FROM_ROM -D GCC_ARM7 -I. -I../../Source/include -I../Common/include -mcpu=arm
7tdmi -Tlpc2106-rom.ld -O3 -fomit-frame-pointer -fno-strict-aliasing -fno-dwarf2-cfi-asm ../../Source/portable/MemMang/heap_2.c -o ../../Sou
rce/portable/MemMang/heap_2.o
arm-elf-gcc -c -Wall -Wextra -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wsign-compare -Waggregate-return -Wstrict-prototype
s -Wmissing-prototypes -Wmissing-declarations -Wunused -D RUN_FROM_ROM -D GCC_ARM7 -I. -I../../Source/include -I../Common/include -mcpu=arm
7tdmi -Tlpc2106-rom.ld -O3 -fomit-frame-pointer -fno-strict-aliasing -fno-dwarf2-cfi-asm ../../Source/portable/GCC/ARM7_LPC2000/port.c -o ..
/../Source/portable/GCC/ARM7_LPC2000/port.o
arm-elf-gcc -Wall -Wextra -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wsign-compare -Waggregate-return -Wstrict-prototypes -W
missing-prototypes -Wmissing-declarations -Wunused -D RUN_FROM_ROM -D GCC_ARM7 -I. -I../../Source/include -I../Common/include -mcpu=arm7tdm
i -Tlpc2106-rom.ld -O3 -fomit-frame-pointer -fno-strict-aliasing -fno-dwarf2-cfi-asm ../../Source/portable/GCC/ARM7_LPC2000/portISR.o serial
/serialISR.o main.o serial/serial.o ParTest/ParTest.o ../Common/Minimal/integer.o ../Common/Minimal/flash.o ../Common/Minimal/PollQ.o ../Com
mon/Minimal/comtest.o ../Common/Minimal/flop.o ../Common/Minimal/semtest.o ../Common/Minimal/dynamic.o ../Common/Minimal/BlockQ.o ../../Sour
ce/tasks.o ../../Source/queue.o ../../Source/list.o ../../Source/portable/MemMang/heap_2.o ../../Source/portable/GCC/ARM7_LPC2000/port.o -no
startfiles boot.s -Xlinker -ortosdemo.elf -Xlinker -M -Xlinker -Map=rtosdemo.map
arm-elf-objcopy rtosdemo.elf -O ihex rtosdemo.hex

RE: Compiling the LPC2000 port on OS X

Posted by ARMinator on May 16, 2010
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.


Do you have any further checks your recommend?

RE: Compiling the LPC2000 port on OS X

Posted by Dave on May 16, 2010
Only to ensure that portASM.c is being compiled to ARM mode, otherwise it will not work, although might still compile.

I have done a thorough check and cannot find vTickISR() declared static anywhere in the whole directory tree.

RE: Compiling the LPC2000 port on OS X

Posted by Dave on May 16, 2010
Also, I am not using G++.

RE: Compiling the LPC2000 port on OS X

Posted by ARMinator on May 16, 2010
I'm not using g++ either, I though I would just trow the version I'm using since gcc and g++ come together.

The specific error I'm pointing out happens at this section of the code in portisr.c:

void vTickISR( void ) __attribute__((naked));
void vTickISR( void )
{

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")));

RE: Compiling the LPC2000 port on OS X

Posted by ARMinator on May 16, 2010
Alright, got it to compile, finally.

I had to remove this attribute: -fno-dwarf2-cfi-asm

Apparently it's not supported with the GCC version we get on OS X...


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists