1 # Makefile - Common definitions for building PIC32 deployment payloads 2 # 3 # Copyright (C) 2015, 2017, 2018 Paul Boddie <paul@boddie.org.uk> 4 # Copyright (C) Xiangfu Liu <xiangfu@sharism.cc> 5 # 6 # This program is free software: you can redistribute it and/or modify 7 # it under the terms of the GNU General Public License as published by 8 # the Free Software Foundation, either version 3 of the License, or 9 # (at your option) any later version. 10 # 11 # This program is distributed in the hope that it will be useful, 12 # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 # GNU General Public License for more details. 15 # 16 # You should have received a copy of the GNU General Public License 17 # along with this program. If not, see <http://www.gnu.org/licenses/>. 18 19 ARCH = mipsel-linux-gnu 20 CC = $(ARCH)-gcc 21 LD = $(ARCH)-ld 22 NM = $(ARCH)-nm 23 OBJCOPY=$(ARCH)-objcopy 24 OBJDUMP=$(ARCH)-objdump 25 26 # These paths are relative to each example directory. 27 28 INCDIR = ../../include 29 LIBDIR = ../../lib 30 31 # NOTE: -O2 is actually needed to prevent memcpy references, whereas probably 32 # NOTE: one of the -f{freestanding, no-hosted, no-builtin} options should work. 33 # NOTE: See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56888 34 35 CFLAGS = -O2 -Wall \ 36 -fno-unit-at-a-time -fno-zero-initialized-in-bss \ 37 -ffreestanding -fno-hosted -fno-builtin \ 38 -march=mips32 \ 39 -I. \ 40 -I$(INCDIR) 41 LDFLAGS = -nostdlib -EL 42 43 # Ordering of objects is important and cannot be left to replacement rules. 44 45 START_SRC = $(LIBDIR)/start.S 46 START_OBJ = $(LIBDIR)/start.o 47 48 # Application-specific files appear after the above but before those below in 49 # the application Makefiles. 50 51 COMMON_SRC = $(LIBDIR)/payload.c $(LIBDIR)/init.c $(LIBDIR)/debug.c $(LIBDIR)/cpu.S 52 COMMON_OBJ = $(LIBDIR)/payload.o $(LIBDIR)/init.o $(LIBDIR)/debug.o $(LIBDIR)/cpu.o 53 54 DISPLAY_COMMON_SRC = $(LIBDIR)/display.c $(LIBDIR)/font.c 55 DISPLAY_COMMON_OBJ = $(LIBDIR)/display.o $(LIBDIR)/font.o 56 57 DISPLAY_SRC = $(DISPLAY_COMMON_SRC) $(LIBDIR)/vga_display.c 58 DISPLAY_OBJ = $(DISPLAY_COMMON_OBJ) $(LIBDIR)/vga_display.o 59 60 # Common linker script. 61 62 SCRIPT = $(LIBDIR)/payload.ld