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
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
43 # Do not move this inclusion before the definition of {THUMB,ASM,ARM}SRC
44 include ..
/common_arm
/Makefile.common
46 INSTALLFW
= $(OBJDIR
)/bootrom.elf
48 OBJS
= $(OBJDIR
)/bootrom.s19
50 # version_pm3.c should be remade on every compilation
51 version_pm3.c
: default_version_pm3.c
58 $(info compiler version
: $(shell $(CROSS_CC
) --version|head
-n
1))
62 $(Q
)$(TAR
) $(TARFLAGS
) ..
/proxmark3-
$(platform
)-bin.
tar $(OBJS
:%=bootrom
/%) $(OBJS
:%.s19
=bootrom
/%.elf
)
64 $(OBJDIR
)/bootrom.elf
: $(VERSIONOBJ
) $(ASMOBJ
) $(ARMOBJ
) $(THUMBOBJ
)
66 $(Q
)$(CROSS_LD
) $(CROSS_LDFLAGS
) -Wl
,-T
,ldscript-flash
,-Map
,$(patsubst %.elf
,%.map
,$@
) -o
$@
$^
$(LIBS
)
69 $(Q
)$(RM
) $(OBJDIR
)$(PATHSEP
)*.o
70 $(Q
)$(RM
) $(OBJDIR
)$(PATHSEP
)*.elf
71 $(Q
)$(RM
) $(OBJDIR
)$(PATHSEP
)*.s19
72 $(Q
)$(RM
) $(OBJDIR
)$(PATHSEP
)*.map
73 $(Q
)$(RM
) $(OBJDIR
)$(PATHSEP
)*.d
74 $(Q
)$(RM
) version_pm3.c version.c
77 $(info [@
] Installing bootrom to
$(DESTDIR
)$(PREFIX
)...
)
78 $(Q
)$(INSTALLSUDO
) $(MKDIR
) $(DESTDIR
)$(PREFIX
)$(PATHSEP
)$(INSTALLFWRELPATH
)
79 $(Q
)$(INSTALLSUDO
) $(CP
) $(INSTALLFW
) $(DESTDIR
)$(PREFIX
)$(PATHSEP
)$(INSTALLFWRELPATH
)
82 $(info [@
] Uninstalling bootrom from
$(DESTDIR
)$(PREFIX
)...
)
83 $(Q
)$(INSTALLSUDO
) $(RM
) $(foreach fw
,$(INSTALLFW
),$(DESTDIR
)$(PREFIX
)$(PATHSEP
)$(INSTALLFWRELPATH
)$(PATHSEP
)$(notdir $(fw
)))
85 .PHONY
: all clean help
install showinfo
87 @echo Multi-OS Makefile
, you are running on
$(DETECTED_OS
)
88 @echo Possible targets
:
89 @echo
+ all - Make
$(OBJDIR
)/bootrom.s19
, the main bootrom
90 @echo
+ clean - Clean
$(OBJDIR
)