Line 9... |
Line 9... |
## Creator: Dan Gisselquist, Ph.D.
|
## Creator: Dan Gisselquist, Ph.D.
|
## Gisselquist Technology, LLC
|
## Gisselquist Technology, LLC
|
##
|
##
|
################################################################################
|
################################################################################
|
##
|
##
|
## Copyright (C) 2015, Gisselquist Technology, LLC
|
## Copyright (C) 2016-2017, Gisselquist Technology, LLC
|
##
|
##
|
## This program is free software (firmware): you can redistribute it and/or
|
## This program is free software (firmware): you can redistribute it and/or
|
## modify it under the terms of the GNU General Public License as published
|
## modify it under the terms of the GNU General Public License as published
|
## by the Free Software Foundation, either version 3 of the License, or (at
|
## by the Free Software Foundation, either version 3 of the License, or (at
|
## your option) any later version.
|
## your option) any later version.
|
Line 21... |
Line 21... |
## This program is distributed in the hope that it will be useful, but WITHOUT
|
## This program is distributed in the hope that it will be useful, but WITHOUT
|
## ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
|
## ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
|
## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
## for more details.
|
## for more details.
|
##
|
##
|
|
## You should have received a copy of the GNU General Public License along
|
|
## with this program. (It's in the $(ROOT)/doc directory, run make with no
|
|
## target there if the PDF file isn't present.) If not, see
|
|
## for a copy.
|
|
##
|
## License: GPL, v3, as defined and found on www.gnu.org,
|
## License: GPL, v3, as defined and found on www.gnu.org,
|
## http:##www.gnu.org/licenses/gpl.html
|
## http://www.gnu.org/licenses/gpl.html
|
##
|
##
|
##
|
##
|
################################################################################
|
################################################################################
|
##
|
##
|
##
|
##
|
.PHONY: all
|
.PHONY: all
|
PROGRAMS := exstartup oledtest gpsdump exmulti cputest # hello
|
PROGRAMS := exstartup oledtest gpsdump exmulti cputest cputestcis hello gettysburg # simple_ping
|
all: $(PROGRAMS)
|
all: $(PROGRAMS)
|
OBJDIR := obj-zip
|
OBJDIR := obj-zip
|
NM := zip-nm
|
NM := zip-nm
|
RDELF := zip-readelf
|
RDELF := zip-readelf
|
CC := zip-gcc
|
CC := zip-gcc
|
OBJDUMP := zip-objdump
|
OBJDUMP := zip-objdump
|
SOURCES := exstartup.c bootloader.c gpsdump.c oledtest.c exmulti.c # hello.c
|
SOURCES := exstartup.c gpsdump.c oledtest.c exmulti.c simple_ping.c ipcksum.c cputest.c hello.c gettysburg.c # ntpserver.c
|
HEADERS := artyboard.h zipsys.h
|
HEADERS :=
|
DUMPRTL := -fdump-rtl-all
|
DUMPRTL := -fdump-rtl-all
|
DUMPTREE:= -fdump-tree-all
|
DUMPTREE:= -fdump-tree-all
|
|
LFLAGS := -T arty.ld -L../zlib -Wl,--start-group -larty
|
|
CFLAGS := -O3 -I../zlib
|
#
|
#
|
# For source analysis, the following macros are defined:
|
# For source analysis, the following macros are defined:
|
|
|
#
|
#
|
|
|
%.o: $(OBJDIR)/%.o
|
%.o: $(OBJDIR)/%.o
|
$(OBJDIR)/%.o: %.c
|
$(OBJDIR)/%.o: %.c
|
$(CC) -O3 -c -fno-builtin $< -o $@
|
$(CC) $(CFLAGS) -c $< -o $@
|
|
$(OBJDIR)/hello.o: hello.c
|
|
$(CC) -O3 -c $< -o $@
|
|
$(OBJDIR)/gettysburg.o: gettysburg.c
|
|
$(CC) -O3 -c $< -o $@
|
$(OBJDIR)/%.s: %.c
|
$(OBJDIR)/%.s: %.c
|
$(CC) -O3 -S -fno-builtin $< -o $@
|
$(CC) $(CFLAGS) -fdump-rtl-all -S $< -o $@
|
$(OBJDIR)/%.txt: $(OBJDIR)/%.o
|
$(OBJDIR)/%.txt: $(OBJDIR)/%.o
|
bash -c "$(RDELF) -a $^ ; $(OBJDUMP) -S -D $^ " | tee $@
|
bash -c "$(RDELF) -a $^ ; $(OBJDUMP) -S -D $^ " | tee $@
|
%.txt: %
|
%.txt: %
|
$(OBJDUMP) -S -D $^ > $@
|
$(OBJDUMP) -S -D $^ > $@
|
|
|
|
|
|
#
|
|
# The CPUTest program here is special--it doesn't use the C library. Hence,
|
|
# it must have the -fno-builtin flag in order to build, and the -Tartyram.ld
|
|
# linker script to build something that doesn't go into flash but directly into
|
|
# RAM instead.
|
|
#
|
|
$(OBJDIR)/cputest.o: cputest.c
|
|
$(CC) $(CFLAGS) -c -Wa,-nocis -fno-builtin $< -o $@
|
|
$(OBJDIR)/cputestcis.o: cputest.c
|
|
$(CC) $(CFLAGS) -c -Wa,-cis -fno-builtin $< -o $@
|
|
$(OBJDIR)/cputest.s: cputest.c
|
|
$(CC) $(CFLAGS) -S -Wa,-cis -fno-builtin $< -o $@
|
|
|
exstartup: $(OBJDIR)/exstartup.o $(OBJDIR)/bootloader.o arty.ld
|
$(OBJDIR)/cmptst.o: cmptst.c
|
$(CC) -O3 -T arty.ld -fno-builtin -Wl,-Map=exstartup.map $(OBJDIR)/exstartup.o $(OBJDIR)/bootloader.o -o exstartup
|
$(CC) $(CFLAGS) -c $< -o $@
|
|
|
exmulti: $(OBJDIR)/exmulti.o $(OBJDIR)/bootloader.o arty.ld
|
cputest: $(OBJDIR)/cputest.o artyram.ld
|
$(CC) -O3 -T arty.ld -fno-builtin -Wl,-Map=exmulti.map $(OBJDIR)/exmulti.o $(OBJDIR)/bootloader.o -o $@
|
$(CC) $(CFLAGS) -T artyram.ld -fno-builtin -Wl,-Map=$(OBJDIR)/cputest.map $(OBJDIR)/cputest.o -o $@
|
|
cputestcis: $(OBJDIR)/cputestcis.o artyram.ld
|
|
$(CC) $(CFLAGS) -T artyram.ld -fno-builtin -Wl,-Map=$(OBJDIR)/cputestcis.map $(OBJDIR)/cputestcis.o -o $@
|
|
|
gpsdump: $(OBJDIR)/gpsdump.o $(OBJDIR)/bootloader.o arty.ld
|
|
$(CC) -O3 -T arty.ld -fno-builtin -Wl,-Map=gpsdump.map $(OBJDIR)/bootloader.o $(OBJDIR)/gpsdump.o -o $@
|
|
|
|
hello: $(OBJDIR)/hello.o $(OBJDIR)/bootloader.o arty.ld
|
#
|
$(CC) -O3 -T arty.ld -fno-builtin -Wl,-Map=hello.map $(OBJDIR)/bootloader.o $(OBJDIR)/hello.o -o $@
|
# Other programs are much simpler
|
|
exstartup: $(OBJDIR)/exstartup.o arty.ld
|
|
$(CC) $(CFLAGS) $(LFLAGS) $(OBJDIR)/exstartup.o -o $@
|
|
|
oledtest: $(OBJDIR)/oledtest.o $(OBJDIR)/bootloader.o $(OBJDIR)/splash.o $(OBJDIR)/mug.o arty.ld
|
exmulti: $(OBJDIR)/exmulti.o arty.ld
|
$(CC) -O3 -T arty.ld -fno-builtin -Wl,-Map=oledtest.map $(OBJDIR)/oledtest.o $(OBJDIR)/bootloader.o $(OBJDIR)/splash.o $(OBJDIR)/mug.o -o $@
|
$(CC) $(CFLAGS) $(LFLAGS) $(OBJDIR)/exmulti.o -o $@
|
|
|
cputest: $(OBJDIR)/cputest.o artyram.ld
|
gpsdump: $(OBJDIR)/gpsdump.o arty.ld
|
$(CC) -O3 -T artyram.ld -fno-builtin -Wl,-Map=cputest.map $(OBJDIR)/cputest.o -o $@
|
$(CC) $(CFLAGS) $(LFLAGS) $(OBJDIR)/gpsdump.o -o $@
|
|
|
|
hello: $(OBJDIR)/hello.o arty.ld
|
|
$(CC) $(CFLAGS) $(LFLAGS) $(OBJDIR)/hello.o -o $@
|
|
|
|
gettysburg: $(OBJDIR)/gettysburg.o arty.ld
|
|
$(CC) $(CFLAGS) $(LFLAGS) $(OBJDIR)/gettysburg.o -o $@
|
|
|
|
oledtest: $(OBJDIR)/oledtest.o $(OBJDIR)/splash.o $(OBJDIR)/mug.o
|
|
$(CC) $(CFLAGS) $(LFLAGS) $^ -o $@
|
|
|
|
simple_ping: $(OBJDIR)/simple_ping.o
|
|
simple_ping: $(OBJDIR)/arp.o $(OBJDIR)/ipcksum.o $(OBJDIR)/ipcksum.o arty.ld
|
|
$(CC) $(CFLAGS) $(LFLAGS) $^ -o simple_ping
|
|
|
|
cmptst: $(OBJDIR)/cmptst.o
|
|
$(CC) $(CFLAGS) $(LFLAGS) $(OBJDIR)/cmptst.o -o $@
|
|
|
exstartup.txt: exstartup
|
exstartup.txt: exstartup
|
$(OBJDUMP) -S -D $^ > $@
|
$(OBJDUMP) -S -D $^ > $@
|
|
|
clean:
|
clean:
|
rm -rf $(PROGRAMS) $(addsuffix .map,$(PROGRAMS)) $(addsuffix .txt,$(PROGRAMS))
|
rm -rf $(PROGRAMS) $(addsuffix .map,$(PROGRAMS))
|
|
rm -rf $(addsuffix .txt,$(PROGRAMS))
|
rm -rf $(OBJDIR)/
|
rm -rf $(OBJDIR)/
|
|
|
define build-depends
|
define build-depends
|
@echo "Building dependency file(s)"
|
@echo "Building dependency file(s)"
|
@$(CC) $(CFLAGS) -MM $(SOURCES) > $(OBJDIR)/xdepends.txt
|
@$(CC) $(CFLAGS) -MM $(SOURCES) > $(OBJDIR)/xdepends.txt
|