EmbDev.net

Forum: ARM programming with GCC/GNU tools yagarto-tools make error. "Expecting macro or rule defn"


von Liang B. (Company: personel) (liangbowen)


Rate this post
useful
not useful
I am trying to compile atmel at91sam7s-ek  getting-started-project with 
yagarto. I've configured CHIP/BOARD/CROSS_COMPILE correct. But when I 
stat to make, it prompted "make:  makefile:  line 128:  Error -- 
Expecting macro or rule defn, found neither".

And line 128 is " define rules ". Is that because the make.exe too old 
to recognize the "define" command?  But I'm using the latest 
yagarto-tools-20091223.

######## Makefile ###########
..
all: $(BIN) $(OBJ) $(MEMORIES)

$(BIN) $(OBJ):
  mkdir $@
# The following line is line 128.
define rules

C_OBJECTS_$(1) = $(addprefix $(OBJ)/$(1)_, $(C_OBJECTS))
ASM_OBJECTS_$(1) = $(addprefix $(OBJ)/$(1)_, $(ASM_OBJECTS))

$(1): $$(ASM_OBJECTS_$(1)) $$(C_OBJECTS_$(1))
  $(CC) $(LDFLAGS) -T"$(AT91LIB)/boards/$(BOARD)/$(CHIP)/$$@.lds" -o 
$(OUTPUT)-$$@.elf $$^
  $(OBJCOPY) -O binary $(OUTPUT)-$$@.elf $(OUTPUT)-$$@.bin
  $(SIZE) $$^ $(OUTPUT)-$$@.elf

$$(C_OBJECTS_$(1)): $(OBJ)/$(1)_%.o: %.c Makefile $(OBJ) $(BIN)
  $(CC) $(CFLAGS) -D$(1) -c -o $$@ $$<

$$(ASM_OBJECTS_$(1)): $(OBJ)/$(1)_%.o: %.S Makefile $(OBJ) $(BIN)
  $(CC) $(ASFLAGS) -D$(1) -c -o $$@ $$<

debug_$(1): $(1)
  perl ../resources/gdb/debug.pl $(OUTPUT)-$(1).elf

endef

$(foreach MEMORY, $(MEMORIES), $(eval $(call rules,$(MEMORY))))

clean:
  -rm -f $(OBJ)/*.o $(BIN)/*.bin $(BIN)/*.elf
###################################

von Michael F. (mifi)


Rate this post
useful
not useful
Hello Liang,

no problem here, I have double check it again now.
Have you take a look here too:

http://www.yagarto.de/#errata

If I change the BOARD and CHIP like:

CHIP  = at91sam7s256
BOARD = at91sam7s-ek

and CROSS_COMPILE:

CROSS_COMPILE = arm-elf-

it works here. The version from my make is (make --version):

GNU Make 3.81
Copyright (C) 2006  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.

This program built for i686-pc-mingw32

Best regards,

Michael

von Liang B. (Company: personel) (liangbowen)


Rate this post
useful
not useful
sorry, my bad.
I've tried make --version before I stated the post. It echoed:

make --version
Usage:
make [-AeEhiknpqrsStTuvVx] [-P#] [-f file] [macro[*][+][:]=value ...] 
[target ...]

I thought it was a special version that yagarto builded.

After I saw your reply, I realized that there must be something wrong 
with the make.exe, then I swithed to the yagarto-tools-20091223\bin dir, 
and tried make --version. I saw the GUN prompt. Then I checked the 
system env vars, the system env var have linked make.exe to something 
else.

thanks & sorry.

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.