1.1 --- a/Makefile Sat Oct 20 19:19:30 2018 +0200
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,75 +0,0 @@
1.4 -# Makefile - Build the PIC32 deployment payload
1.5 -#
1.6 -# Copyright (C) 2015, 2017, 2018 Paul Boddie <paul@boddie.org.uk>
1.7 -# Copyright (C) Xiangfu Liu <xiangfu@sharism.cc>
1.8 -#
1.9 -# This program is free software: you can redistribute it and/or modify
1.10 -# it under the terms of the GNU General Public License as published by
1.11 -# the Free Software Foundation, either version 3 of the License, or
1.12 -# (at your option) any later version.
1.13 -#
1.14 -# This program is distributed in the hope that it will be useful,
1.15 -# but WITHOUT ANY WARRANTY; without even the implied warranty of
1.16 -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1.17 -# GNU General Public License for more details.
1.18 -#
1.19 -# You should have received a copy of the GNU General Public License
1.20 -# along with this program. If not, see <http://www.gnu.org/licenses/>.
1.21 -
1.22 -ARCH = mipsel-linux-gnu
1.23 -CC = $(ARCH)-gcc
1.24 -LD = $(ARCH)-ld
1.25 -NM = $(ARCH)-nm
1.26 -OBJCOPY=$(ARCH)-objcopy
1.27 -OBJDUMP=$(ARCH)-objdump
1.28 -
1.29 -# NOTE: -O2 is actually needed to prevent memcpy references, whereas probably
1.30 -# NOTE: one of the -f{freestanding, no-hosted, no-builtin} options should work.
1.31 -# NOTE: See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56888
1.32 -
1.33 -CFLAGS = -O2 -Wall \
1.34 - -fno-unit-at-a-time -fno-zero-initialized-in-bss \
1.35 - -ffreestanding -fno-hosted -fno-builtin \
1.36 - -march=mips32
1.37 -LDFLAGS = -nostdlib -EL
1.38 -
1.39 -TARGET = payload.elf
1.40 -DUMP = $(TARGET:.elf=.dump)
1.41 -MAP = $(TARGET:.elf=.map)
1.42 -SCRIPT = $(TARGET:.elf=.ld)
1.43 -
1.44 -HEX = $(TARGET:.elf=.hex)
1.45 -SREC = $(TARGET:.elf=.srec)
1.46 -
1.47 -# Ordering of objects is important and cannot be left to replacement rules.
1.48 -
1.49 -SRC = start.S main.c init.c debug.c cpu.S
1.50 -OBJ = start.o main.o init.o debug.o cpu.o
1.51 -
1.52 -.PHONY: all clean distclean
1.53 -
1.54 -all: $(HEX) $(SREC)
1.55 -
1.56 -clean:
1.57 - rm -f $(OBJ) $(TARGET) $(HEX) $(SREC) $(DUMP) *.map
1.58 -
1.59 -distclean: clean
1.60 - echo "Nothing else to clean."
1.61 -
1.62 -$(HEX): $(TARGET)
1.63 - $(OBJCOPY) -O ihex $(TARGET) $(HEX)
1.64 -
1.65 -$(SREC): $(TARGET)
1.66 - $(OBJCOPY) -O srec $(TARGET) $(SREC)
1.67 -
1.68 -$(TARGET): $(OBJ)
1.69 - $(LD) $(LDFLAGS) -T $(SCRIPT) $(OBJ) -o $@
1.70 - $(OBJDUMP) -D $(TARGET) > $(DUMP)
1.71 - $(OBJDUMP) -h $(TARGET) > $(MAP)
1.72 - $(NM) -n $(TARGET) > System.map
1.73 -
1.74 -.c.o:
1.75 - $(CC) -c $(CFLAGS) $< -o $@
1.76 -
1.77 -.S.o:
1.78 - $(CC) -c $(CFLAGS) $< -o $@