Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

Compile problem

2009-12-05 by Marc R.J. Brevoort

Hi all,

I've got a program that sends MIDI on an ATtiny2313.

http://ringbreak.dnd.utwente.nl/~mrjb/electro/midisender.c

I've also got a make file, as follows:
CC=avr-gcc
#HEADERS=-I /usr/src/linux-headers-2.6.24-19/include/asm-avr32/
CFLAGS=-g -Os -Wall -mcall-prologues -mmcu=attiny2313 $(HEADERS)
#CFLAGS=-g -Os -Wall -mcall-prologues -mmcu=atmega8 $(HEADERS)
OBJ2HEX=/usr/bin/avr-objcopy
UISP=/usr/local/bin/uisp
TARGET=midisender

program : $(TARGET).hex
         avrdude -c usbtiny -p m8 -e
         avrdude -c usbtiny -p m8 -U flash:w:$(TARGET).hex:i
%.obj : %.o
         $(CC) $(CFLAGS) $< -o $@

%.hex : %.obj
         $(OBJ2HEX) -R .eeprom -O ihex $< $@

clean :
         rm -f *.hex *.obj *.o

I want to use the code with an ATmega8 and have hooked up the
ATmega8 appropriately.

Now for the strange thing: I compiled the source with the
above makefile (for the wrong microcontroller: attiny2313) and
ran it on the ATmega8. It ran just fine.

I then proceeded to add ADC code and found out the Makefile was
wrong. To make sure all was still working, I removed the ADC code
again and compiled for ATmega8. No MIDI output. I commented the
ATmega8 line and restored the ATtiny2313 options, recompiled it
and wrote it to the ATmega8- it worked.

So if I compile it for ATtiny2313 and run it on ATmega8 it works.
But if I compile for ATmega8 and run the same code on ATmega8, I
get no MIDI output.

I'm baffled. Why does my code not work on ATmega8 if I compiled
for the ATmega8?

Thanks in advance,
Marc

Attachments

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.