[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] using eeprom section in avr-gcc

From: Larry Barello
Subject: Re: [avr-gcc-list] using eeprom section in avr-gcc
Date: Sat, 2 Mar 2002 14:42:54 -0800

www.avrfreaks.org (net, com) has a very good page on GCC with getting
started notes that should cover the stuff you are asking about.

Here are some lines from a makefile.  It is for sample code for my
RTOS, so the libraries are mine, not gcc.  The makefile creates .rom
(hex), .eep (hex) and .obj (avrstudio debug module) from any single
module source file which, happens to be how my samples are organized.
For a real project the .elf file would be made from several module
linked together...

# AvrX 2.5 GCC Examples makefile
# Larry Barello May, 2000
# Uses GCC tools (make, rm)
# Generic stuff.
 DEBUG = --debug
 RM = rm -f

 MCU = 8535
 GCCMCU = at90s$(MCU)

#GCC Equates
 FORMAT = ihex
 GCCLIB = ../avrx/avrx.a
 GCCINC = -I. -I../avrx -I$(AVR)/avr/inc
 LDFLAGS = -Wl,-Map=$(<:.o=.map),--cref,-v
 AFLAGS = -c -mmcu=$(GCCMCU) -Wa,-gstabs -mmcu=$(GCCMCU) -I$(GCCINC)
 CFLAGS = -Os -Wall -mmcu=$(GCCMCU) -g
 BIN = avr-objcopy
 CC = avr-gcc
 AS = avr-gcc -x assembler-with-cpp

# GCC Rules

%o: %c
 $(CC) -c $< $(GCCINC) $(CFLAGS) -o $@

%s: %c
 $(CC) -S $< $(GCCINC) $(CFLAGS) -o $@

%o: %s
 $(AS) $(AFLAGS) $< -o $@

%elf: %o
 $(CC) $< $(GCCLIB) $(LDFLAGS) -mmcu=$(GCCMCU) -o $@

%obj: %elf
 $(BIN) -O avrobj $< $@

%rom: %elf
 $(BIN) -O $(FORMAT) $< $@

%eep: %elf
 $(BIN) -j
.eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma
.eeprom=0 -O $(FORMAT) $< $@

gcc: $(SRC:.c=.obj) $(SRC:.c=.rom) $(SRC:.c=.eep)

 $(RM) $(SRC:.c=.hex) $(SRC:.c=.eep) $(SRC:.c=.rom) $(SRC:.c=.map)
$(SRC:.c=.c_sym) $(SRC:.c=.obj)

# depends section


Larry Barello

avr-gcc-list at http://avr1.org

reply via email to

[Prev in Thread] Current Thread [Next in Thread]