0

Compilation troubles
Moderator: adafruit

Please be positive and constructive with your questions and comments.

Compilation troubles

by Dan_K on Fri Dec 26, 2008 12:13 pm

Hi! First off, let me say thanks a lot for putting in the effort into creating and maintaining this project, it's been a lot of fun for me so far. However, I've run into a problem with compiling the Fuzebox's "Hello World" program, which I think is probably due to a misconfiguration on my part. I can get avrdude to talk to the Fuzebox perfectly fine, and I have been able to upload the sprites demo with no problems. Here's the output I get from the command prompt:

Code: Select all | TOGGLE FULL SIZE
C:\Users\Dan>avrdude -p m644 -c stk500v1 -P COM6

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.05s

avrdude: Device signature = 0x1e9609

avrdude: safemode: Fuses OK

avrdude done.  Thank you.

C:\fuzefirmware-v2b2\hello>make
      0 [main] sh 4416 sync_with_child: child 4928(0x108) died before initializa
tion with status code 0x0
    708 [main] sh 4416 sync_with_child: *** child state waiting for longjmp
/usr/bin/sh: fork: Resource temporarily unavailable
avr-gcc.exe -I.. -mmcu=atmega644 -Wall -gdwarf-2 -std=gnu99 -DF_CPU=28636360UL -
Os -DVIDEO_MODE=1 -fsigned-char -MD -MP -MT hello.o -MF dep/hello.o.d  -c  hello
.c
hello.c:19: fatal error: opening dependency file dep/hello.o.d: No such file or
directory
compilation terminated.
make: *** [hello.o] Error 1


As you can see it communicates with the Fuzebox, but I'm getting problems trying to compile the example. Do you have any suggestions I can try? I'm running on Vista x64 if that helps.

Dan

EDIT: I guess attaching my Makefile will probably help too! The Device Manager lists the device as "USB Serial Port (COM6)", so using that information I've set the AVRDUDE_PORT variable to com6. I'm using the FTDI cable so AVRDUDE_PROGRAMMER is stk500v1. These are the only two variables I have changed.
Code: Select all | TOGGLE FULL SIZE
###############################################################################
# Makefile for the project Hello
###############################################################################

## General Flags
PROJECT = hello
VIDEOMODE = 1

# Change if your programmer is different
AVRDUDE_PROGRAMMER = stk500v1
AVRDUDE_PORT = com6      # programmer connected to serial device

# Don't change unless you really know whats going on
MCU = atmega644
TARGET = $(PROJECT).elf
CC = avr-gcc.exe


## Options common to compile, link and assembly rules
COMMON = -mmcu=$(MCU)

## Compile options common for all C compilation units.
CFLAGS = $(COMMON)
CFLAGS += -Wall -gdwarf-2 -std=gnu99 -DF_CPU=28636360UL -Os -DVIDEO_MODE=$(VIDEOMODE) -fsigned-char
CFLAGS += -MD -MP -MT $(*F).o -MF dep/$(@F).d

## Assembly specific flags
ASMFLAGS = $(COMMON)
ASMFLAGS += $(CFLAGS)
ASMFLAGS += -x assembler-with-cpp -Wa,-gdwarf2

## Linker flags
LDFLAGS = $(COMMON)
LDFLAGS +=  -Wl,-Map=$(PROJECT).map

INCLUDES = -I..


## Intel Hex file production flags
HEX_FLASH_FLAGS = -R .eeprom

HEX_EEPROM_FLAGS = -j .eeprom
HEX_EEPROM_FLAGS += --set-section-flags=.eeprom="alloc,load"
HEX_EEPROM_FLAGS += --change-section-lma .eeprom=0 --no-change-warnings


## Objects that must be built in order to link
OBJECTS = $(PROJECT).o uzeboxCore.o uzeboxSoundEngine.o uzeboxSoundEngineCore.o uzeboxVideoEngine.o uzeboxVideoEngineCore.o

## Objects explicitly added by the user
LINKONLYOBJECTS =

AVRDUDE = avrdude
AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)

## Build
all: $(TARGET) $(PROJECT).hex $(PROJECT).eep $(PROJECT).lss size

