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 DATADIR = ../../data 29 INCDIR = ../../include 30 LIBDIR = ../../lib 31 32 # NOTE: -O2 is actually needed to prevent memcpy references, whereas probably 33 # NOTE: one of the -f{freestanding, no-hosted, no-builtin} options should work. 34 # NOTE: See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56888 35 36 CFLAGS = -O2 -Wall \ 37 -fno-unit-at-a-time -fno-zero-initialized-in-bss \ 38 -ffreestanding -fno-hosted -fno-builtin \ 39 -march=mips32 \ 40 -I. \ 41 -I$(INCDIR) 42 LDFLAGS = -nostdlib -EL 43 44 # Ordering of objects is important and cannot be left to replacement rules. 45 46 START_SRC = $(LIBDIR)/start.S 47 START_OBJ = $(LIBDIR)/start.o 48 49 # Application-specific files appear after the above but before those below in 50 # the application Makefiles. 51 52 COMMON_SRC = $(LIBDIR)/payload.c $(LIBDIR)/init.c $(LIBDIR)/debug.c $(LIBDIR)/utils.c $(LIBDIR)/cpu.S 53 COMMON_OBJ = $(LIBDIR)/payload.o $(LIBDIR)/init.o $(LIBDIR)/debug.o $(LIBDIR)/utils.o $(LIBDIR)/cpu.o 54 55 DISPLAY_COMMON_SRC = $(LIBDIR)/display.c $(LIBDIR)/font.c $(LIBDIR)/image.c $(LIBDIR)/viewport.c 56 DISPLAY_COMMON_OBJ = $(LIBDIR)/display.o $(LIBDIR)/font.o $(LIBDIR)/image.o $(LIBDIR)/viewport.o 57 58 DISPLAY_SRC = $(DISPLAY_COMMON_SRC) $(LIBDIR)/vga_display.c 59 DISPLAY_OBJ = $(DISPLAY_COMMON_OBJ) $(LIBDIR)/vga_display.o 60 61 # Common linker script. 62 63 SCRIPT = $(LIBDIR)/payload.ld