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 # NOTE: -O2 is actually needed to prevent memcpy references, whereas probably 27 # NOTE: one of the -f{freestanding, no-hosted, no-builtin} options should work. 28 # NOTE: See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56888 29 30 CFLAGS = -O2 -Wall \ 31 -fno-unit-at-a-time -fno-zero-initialized-in-bss \ 32 -ffreestanding -fno-hosted -fno-builtin \ 33 -march=mips32 \ 34 -I. -I../.. 35 LDFLAGS = -nostdlib -EL 36 37 # Ordering of objects is important and cannot be left to replacement rules. 38 # These are relative to each example directory. 39 40 START_SRC = ../../start.S 41 START_OBJ = ../../start.o 42 43 # Application-specific files appear after the above but before those below in 44 # the application Makefiles. 45 46 COMMON_SRC = ../../init.c ../../debug.c ../../cpu.S 47 COMMON_OBJ = ../../init.o ../../debug.o ../../cpu.o 48 49 # Common linker script. 50 51 SCRIPT = ../../payload.ld