# Program the device. 
program: $(PROJECT).hex $(PROJECT).eep   
   $(AVRDUDE) $(AVRDUDE_FLAGS) -B 1 -U flash:w:$<

## Compile
uzeboxSoundEngineCore.o: ../kernel/uzeboxSoundEngineCore.s
   $(CC) $(INCLUDES) $(ASMFLAGS) -c  $<

uzeboxVideoEngineCore.o: ../kernel/uzeboxVideoEngineCore.s
   $(CC) $(INCLUDES) $(ASMFLAGS) -c  $<

$(PROJECT).o: $(PROJECT).c
   $(CC) $(INCLUDES) $(CFLAGS) -c  $<

uzeboxCore.o: ../kernel/uzeboxCore.c
   $(CC) $(INCLUDES) $(CFLAGS) -c  $<

uzeboxSoundEngine.o: ../kernel/uzeboxSoundEngine.c
   $(CC) $(INCLUDES) $(CFLAGS) -c  $<

uzeboxVideoEngine.o: ../kernel/uzeboxVideoEngine.c
   $(CC) $(INCLUDES) $(CFLAGS) -c  $<

##Link
$(TARGET): $(OBJECTS)
    $(CC) $(LDFLAGS) $(INCFLAGS) $(OBJECTS) $(LINKONLYOBJECTS) $(LIBDIRS) $(LIBS) -o $(TARGET)

%.hex: $(TARGET)
   avr-objcopy -O ihex $(HEX_FLASH_FLAGS)  $< $@

%.eep: $(TARGET)
   -avr-objcopy $(HEX_EEPROM_FLAGS) -O ihex $< $@ || exit 0

%.lss: $(TARGET)
   avr-objdump -h -S $< > $@

size: ${TARGET}
   @echo
   @avr-size -C --mcu=${MCU} ${TARGET}

## Clean target
.PHONY: clean
clean:
   -rm -rf $(OBJECTS) $(PROJECT).elf dep/* $(PROJECT).hex $(PROJECT).eep $(PROJECT).lss $(PROJECT).map


## Other dependencies
-include $(shell mkdir dep 2>/dev/null) $(wildcard dep/*)
Dan_K
 
Posts: 12
Joined: Thu Dec 25, 2008 6:44 pm

Re: Compilation troubles

by Dan_K on Fri Dec 26, 2008 1:16 pm

Aha! After much more digging around I've found the source of the problem. I'll paste my solution here for any other users experiencing the same problem:

It's a bug that appears in WinAVR on Vista x64, which causes the sync_with_child error that I was experiencing above. In order to solve it, you need to download a replacement msys-1.0.dll which goes in utils/bin/ on the WinAVR installation. The replacement dll file can be found here, which can be retrieved from this page.
Dan_K
 
Posts: 12
Joined: Thu Dec 25, 2008 6:44 pm

Re: Compilation troubles

by adafruit on Fri Dec 26, 2008 1:51 pm

yay vista!

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

Re: Compilation troubles

by Dan_K on Fri Dec 26, 2008 3:16 pm

Hey, someone's got to be the guinea pig :P

I'm well on my way to making a Pong clone to get to grips with the kernel now. This is fun!

EDIT: Do you have an IRC channel by any chance?
Dan_K
 
Posts: 12
Joined: Thu Dec 25, 2008 6:44 pm

Re: Compilation troubles

by BrianC on Sun Dec 28, 2008 10:29 pm

ladyada wrote:yay vista!


Why do you assume it is Vista's fault, rather than the person that wrote the Cygwin DLL?

-Brian
We are all athiests; I just believe in one less god than you do. When you understand why you dismiss all the other possible gods, you will understand why I dismiss yours.
A refutation of Pascal's wager: http://www.geocities.com/paulntobin/pascal.html
BrianC
 
Posts: 1
Joined: Sun Dec 28, 2008 10:27 pm

Re: Compilation troubles

by adafruit on Sun Dec 28, 2008 11:13 pm

i didn't say it was vistas fault...this is a common occurrence when new OS's come out with non-backward-compatible apis. but he got it working which is good!

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

Please be positive and constructive with your questions and comments.