tree reorg for separate master/slave build-dirs

* moved files
* rudimentary Makefile-support
master
Matthias Merz 15 years ago
parent 52dc8e6df8
commit 01fb4da199

@ -4,9 +4,15 @@ CFLAGS += -std=gnu99 # implements C99, for <util/atomic.h>
# this removes dead code and does global linker optimization
#CFLAGS += -ffunction-sections -Wl,--gc-sections -Wl,--relax
OBJECTS = usbdrv/usbdrvasm.o usbdrv/usbdrv.o main.o display.o lcd/lcd.o mcp_adc.o i2c_simple.o usb.o
include Makefile.inc
# symbolic targets:
all: master
include avrbuild/Makefile.avrbuild
master:
cd masterchip; $(MAKE) $(MFLAGS)
clean:
cd masterchip; $(MAKE) $(MFLAGS) clean
cd slavechip; $(MAKE) $(MFLAGS) clean

@ -0,0 +1,13 @@
DEFINES += -DF_CPU=16000000
CFLAGS += -save-temps
CFLAGS += -std=gnu99 -Wall # implements C99, for <util/atomic.h>
# this removes dead code and does global linker optimization
#CFLAGS += -ffunction-sections -Wl,--gc-sections -Wl,--relax
CFLAGS += -Wall -Os -I. -mmcu=atmega88
# further optimization:
#CFLAGS += --param inline-call-cost=2
CFLAGS += -fno-move-loop-invariants # suggestions from from v-usb
CFLAGS += -fno-tree-scev-cprop
CFLAGS += -fno-inline-small-functions

@ -0,0 +1,67 @@
# masterchip-makefile
include ../Makefile.inc
COMPILE = avr-gcc $(CFLAGS) $(DEFINES)
OBJECTS = usbdrv/usbdrvasm.o usbdrv/usbdrv.o main.o display.o lcd/lcd.o usb.o
# symbolic targets:
all: firmware.hex
.c.o:
$(COMPILE) -c $< -o $@
.S.o:
$(COMPILE) -x assembler-with-cpp -c $< -o $@
# "-x assembler-with-cpp" should not be necessary since this is the default
# file type for the .S (with capital S) extension. However, upper case
# characters are not always preserved on Windows. To ensure WinAVR
# compatibility define the file type manually.
.c.s:
$(COMPILE) -S $< -o $@
flash: all
avrdude -c usbasp -p m88 -U flash:w:firmware.hex
fuses:
avrdude -c usbasp -p m88 -U lfuse:w:0xdf:m -U hfuse:w:0xde:m # external oscillator
## what are the source dependencies
%.d: %.c
@set -e; rm -f $@; \
$(COMPILE) -MM $< | sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' > $@;
# line 1: exits if anything goes wrong
# line 2a: gcc -MM outputs dependencies
# line 2b: insert the %.d into dependency list
#main.c: version.h
clean:
rm -f *.o *.hex *.obj *.i *.s *.d */*.i */*.s */*.o */*.d version.h
# file targets:
firmware.bin: $(OBJECTS)
$(COMPILE) -o firmware.bin $(OBJECTS)
firmware.hex: firmware.bin
rm -f firmware.hex firmware.eep.hex
avr-objcopy -j .text -j .data -O ihex firmware.bin firmware.hex
avr-size firmware.bin
# ./checksize firmware.bin 8192 960
# do the checksize script as our last action to allow successful compilation
# on Windows with WinAVR where the Unix commands will fail.
disasm: firmware.bin
avr-objdump -d firmware.bin >disasm
functionsize: disasm
python avrbuild/functionsize.py
countregs: disasm
python avrbuild/countregs.py
# for depends:
-include $(OBJECTS:.o=.d)

@ -0,0 +1 @@
../shared/spi.c

@ -0,0 +1 @@
../shared/spi.h

@ -0,0 +1 @@
../../vusb-20100715/usbdrv

@ -0,0 +1,66 @@
include ../Makefile.inc
COMPILE = avr-gcc $(CFLAGS) $(DEFINES)
OBJECTS = mcp_adc.o i2c_simple.o
# symbolic targets:
all: firmware.hex
.c.o:
$(COMPILE) -c $< -o $@
.S.o:
$(COMPILE) -x assembler-with-cpp -c $< -o $@
# "-x assembler-with-cpp" should not be necessary since this is the default
# file type for the .S (with capital S) extension. However, upper case
# characters are not always preserved on Windows. To ensure WinAVR
# compatibility define the file type manually.
.c.s:
$(COMPILE) -S $< -o $@
flash: all
avrdude -c usbasp -p m88 -U flash:w:firmware.hex
fuses:
avrdude -c usbasp -p m88 -U lfuse:w:0xdf:m -U hfuse:w:0xde:m # external oscillator
## what are the source dependencies
%.d: %.c
@set -e; rm -f $@; \
$(COMPILE) -MM $< | sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' > $@;
# line 1: exits if anything goes wrong
# line 2a: gcc -MM outputs dependencies
# line 2b: insert the %.d into dependency list
#main.c: version.h
clean:
rm -f *.o *.hex *.obj *.i *.s *.d */*.i */*.s */*.o */*.d version.h
# file targets:
firmware.bin: $(OBJECTS)
$(COMPILE) -o firmware.bin $(OBJECTS)
firmware.hex: firmware.bin
rm -f firmware.hex firmware.eep.hex
avr-objcopy -j .text -j .data -O ihex firmware.bin firmware.hex
avr-size firmware.bin
# ./checksize firmware.bin 8192 960
# do the checksize script as our last action to allow successful compilation
# on Windows with WinAVR where the Unix commands will fail.
disasm: firmware.bin
avr-objdump -d firmware.bin >disasm
functionsize: disasm
python avrbuild/functionsize.py
countregs: disasm
python avrbuild/countregs.py
# for depends:
-include $(OBJECTS:.o=.d)

@ -1 +0,0 @@
../vusb-20100715/usbdrv/
Loading…
Cancel
Save