EmbDev.net

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


Author: Liang Bowen (Company: personel) (liangbowen)
Posted on:

Rate this post
0 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
###################################

Author: Michael Fischer (mifi)
Posted on:

Rate this post
0 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

Author: Liang Bowen (Company: personel) (liangbowen)
Posted on:

Rate this post
0 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.

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.