Including 3rd party library headers?

James Fitzsimons james.fitzsimons at gmail.com
Sun Feb 2 09:47:42 UTC 2014


Hi all,

Thanks for all the advice so far.

I spent quite a bit of time the other night working my way through all the
RTEMS makefiles trying to understand how they all hang together.

I tried giving CPU_CFLAGS ago but that didn't work. So, after another look
at the makefiles I tried CFLAGS_FOR_TARGET which was successful!

I'm guessing it's ok to abuse that variable like this?

Cheers,
James


On 31 January 2014 22:06, Ralf Kirchner <ralf.kirchner at embedded-brains.de>wrote:

> Hi James,
> For my current target CFLAGS get composed and passed to the compiler in
> bsp.mk which gets included over several stages from the application
> Makefile.
> I suppose for your BSP it will be similar.
>
> In my case the relevant part of the file looks like:
> ...
> include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg
>
> DEPFLAGS = -MT $@ -MD -MP -MF $(basename $@).d
> SYSFLAGS = -B $(PROJECT_LIB) -specs bsp_specs -qrtems
> WARNFLAGS = -Wall -Wextra -Wformat=2 -Wcast-qual -Wconversion
> -Wno-unused-parameter
> OPTFLAGS = $(CFLAGS_OPTIMIZE_V)
>
> CFLAGS = $(DEPFLAGS) $(SYSFLAGS) $(WARNFLAGS) $(CPU_CFLAGS) $(OPTFLAGS)
> CXXFLAGS = $(DEPFLAGS) $(SYSFLAGS) $(WARNFLAGS) $(CPU_CFLAGS) $(OPTFLAGS)
> LINKFLAGS = $(SYSFLAGS) $(CPU_CFLAGS) $(LDFLAGS) $(OPTFLAGS)
> ASFLAGS = $(CPU_CFLAGS)
>
> CCLINK = $(CC) $(LINKFLAGS) -Wl,-Map,$(basename $@).map
> CXXLINK = $(CXX) $(LINKFLAGS) -Wl,-Map,$(basename $@).map
>
> $(BUILDDIR)/%.o: %.c
>         $(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
> ..
>
> Thus apending your include files to CFLAGS won't work. I am not sure if
> that would work but you might give CPU_CFLAGS a try instead.
>
>
> Am 30.01.2014 11:19, schrieb James Fitzsimons:
> > I tried CFLAGS as suggested and it seems to be completely ignored. My
> > application Makefile now looks like this:
> >
> > PGM=${ARCH}/rtems-hello.exe
> >
> > # optional managers required
> > MANAGERS=all
> >
> > # C source names
> > CSRCS = rtems-hello.c
> > COBJS = $(CSRCS:%.c=${ARCH}/%.o)
> > CFLAGS += -I/home/james/Projects/development/motorobots/include
> >
> > MOTOROBOTS_LIBS = /opt/motorobots/68332/lib
> > #LD_PATHS +=
> > LD_LIBS += $(MOTOROBOTS_LIBS)/liblcd.a  $(MOTOROBOTS_LIBS)/libled.a
> >
> > include $(RTEMS_MAKEFILE_PATH)/Makefile.inc
> > include $(RTEMS_CUSTOM)
> > include $(PROJECT_ROOT)/make/leaf.cfg
> >
> > OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS)
> >
> > all:    ${ARCH} $(PGM)
> >
> > $(PGM): $(OBJS) ${LINK_FILES}
> > $(make-exe)
> >
> > and running make looks like:
> >
> > hello$ make
> > test -d o-optimize || mkdir o-optimize
> > m68k-rtems4.10-gcc --pipe
> >
> -B/home/james/Projects/development/rtems/rtems-mrm332/m68k-rtems4.10/mrm332/lib/
> > -specs bsp_specs -qrtems   -g -Wall  -O2 -g -fomit-frame-pointer -g
> >  -mcpu=cpu32     -c   -o o-optimize/rtems-hello.o rtems-hello.c
> > rtems-hello.c:6:27: error: 68332/mrm/led.h: No such file or directory
> > rtems-hello.c:7:27: error: 68332/mrm/lcd.h: No such file or directory
> > ....
> >
> >
> > As you can see the include path doesn't appear in the gcc command.
> >
> > I've read the make/README and can't see anything relavant in there. Am I
> > missing something really obvious here?
> >
> > Thanks for any help you can provide!
> > James
> >
> >
> > On 30 January 2014 13:38, James Fitzsimons <james.fitzsimons at gmail.com
> > <mailto:james.fitzsimons at gmail.com>> wrote:
> >
> >     Thanks very much guys,
> >
> >     I'm thought I'd tried CFLAGS, but I obviously didn't have something
> >     quite right so I'll give it another shot.
> >
> >     I'll definitely look into Eclipse - I've used it before for C/C++
> >     stuff and found it excellent. I'm trying to start out pretty vanilla
> >     with RTEMS just so I get a really good handle on how the whole build
> >     process works (there are a LOT of makefiles to understand) as I've
> >     found with other tools that an IDE can often make things nice and
> >     easy until it goes wrong, and if you don't understand what it's
> >     doing under the hood you are all of a sudden in very deep water.
> >
> >     Cheers!
> >     James
> >
> >
> >     On 30 January 2014 12:53, Simon Williams <williamssimonp at gmail.com
> >     <mailto:williamssimonp at gmail.com>> wrote:
> >
> >         Ah, -I and CFLAGS it is then.  That'll teach me to read posts
> >         properly and not just skim them! :-)
> >
> >         I started using Eclipse for Java, but I moved to using Netbeans
> >         as I prefer it, but Eclipse with CDT is a grest C/C++ IDE and
> >         the RTEMS plug in makes RTEMS development more productive than
> >         vi. I don't really know of an alternative iif you want an IDE
> >         for RTEMS, but that may be just because I've not looked.
> >
> >         Regards
> >
> >         Simon
> >
> >         On 29 Jan 2014 23:36, "Nick Withers" <nick.withers at anu.edu.au
> >         <mailto:nick.withers at anu.edu.au>> wrote:
> >
> >             On Wed, 2014-01-29 at 23:31 +0000, Simon Williams wrote:
> >             > Wouldn't thst be -L for the lbrary path? The -l option is
> >             usef to
> >             > specify a library.
> >             >
> >             > Also, linker flags are usually in LDFLAGS, CFLAGS is for
> >             compiler
> >             > flags. It does of course depend on your Makefile.
> >
> >             It's include paths he's after, which are for the compiler.
> >
> >             > I would recommend Eclipse. It won't do everything for you,
> >             but it can
> >             > help by pointing the way!
> >
> >             I've heard a lot of good things about Eclipse. I've got a
> >             personal peeve
> >             against Java and that's really all that's kept me from
> >             trying it!
> >
> >             > Regards
> >             >
> >             > Simon
> >             >
> >             > On 29 Jan 2014 22:18, "Nick Withers"
> >             <nick.withers at anu.edu.au <mailto:nick.withers at anu.edu.au>>
> >             wrote:
> >             >         On Wed, 2014-01-29 at 22:29 +1300, James
> >             Fitzsimons wrote:
> >             >         > Thanks Andrei,
> >             >         >
> >             >         >
> >             >         > I'm using a very plain vanilla environment at
> >             the moment.
> >             >         Ubuntu 13.10
> >             >         > with tool chain built using rtems source builder.
> >             >         >
> >             >         >
> >             >         > I'm using the template makefile for my test
> >             application, and
> >             >         am just
> >             >         > running make directly from bash.
> >             >         >
> >             >         >
> >             >         > No IDE or fancy build environment yet!
> >             >
> >             >         I'd've said the RTEMS'provided Makefiles (there
> >             are a number
> >             >         of them,
> >             >         chained together) are pretty fancy... But then, I
> >             have trouble
> >             >         with just
> >             >         one Makefile :-P
> >             >
> >             >         Anyway, try:
> >             >                 CFLAGS+=-I/bam/headers
> >             >
> >             >         > Cheers,
> >             >         > James
> >             >         >
> >             >         >
> >             >         > On 29 January 2014 17:01, Andrei Chichak
> >             <groups at chichak.ca <mailto:groups at chichak.ca>>
> >             >         wrote:
> >             >         >         I believe what Sebastian is referring to
> >             is the
> >             >         environment
> >             >         >         that you are using for your compiles. In
> >             my case, I
> >             >         am using a
> >             >         >         Mac and Eclipse, I set <C/C++
> >             Build><Settings><Tool
> >             >         >         Settings><RTEMS C
> >             Compiler><Preprocessor><Include
> >             >         Paths (-I)>.
> >             >         >
> >             >         >         Your milage will vary, but if you tell
> >             us what you
> >             >         are
> >             >         >         driving, there may be someone here that
> >             can help.
> >             >         >
> >             >         >         Andrei
> >             >         >
> >             >         >
> >             >         >         On 2014-January-28, at 2:11 PM, James
> >             Fitzsimons
> >             >         >         <james.fitzsimons at gmail.com
> >             <mailto:james.fitzsimons at gmail.com>> wrote:
> >             >         >
> >             >         >         > Hi Sebastian,
> >             >         >         >
> >             >         >         > Thanks for your reply.
> >             >         >         >
> >             >         >         > Ideally I was hoping to us the -I
> >             option to
> >             >         specify the
> >             >         >         header file location, I just can't quite
> >             figure out
> >             >         where to
> >             >         >         add that into the RTEMS makefile
> >             structure. Looking
> >             >         at the
> >             >         >         make/README I can see a good example of
> >             how to link
> >             >         in other
> >             >         >         libraries using LD_LIBS, but there's
> >             nothing about
> >             >         including
> >             >         >         other header files.
> >             >         >         >
> >             >         >         > Apologies if I am missing something
> >             obvious!
> >
> >             --
> >             Nick Withers
> >
> >             Embedded Systems Programmer
> >             Department of Nuclear Physics, Research School of Physics
> >             and Engineering
> >             The Australian National University (CRICOS: 00120C)
> >
> >
> >
> >
> >
> > _______________________________________________
> > rtems-users mailing list
> > rtems-users at rtems.org
> > http://www.rtems.org/mailman/listinfo/rtems-users
> >
>
>
> --
> --------------------------------------------
> Embedded Brains GmbH
> Ralf Kirchner          Dornierstr. 4
> D-82178 Puchheim       Germany
> email: ralf.kirchner at embedded-brains.de
> Phone: +49-89-18 94 741-17
> Fax:   +49-89-18 94 741-08
>
> Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
> _______________________________________________
> rtems-users mailing list
> rtems-users at rtems.org
> http://www.rtems.org/mailman/listinfo/rtems-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20140202/7476b471/attachment.html>


More information about the users mailing list