EmbDev.net

Forum: ARM programming with GCC/GNU tools Newbie needs help with make file and WinARM


von Jonathan Y. (jony)


Rate this post
useful
not useful
I'm new to the idea of a make file, and I need help.

My make file is as follows:

objects = CM_funcs.o \
  add-table.o

libsphinx2.lib : $(objects)
  arm-elf-ar rvu libsphinx2.lib $(objects)
  c:/WinARM/arm-elf/bin/ranlib libsphinx2.lib

$(objects): %.o: %.c
  arm-elf-gcc -c $< -o $@


Both CM_funcs and add-table use a header "s2types.h"
The problem I'm having is that at the command line I get the following
error

add-table.c:51:21: error: s2types.h: No such file or directory


Now the file "s2types.h" is in the same directory (because the use of
VPATH or vpath didnt work)

My question is, why can CM_funcs.c see "s2types.h" and add-table.c
cannot?

Thanks in advance for any feedback

von Martin Thomas (Guest)


Rate this post
useful
not useful
jonathan ymessa wrote:
> I'm new to the idea of a make file, and I need help.
>
> My make file is as follows:
>
> objects = CM_funcs.o \
>   add-table.o
>
> libsphinx2.lib : $(objects)
>   arm-elf-ar rvu libsphinx2.lib $(objects)
>   c:/WinARM/arm-elf/bin/ranlib libsphinx2.lib
>
> $(objects): %.o: %.c
>   arm-elf-gcc -c $< -o $@
>
>
> Both CM_funcs and add-table use a header "s2types.h"
> The problem I'm having is that at the command line I get the following
> error
>
> add-table.c:51:21: error: s2types.h: No such file or directory
>
>
> Now the file "s2types.h" is in the same directory (because the use of
> VPATH or vpath didnt work)
>
> My question is, why can CM_funcs.c see "s2types.h" and add-table.c
> cannot?
>
> Thanks in advance for any feedback

Maybe not a direct answer to your question:
Did you check the -I option for the compiler-frontend (arm-elf-gcc)?
With this option you can add additional directories to the list in which
the preprocessor searchs for header files. I have not used VPATH so far,
since -I did work for me. Maybe the makefile for my ARM-port of the EFSL
is a useful template - see INCLUDEDIRS. It creates a .a-file not a .lib
file.

# efsl library makefile for LPC2000
# by Martin Thomas
# (based on the efsl avr- and the WinARM-template makefiles)

MCU   = arm7tdmi-s
THUMB = -mthumb -mthumb-interwork

COPT= -mcpu=$(MCU) $(THUMB) -gdwarf-2 -Wall -Os
INCLUDEDIRS=-Iinc -Iconf
CFLAGS=$(COPT) $(INCLUDEDIRS)
CC=arm-elf-gcc
AR=arm-elf-ar
OBJCOPY=arm-elf-objcopy
OBJ=src/efs.o src/plibc.o src/disc.o src/partition.o src/time.o src/fs.o
src/fat.o src/file.o src/dir.o src/mkfs.o src/debug.o src/ioman.o
src/ui.o src/extract.o src/interfaces/sd.o
OBJ+=src/ls.o
OBJ+=src/interfaces/efsl_dbg_printf_arm.o
OBJ+=src/interfaces/lpc2000_spi.o

all: lib

lib: $(OBJ)
  $(AR) rcs libefsl.a $(OBJ)

clean :
  rm -f $(OBJ) libefsl.a



for the complete code which may serve as example see:
http://www.siwawi.arubi.uni-kl.de/avr_projects/arm_projects/efsl_arm/index.html

Martin Thomas

von FordP (Guest)


Rate this post
useful
not useful
May I suggest a different approach.

First download the nearest demo from the WinARM site. Get that building
and running and then modify to add your code.

This uses the first rule of engineering "Do not reinvent the wheel".

As a further hint, if you intend to use interrupts start with a demo
that uses interrupts as that is the hardest code to add later from my
experience.

Good Luck.

von AndyK (Guest)


Rate this post
useful
not useful
Hi,


> objects = CM_funcs.o \
>   add-table.o
>
> libsphinx2.lib : $(objects)
>   arm-elf-ar rvu libsphinx2.lib $(objects)
>   c:/WinARM/arm-elf/bin/ranlib libsphinx2.lib
>
> $(objects): %.o: %.c
>   arm-elf-gcc -c $< -o $@
>

Try to write variable "objects" in this way

objects = CM_funcs.o add-table.o

If you have many files use

objects = CM_funcs.o
objects += add-table.o

Try not to use '-' character in names of files.

Andy

von Jonathan Y. (jony)


Rate this post
useful
not useful
Cheers guys for your insight

I was looking at some examples and I saw the -I command option for
arm-elf-gcc soon after I posted this, though I have yet to check it
works.

BTW its good to know this forum is active :)

Cheers
Jonathan

von Clifford S. (clifford)


Rate this post
useful
not useful
Are all three files in the same folder?

If so make sure you use:

#include "s2types.h"

rather than:

#include <s2types.h>

This is not really an issue with your make file - the error is a
compiler (or rather a pre-processor) error. It is more helpful in these
situations to post the entire compile log and the code or at least a
code fragment. You should be able to reproduce this error with very
little code - in fact just the #include lines should do it.

Clifford

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.