Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Thread

makefile

makefile

2004-10-26 by Abdul R Rafiq

Hi,

I am trying to setup my dev. environment using gnuarm and newlib3.  the
makefiles in newlib3 makes the entire lib.  Is there a sample makefile that
compiles one or two c files?  I tried to create makefile based on the one
that came with newlib, but the test2 program created using my makefile does
not work.  If I compile the entire newlib using its own makefile, then all
test programs work fine.

below is my makefile.  my target is TinyArm50 LPC2119.

thank you in advance.

Abdul



####################################

mdl = ARM

# GCC ARM
#cfgl are link/load parameters passed to ld
#-s means strip all symbols
#-v means verbose output
#-o $@ means use $@ as output filename
#$+ copies dependancies to link line

GNUARM_DIR = c:/gnuarm/
LPC_NEWLIB_DIR = c:/dvp/LPClib/

MSG_LINKING = Linking:
MSG_COMPILING = Compiling:

# Figure out where the libraries are
#SYS_LDFLAGS = ${shell arm-elf-gcc -print-search-dirs | grep ^libraries |
sed -e "s/^libraries:.*=/:/g" -e "s/ /\\\\ /g" -e "s/:/ -L /g"}
SYS_LDFLAGS = -L ${GNUARM_DIR}lib/gcc/arm-elf/3.4.1/ -L
${GNUARM_DIR}lib/gcc/ -L ${GNUARM_DIR}arm-elf/lib/arm-elf/3.4.1/ -L
${GNUARM_DIR}arm-elf/lib/ -L ${LPC_NEWLIB_DIR}

cfgl_arm = -v -o$@ -L. ${SYS_LDFLAGS} ${LPC_NEWLIB_DIR}crt0.o $+

# Compile command.
cfg_arm_gc = -c -I ${LPC_NEWLIB_DIR} -Os -o $@

######  The list of targets.
all: gccversion dep test9.hex test9.bin

###### List of all the sources.
sources = test9.c

    # Build dependencies for the link phase for all the test programs.

test9.prg: $(sources:.c=.o)
 @echo
 @echo $(MSG_LINKING) $@
 $(cl) $(linkfile_LPC2119)
 @echo
 $(csize) $@

#
# GNU Compiler ARM
#
ifeq ($(mdl),ARM)
  submdl = LPC210X
endif

ifeq ($(submdl),LPC210X)
  ar = arm-elf-ar
  cc = arm-elf-gcc
  cl = arm-elf-ld $(cfgl_arm)
  chex = arm-elf-objcopy -O ihex $< $@
  cbin = arm-elf-objcopy -O binary $< $@
  csize = arm-elf-size

        #  Providing a named linkfile option here allows programs for
        # multiple variants to be built using the same makefile.
  linkfile_LPC210X = -Tlpc210x.ld
  linkfile_LPC2119 = -Tlpc2119.ld

    ### Rules for building ###

        #  Build a dependancy file from a C file.  Uses the C compiler to
        # determine what files are included and filters the result to
        # produce a makefile target: dependancy list
%.d: %.c
 @set -e; rm -f $@; \
 $(cc) -I ${LPC_NEWLIB_DIR} -M $(clags) $< > $@.$$$$; \
 sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
 rm -f $@.$$$$

        #  How to add an object file to a library.
(%):
 $(ar) cr $@ $%

# Compile: create object files from C source files.
%.o : %.c
 @echo
 @echo $(MSG_COMPILING) $<
 $(cc) $(cfg_arm_gc) $<

        #  How to build an object file from an assembly file
%.o: %.s
 $(cc) $(cfg_arm_gc) $<

        #  How to create a hex file from the result produced by the
        # linker.
%.hex: %.prg
 @echo
 $(chex)

        #  How to create a bin file from the result produced by the
        # linker.
%.bin: %.prg
 $(cbin)

endif

dep : $(sources:.c=.d)
 @touch .depend

# Display compiler version information.
gccversion :
 @$(cc) --version


clean:
 rm -f *.o
 rm -f *.a
 rm -f *.hex
 rm -f *.prg
 rm -f *.d
 rm -f *.d.[0-9]*
 rm -f .depend

    # Include dependancies for all the the C source.
ifneq ($(wildward .depend),)
include $(sources:.c=.d)
endif

Re: [lpc2000] makefile

2004-10-27 by Robert Adsett

At 04:31 PM 10/26/04 -0700, you wrote:
>I am trying to setup my dev. environment using gnuarm and newlib3.  the
>makefiles in newlib3 makes the entire lib.  Is there a sample makefile that
>compiles one or two c files?  I tried to create makefile based on the one
>that came with newlib, but the test2 program created using my makefile does
>not work.  If I compile the entire newlib using its own makefile, then all
>test programs work fine.

It sounds like you are not actually linking in the newlib-lpc support.  One 
possibility is that the main newlib library is overriding the newlib-lpc 
support.

The first test would be to link the newlib_lpc object files directly with 
the test file.

If that works, the most likely problem is that the newlib library dummy 
hooks are getting linked in rather than the newlib_lpc routines.  In that 
case any I/O simply disappears into the moral equivalent of /dev/null. This 
has been run into before (I need to update the documentation) and the 
thread it was discussed in can be found at 
http://groups.yahoo.com/group/lpc2000/message/1714


Robert

" 'Freedom' has no meaning of itself.  There are always restrictions,
be they legal, genetic, or physical.  If you don't believe me, try to
chew a radio signal. "

                         Kelvin Throop, III

makefile

2005-06-27 by paloalgodon

I am looking for an example makefile.  I just got a 2106 demo board 
and got gnuarm installed, and I'm wondering if anyone can walk a 
newbie through the correct switches, etc.  I'm ok with make in 
general, just never played with an lpc machine.  I'd like that to 
change, obviously.  I didn't see any examples on the distribution, but 
maybe I'm just being naive?

Best,
Steve

Re: [lpc2000] makefile

2005-06-27 by Jim Parziale

A good way to start is FreeRTOS. This has to be one of the best examples in 
documentation I've seen, not to mention a really cool RTOS. The sample code 
specifically includes the LPC2106 demo board from Olimex, which is what I've 
been using to get started as well.

Good luck!

Jim 


On 6/27/05, paloalgodon <stevefranks@...> wrote:
> 
> I am looking for an example makefile. I just got a 2106 demo board
> and got gnuarm installed, and I'm wondering if anyone can walk a
> newbie through the correct switches, etc. I'm ok with make in
> general, just never played with an lpc machine. I'd like that to
> change, obviously. I didn't see any examples on the distribution, but
> maybe I'm just being naive?
> 
> Best,
> Steve
>


[Non-text portions of this message have been removed]

Re: makefile

2005-06-27 by lynchzilla

Hi Steve.

You might read my tutorial about "ARM Cross Development with Eclipse" 
which is listed in the "links" for this LPC2000 group. There's also a 
link to the sample programs associated with the tutorial. 

My makefile is compatible with GNU and is extremely simple.

The FreeRTOS is very, very cool but a bit to swallow for a newcomer.

Cheers,
Jim Lynch

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.