1 #-----------------------------------------------------------------------------
2 # Copyright (C) Jonathan Westhues, Mar 2006
3 # Copyright (C) Proxmark3 contributors. See AUTHORS.md for details.
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # See LICENSE.txt for the text of the license.
16 #-----------------------------------------------------------------------------
17 # Makefile for bootrom, see ../common_arm/Makefile.common for common settings
18 #-----------------------------------------------------------------------------
20 # DO NOT use thumb mode in the phase 1 bootloader since that generates a section with glue code
22 THUMBSRC
= usb_cdc.c \
26 ASMSRC
= ram-reset.s flash-reset.s
27 VERSIONSRC
= version_pm3.c
29 ## There is a strange bug with the linker: Sometimes it will not emit the glue to call
30 ## BootROM from ARM mode. The symbol is emitted, but the section will be filled with
31 ## zeroes. As a temporary workaround, do not use thumb for the phase 2 bootloader
32 ## -- Henryk Plötz <henryk@ploetzli.ch> 2009-09-01
33 # ARMSRC := $(ARMSRC) $(THUMBSRC)
36 # stdint.h provided locally until GCC 4.5 becomes C99 compliant
37 APP_CFLAGS
= -I.
-ffunction-sections
-fdata-sections
-DAS_BOOTROM
39 # stack-protect , no-pie reduces size on Gentoo Hardened 8.2 gcc, no-common makes sure uninitialized vars don't end up in COMMON area
40 APP_CFLAGS
+= -fno-stack-protector
-fno-pie
-fno-common
42 ifneq (,$(findstring WITH_FLASH
,$(PLATFORM_DEFS
)))
43 APP_CFLAGS
+= -DWITH_FLASH
44 APP_CFLAGS
+= -I..
/common_arm
45 THUMBSRC
+= flashmem.c ticks.c
49 # Do not move this inclusion before the definition of {THUMB,ASM,ARM}SRC
50 include ..
/common_arm
/Makefile.common
52 INSTALLFW
= $(OBJDIR
)/bootrom.elf
54 OBJS
= $(OBJDIR
)/bootrom.s19
56 # version_pm3.c should be checked on every compilation
57 version_pm3.c
: default_version_pm3.c .FORCE
59 $(Q
)$(SH
) ..
/tools
/mkversion.sh
$@ ||
$(CP
) $< $@
64 $(info compiler version
: $(shell $(CROSS_CC
) --version|head
-n
1))
68 $(Q
)$(TAR
) $(TARFLAGS
) ..
/proxmark3-
$(platform
)-bin.
tar $(OBJS
:%=bootrom
/%) $(OBJS
:%.s19
=bootrom
/%.elf
)
70 $(OBJDIR
)/bootrom.elf
: $(VERSIONOBJ
) $(ASMOBJ
) $(ARMOBJ
) $(THUMBOBJ
)
72 $(Q
)$(CROSS_LD
) $(CROSS_LDFLAGS
) -Wl
,-T
,ldscript-flash
,-Map
,$(patsubst %.elf
,%.map
,$@
) -o
$@
$^
$(LIBS
)
75 $(Q
)$(RM
) $(OBJDIR
)$(PATHSEP
)*.o
76 $(Q
)$(RM
) $(OBJDIR
)$(PATHSEP
)*.elf
77 $(Q
)$(RM
) $(OBJDIR
)$(PATHSEP
)*.s19
78 $(Q
)$(RM
) $(OBJDIR
)$(PATHSEP
)*.map
79 $(Q
)$(RM
) $(OBJDIR
)$(PATHSEP
)*.d
80 $(Q
)$(RM
) version_pm3.c version.c
83 $(info [@
] Installing bootrom to
$(DESTDIR
)$(PREFIX
)...
)
84 $(Q
)$(INSTALLSUDO
) $(MKDIR
) $(DESTDIR
)$(PREFIX
)$(PATHSEP
)$(INSTALLFWRELPATH
)
85 $(Q
)$(INSTALLSUDO
) $(CP
) $(INSTALLFW
) $(DESTDIR
)$(PREFIX
)$(PATHSEP
)$(INSTALLFWRELPATH
)
88 $(info [@
] Uninstalling bootrom from
$(DESTDIR
)$(PREFIX
)...
)
89 $(Q
)$(INSTALLSUDO
) $(RM
) $(foreach fw
,$(INSTALLFW
),$(DESTDIR
)$(PREFIX
)$(PATHSEP
)$(INSTALLFWRELPATH
)$(PATHSEP
)$(notdir $(fw
)))
91 .PHONY
: all clean help
install showinfo .FORCE
93 @echo Multi-OS Makefile
, you are running on
$(DETECTED_OS
)
94 @echo Possible targets
:
95 @echo
+ all - Make
$(OBJDIR
)/bootrom.s19
, the main bootrom
96 @echo
+ clean - Clean
$(OBJDIR
)