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
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
11 THUMBSRC
= usb_cdc.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)
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
47 $(info compiler version
: $(shell $(CC
) --version|head
-n
1))
51 $(Q
)$(TAR
) $(TARFLAGS
) ..
/proxmark3-
$(platform
)-bin.
tar $(OBJS
:%=bootrom
/%) $(OBJS
:%.s19
=bootrom
/%.elf
)
53 $(OBJDIR
)/bootrom.elf
: $(VERSIONOBJ
) $(ASMOBJ
) $(ARMOBJ
) $(THUMBOBJ
)
55 $(Q
)$(CC
) $(CROSS_LDFLAGS
) -Wl
,-T
,ldscript-flash
,-Map
,$(patsubst %.elf
,%.map
,$@
) -o
$@
$^
$(LIBS
)
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
66 $(info [@
] Installing bootrom to
$(DESTDIR
)$(PREFIX
)...
)
67 $(Q
)$(MKDIR
) $(DESTDIR
)$(PREFIX
)$(PATHSEP
)$(INSTALLFWRELPATH
)
68 $(Q
)$(CP
) $(INSTALLFW
) $(DESTDIR
)$(PREFIX
)$(PATHSEP
)$(INSTALLFWRELPATH
)
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
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
)