Release v4.13441 - midsummer
[RRG-proxmark3.git] / bootrom / Makefile
blob9022a4eecab7923bdb08929d6f93e3c973cd8593
1 #-----------------------------------------------------------------------------
2 # This code is licensed to you under the terms of the GNU GPL, version 2 or,
3 # at your option, any later version. See the LICENSE.txt file for the text of
4 # the license.
5 #-----------------------------------------------------------------------------
6 # Makefile for bootrom, see ../common_arm/Makefile.common for common settings
7 #-----------------------------------------------------------------------------
9 # DO NOT use thumb mode in the phase 1 bootloader since that generates a section with glue code
10 ARMSRC =
11 THUMBSRC = usb_cdc.c \
12 clocks.c \
13 bootrom.c
15 ASMSRC = ram-reset.s flash-reset.s
16 VERSIONSRC = version_pm3.c
18 ## There is a strange bug with the linker: Sometimes it will not emit the glue to call
19 ## BootROM from ARM mode. The symbol is emitted, but the section will be filled with
20 ## zeroes. As a temporary workaround, do not use thumb for the phase 2 bootloader
21 ## -- Henryk Plötz <henryk@ploetzli.ch> 2009-09-01
22 # ARMSRC := $(ARMSRC) $(THUMBSRC)
23 # THUMBSRC :=
25 # stdint.h provided locally until GCC 4.5 becomes C99 compliant
26 APP_CFLAGS = -I. -ffunction-sections -fdata-sections
28 # stack-protect , no-pie reduces size on Gentoo Hardened 8.2 gcc, no-common makes sure uninitalized vars doesn't end up in COMMON area
29 APP_CFLAGS += -fno-stack-protector -fno-pie -fno-common
32 # Do not move this inclusion before the definition of {THUMB,ASM,ARM}SRC
33 include ../common_arm/Makefile.common
35 INSTALLFW = $(OBJDIR)/bootrom.elf
37 OBJS = $(OBJDIR)/bootrom.s19
39 # version_pm3.c should be remade on every compilation
40 version_pm3.c: default_version_pm3.c
41 $(info [=] GEN $@)
42 $(Q)$(CP) $< $@
44 all: showinfo $(OBJS)
46 showinfo:
47 $(info compiler version: $(shell $(CC) --version|head -n 1))
49 tarbin: $(OBJS)
50 $(info [=] GEN $@)
51 $(Q)$(TAR) $(TARFLAGS) ../proxmark3-$(platform)-bin.tar $(OBJS:%=bootrom/%) $(OBJS:%.s19=bootrom/%.elf)
53 $(OBJDIR)/bootrom.elf: $(VERSIONOBJ) $(ASMOBJ) $(ARMOBJ) $(THUMBOBJ)
54 $(info [=] LD $@)
55 $(Q)$(CC) $(CROSS_LDFLAGS) -Wl,-T,ldscript-flash,-Map,$(patsubst %.elf,%.map,$@) -o $@ $^ $(LIBS)
57 clean:
58 $(Q)$(RM) $(OBJDIR)$(PATHSEP)*.o
59 $(Q)$(RM) $(OBJDIR)$(PATHSEP)*.elf
60 $(Q)$(RM) $(OBJDIR)$(PATHSEP)*.s19
61 $(Q)$(RM) $(OBJDIR)$(PATHSEP)*.map
62 $(Q)$(RM) $(OBJDIR)$(PATHSEP)*.d
63 $(Q)$(RM) version_pm3.c version.c
65 install: all
66 $(info [@] Installing bootrom to $(DESTDIR)$(PREFIX)...)
67 $(Q)$(MKDIR) $(DESTDIR)$(PREFIX)$(PATHSEP)$(INSTALLFWRELPATH)
68 $(Q)$(CP) $(INSTALLFW) $(DESTDIR)$(PREFIX)$(PATHSEP)$(INSTALLFWRELPATH)
70 uninstall:
71 $(info [@] Uninstalling bootrom from $(DESTDIR)$(PREFIX)...)
72 $(Q)$(RM) $(foreach fw,$(INSTALLFW),$(DESTDIR)$(PREFIX)$(PATHSEP)$(INSTALLFWRELPATH)$(PATHSEP)$(notdir $(fw)))
74 .PHONY: all clean help install showinfo
75 help:
76 @echo Multi-OS Makefile, you are running on $(DETECTED_OS)
77 @echo Possible targets:
78 @echo + all - Make $(OBJDIR)/bootrom.s19, the main bootrom
79 @echo + clean - Clean $(OBJDIR)