On Wed, 2005-10-12 at 12:58 -0700, Cullen Newsom wrote:
> Does anyone want to tell me all the undocumented* tricks to
> getting a working dev environment for avr-gcc on ubuntu with the
> stk200 and either it's programmer, or with avrisp?  Anyone have
> a makefile that might work?

Hi Cullen,

Nice to see an Ubuntu fellow, looks like after a year hard work, they
are starting to spread  :o)

I didn't have much problem getting up to speed with the tool chain, as
avr-libc, binutils-avr, gcc-avr, gdb-avr where all available from the
Ubuntu repository (need to enable 'universe' though), so they are only a
click away in Synaptic (or apt-get at the command line).
Avrdude was not in the repository though, so I had to compile it from
source, which was not straightforward, but wasn't too bad either. I made
a ready to use DEB package if you want, which I compiled on 'Breezy' (to
be released today ! :-), if you are really lazy ;-)

As for the STK200, I don't use it, but most probably (?) avrdude
supports it, just specify it at the command line when firing avrdude.

For the Makefile, David Kelly sent me one that works great, been using
it for a few weeks now, projects has 7 different modules and works a
treat :-) I attached it to this mail as it's small. Just modify it to
suit your particular chip model, and source files, and that's it.


HTH


--
Vince
#
#$Id: Makefile,v 1.37 2005/08/23 17:35:35 dkelly Exp $
#
CC= avr-gcc
#MCU=atmega8
#MCU=atmega16
MCU=atmega32
#MCU=atmega163
#MCU=atmega323
#MCU=atmega64
#MCU=atmega128

#CFLAGS= -O -gdwarf-2 -Wall -ffreestanding -mmcu=$(MCU)
CFLAGS= -O -g -Wall -ffreestanding -mmcu=$(MCU)


#  .eeprom section start must match here and in _eeprom.hex rule:
LDFLAGS= -Wl,-Map,[EMAIL PROTECTED] -Wl,--section-start=.eeprom=00810001
#-Wl, -u,vfprintf -lprintf_min 
#-Wl, -u,vfprintf -lprintf_flt -lm

.SUFFIXES:
.SUFFIXES: .c .o .bin .elf .hex .srec .cof .list

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

.elf.bin:
	avr-objcopy -R .eeprom -O binary $< $@


#  Note this GNU Make syntax is bass-ackwards from BSD suffix conversion
#  but it allows changing more than the suffix in generated target.

%_flash.hex: %.elf
	avr-objcopy -j .text -j .data -O ihex $< $@

%_eeprom.hex: %.elf
	avr-objcopy -j .eeprom --change-section-lma .eeprom=0 -O ihex $< $@

#
#  This is a fun conversion, creates an assembly dump
#  including C source lines interspersed as comments.
#
.elf.list:
	avr-objdump -DS $< > $@

#  one per line makes diffs easier to read
SRCS = \
	main.c \
	lcd.c \
	menu.c \
	ui.c \
	kb.c \
	rs.c \
	k-line.c \
	encoder.c

OBJS = $(SRCS:.c=.o)

all:	object.elf object.list object_flash.hex object_eeprom.hex

object.elf: $(OBJS)
	$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(OBJS) $(LDLIBS)
	avr-size $@

clean:
	rm -f *~ *.elf *.cof *.bin *.hex *.srec *.s *.o *.pdf *core *.list *.map .depend

# BSD make automatically reads .depend if it exists
depend: clean $(SRCS)
	$(CC) -E -M $(SRCS) > .depend

# -include fails silently in GNU Make if .depend does not exist
# OTOH -include is not BSD Make compatible.
-include .depend

_______________________________________________
AVR-GCC-list mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Reply via email to