[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] Re: [avr-chat] Kdevelop for avr-gcc?
From: |
Matthew MacClary |
Subject: |
Re: [avr-gcc-list] Re: [avr-chat] Kdevelop for avr-gcc? |
Date: |
Sun, 6 Mar 2005 21:15:24 -0800 |
User-agent: |
Mutt/1.5.6i |
On Mon, Mar 07, 2005 at 08:06:42AM +0530, Kishore wrote:
> > It's under one of the options; you have to change the C compiler (to
> > avr-gcc), linker, etc that the IDE calls. Then you can use kdevelop as
> > an IDE. If you have a nice Makefile, you can also probably use it to
> > program your AVR, too.
>
> The real concern / need for an IDE for me is that in the past i have been
> spoiled by the use of IDEs and hence know nothing about project management
> and makefiles. I would ike to learn, but in my leisure. I would like to know
> a little more about how to get Kdevelop to work with the AVR. Getting the
> make file to simulate / program the chip would be a great add on, but at
> first i would need a makefile to be generated automatically. :)
>
> I'll be hoping to get more information. :)
I can give your more information about make if you want. I use
emacs and make as my development environment for all of my AVR
development under FreeBSD and Linux. It works great for me. I have a
template Makefile that I always use, modifying it for a new project is
basically a one line change. This Makefile was included in an example
directory under one of the WinAVR releases actually.
All you need to do to start a new project using this Makefile is
put the name of your main program file (with no extension) in for "PRG
=". Change the "MCU_TARGET =" line to the chip you are using.
This Makefile currently has my latest settings in it. You should
also change the "program:" and "verify:" targets so that it uses the
chip programmer that you actually have installed. Extra object files
you need should be listed under "OBJ =" and they will be built
automatically. Remember that all of the shell commands in the file
should start with a TAB even if the email doesn't come through that
way.
After modifying the Makefile, just type "make" from the directory
containing your source code to compile and program the chip.
-Matt
####### Makefile #######
PRG = tracker
# Change above to the name of your project with NO extension.
OBJ = $(PRG).o
MCU_TARGET = atmega128
OPTIMIZE = -Os # options are 1, 2, 3, s
DEFS =
LIBS = -lm
CC = avr-gcc
# Override is only needed by avr-lib build system.
override CFLAGS = -g -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) $(DEFS)
override LDFLAGS = -Wl,-Map,$(PRG).map
OBJCOPY = avr-objcopy
OBJDUMP = avr-objdump
program: $(PRG).hex
uisp -dprog=stk200 -dpart=atmega128 -dlpt=/dev/parport0 --erase
--upload if=$(PRG).hex
# uisp -dprog=stk200 -dpart=atmega128 -dlpt=/dev/ppi0 --erase --upload
if=$(PRG).hex # FreeBSD specific
verify: $(PRG).hex
uisp --verify -dprog=stk200 -dpart=atmega128 -dlpt=/dev/parport0
--erase --upload if=$(PRG).hex
# uisp --verify -dprog=stk200 -dpart=atmega128 -dlpt=/dev/ppi0 --erase
--upload if=$(PRG).hex # FreeBSD specific
all: $(PRG).elf lst text eeprom
$(PRG).elf: $(OBJ)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
clean:
rm -rf *.o $(PRG).elf *.eps *.png *.pdf *.bak
rm -rf *.lst *.map $(EXTRA_CLEAN_FILES) *~
lst: $(PRG).lst
%.lst: %.elf
$(OBJDUMP) -h -S $< > $@
# Rules for building the .text rom images
text: hex bin srec
hex: $(PRG).hex
bin: $(PRG).bin
srec: $(PRG).srec
%.hex: %.elf
$(OBJCOPY) -j .text -j .data -O ihex $< $@
%.srec: %.elf
$(OBJCOPY) -j .text -j .data -O srec $< $@
%.bin: %.elf
$(OBJCOPY) -j .text -j .data -O binary $< $@
# Rules for building the .eeprom rom images
eeprom: ehex ebin esrec
ehex: $(PRG)_eeprom.hex
ebin: $(PRG)_eeprom.bin
esrec: $(PRG)_eeprom.srec
%_eeprom.hex: %.elf
$(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O ihex $< $@
%_eeprom.srec: %.elf
$(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O srec $< $@
%_eeprom.bin: %.elf
$(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O binary $< $@
# Every thing below here is used by avr-libc's build system and can be ignored
# by the casual user.
FIG2DEV = fig2dev
EXTRA_CLEAN_FILES = *.hex *.bin *.srec
dox: eps png pdf
eps: $(PRG).eps
png: $(PRG).png
pdf: $(PRG).pdf
%.eps: %.fig
$(FIG2DEV) -L eps $< $@
%.pdf: %.fig
$(FIG2DEV) -L pdf $< $@
%.png: %.fig
$(FIG2DEV) -L png $< $@
- [avr-chat] Kdevelop for avr-gcc?, Kishore, 2005/03/05
- RE: [avr-chat] Kdevelop for avr-gcc?, Matt.VanDeWerken, 2005/03/06
- Re: [avr-chat] Kdevelop for avr-gcc?, Trevor White, 2005/03/07
- Re: [avr-chat] Kdevelop for avr-gcc?, Kishore, 2005/03/08
- Re: [avr-chat] Kdevelop for avr-gcc?, Joerg Wunsch, 2005/03/08
- Re: [avr-chat] Kdevelop for avr-gcc?, Trevor White, 2005/03/08
- Re: [avr-chat] Kdevelop for avr-gcc?, Joerg Wunsch, 2005/03/09
- Re: [avr-chat] Kdevelop for avr-gcc?, Kishore, 2005/03/09
- Re: [avr-chat] Kdevelop for avr-gcc?, Joerg Wunsch, 2005/03/09