X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/0422e2a47109a7845998c2130ae40c6d04e56d09..7af790aa0395322cc6e91e7cdbbd83612e871489:/bootrom/Makefile diff --git a/bootrom/Makefile b/bootrom/Makefile index 7a61cadb..2b7671c7 100644 --- a/bootrom/Makefile +++ b/bootrom/Makefile @@ -1,58 +1,28 @@ -CC = arm-elf-gcc -AS = arm-elf-as -LD = arm-elf-ld -OBJCOPY = arm-elf-objcopy +# Makefile for bootrom, see ../common/Makefile.common for common settings -OBJDIR = obj +# DO NOT use thumb mode in the phase 1 bootloader since that generates a section with glue code +ARMSRC = fromflash.c +THUMBSRC = usb.c bootrom.c +ASMSRC = ram-reset.s flash-reset.s -INCLUDE = -I../include +# Do not move this inclusion before the definition of {THUMB,ASM,ARM}SRC +include ../common/Makefile.common -INCLUDES = ../include/proxmark3.h ../include/at91sam7s128.h ../include/config_gpio.h ../include/usb_cmd.h +all: $(OBJDIR)/bootrom.s19 -CFLAGS = -g -c $(INCLUDE) -Wall - -OBJJTAG = $(OBJDIR)/bootrom.o $(OBJDIR)/ram-reset.o $(OBJDIR)/usb.o - -OBJFLASH = $(OBJDIR)/flash-reset.o $(OBJDIR)/fromflash.o - -all: bootrom.s19 - -bootrom.s19: $(OBJDIR)/bootrom.s19 $(OBJDIR)/bootrom-forjtag.s19 - @echo bootrom.s19 - @perl ..\tools\merge-srec.pl $(OBJDIR)\bootrom.s19 $(OBJDIR)\bootrom-forjtag.s19 > $(OBJDIR)\bootrom-merged.s19 - @perl ..\tools\srecswap.pl $(OBJDIR)\bootrom-forjtag.s19 > $(OBJDIR)\bootrom-forjtag-swapped.s19 - -$(OBJDIR)/bootrom.s19: $(OBJFLASH) - @echo obj/bootrom.s19 - @$(LD) -g -Tldscript-flash --oformat elf32-littlearm -Map=obj/bootrom.map -o $(OBJDIR)/bootrom.elf $(OBJFLASH) - @$(OBJCOPY) -Osrec --srec-forceS3 $(OBJDIR)/bootrom.elf $(OBJDIR)/bootrom.s19 - -$(OBJDIR)/bootrom-forjtag.s19: $(OBJJTAG) - @echo obj/bootrom-forjtag.s19 - @$(LD) -g -Tldscript-ram-jtag --oformat elf32-littlearm -Map=obj/bootrom-forjtag.map -o $(OBJDIR)/bootrom-forjtag.elf $(OBJJTAG) - @$(OBJCOPY) -Osrec --srec-forceS3 $(OBJDIR)/bootrom-forjtag.elf $(OBJDIR)/bootrom-forjtag.s19 - -$(OBJDIR)/bootrom.o: bootrom.c $(INCLUDES) - @echo $(@B).c - @$(CC) $(CFLAGS) -mthumb -mthumb-interwork bootrom.c -o $(OBJDIR)/bootrom.o - -$(OBJDIR)/fromflash.o: fromflash.c $(INCLUDES) - @echo $(@B).c - @$(CC) $(CFLAGS) -mthumb -mthumb-interwork fromflash.c -o $(OBJDIR)/fromflash.o - -$(OBJDIR)/usb.o: ../common/usb.c $(INCLUDES) - @echo $(@B).c - @$(CC) $(CFLAGS) -mthumb -mthumb-interwork ../common/usb.c -o $(OBJDIR)/usb.o - -$(OBJDIR)/ram-reset.o: ram-reset.s - @echo $(@B).s - @$(CC) $(CFLAGS) -mthumb-interwork -o $(OBJDIR)/ram-reset.o ram-reset.s - -$(OBJDIR)/flash-reset.o: flash-reset.s - @echo $(@B).s - @$(CC) $(CFLAGS) -mthumb-interwork -o $(OBJDIR)/flash-reset.o flash-reset.s +$(OBJDIR)/bootrom.elf: $(ASMOBJ) $(ARMOBJ) $(THUMBOBJ) + $(LD) -g -Tldscript-flash --oformat elf32-littlearm -Map=$(patsubst %.elf,%.map,$@) -o $@ $^ clean: - del /q obj\*.o - del /q obj\*.elf - del /q obj\*.s19 + $(DELETE) $(OBJDIR)$(PATHSEP)*.o + $(DELETE) $(OBJDIR)$(PATHSEP)*.elf + $(DELETE) $(OBJDIR)$(PATHSEP)*.s19 + $(DELETE) $(OBJDIR)$(PATHSEP)*.map + $(DELETE) $(OBJDIR)$(PATHSEP)*.d + +.PHONY: all clean help +help: + @echo Multi-OS Makefile, you are running on $(DETECTED_OS) + @echo Possible targets: + @echo + all - Make $(OBJDIR)/bootrom.s19, the main bootrom + @echo + clean - Clean $(OBJDIR)