# Makefile for bootrom, see ../common/Makefile.common for common settings\r
-include ../common/Makefile.common\r
-\r
-OBJJTAG = $(OBJDIR)/bootrom.o $(OBJDIR)/ram-reset.o $(OBJDIR)/usb.o\r
-OBJFLASH = $(OBJDIR)/flash-reset.o $(OBJDIR)/fromflash.o\r
\r
-THUMBSRC = usb.c fromflash.c bootrom.c\r
-ASMSRC = ram-reset.s flash-reset.s\r
+# DO NOT use thumb mode in the phase 1 bootloader since that generates a section with glue code\r
+ARMSRC = fromflash.c \r
+THUMBSRC = usb.c version.c bootrom.c\r
+ASMSRC = ram-reset.s flash-reset.s\r
\r
-THUMBOBJ = $(patsubst %.c,$(OBJDIR)/%.o,$(THUMBSRC))\r
-ASMOBJ = $(patsubst %.s,$(OBJDIR)/%.o,$(ASMSRC))\r
-\r
-all: bootrom-merged.s19\r
+# Do not move this inclusion before the definition of {THUMB,ASM,ARM}SRC\r
+include ../common/Makefile.common\r
\r
-bootrom-merged.s19: $(OBJDIR)/bootrom.s19 $(OBJDIR)/bootrom-forjtag.s19\r
- perl ../tools/merge-srec.pl $(OBJDIR)/bootrom.s19 $(OBJDIR)/bootrom-forjtag.s19 > bootrom-merged.s19\r
+all: $(OBJDIR)/bootrom.s19\r
\r
-$(OBJDIR)/bootrom.elf: $(OBJFLASH)\r
+$(OBJDIR)/bootrom.elf: $(ASMOBJ) $(ARMOBJ) $(THUMBOBJ)\r
$(LD) -g -Tldscript-flash --oformat elf32-littlearm -Map=$(patsubst %.elf,%.map,$@) -o $@ $^\r
\r
-$(OBJDIR)/bootrom-forjtag.elf: $(OBJJTAG)\r
- $(LD) -g -Tldscript-ram-jtag --oformat elf32-littlearm -Map=$(patsubst %.elf,%.map,$@) -o $@ $^\r
-\r
-$(OBJDIR)/%.s19: $(OBJDIR)/%.elf\r
- $(OBJCOPY) -Osrec --srec-forceS3 $^ $@\r
-\r
-$(THUMBOBJ): $(OBJDIR)/%.o: %.c $(INCLUDES)\r
- $(CC) $(CFLAGS) -mthumb -mthumb-interwork -o $@ $< \r
-\r
-$(ASMOBJ): $(OBJDIR)/%.o: %.s\r
- $(CC) $(CFLAGS) -mthumb-interwork -o $@ $<\r
-\r
clean:\r
$(DELETE) $(OBJDIR)$(PATHSEP)*.o\r
$(DELETE) $(OBJDIR)$(PATHSEP)*.elf\r
$(DELETE) $(OBJDIR)$(PATHSEP)*.s19\r
$(DELETE) $(OBJDIR)$(PATHSEP)*.map\r
- $(DELETE) bootrom-merged.s19\r
+ $(DELETE) $(OBJDIR)$(PATHSEP)*.d\r
+ $(DELETE) version.c\r
\r
-.PHONY: all clean help\r
+.PHONY: all clean help \r
help:\r
@echo Multi-OS Makefile, you are running on $(DETECTED_OS)\r
@echo Possible targets:\r
- @echo + all - Make bootrom-merged.s19, the main bootrom\r
+ @echo + all - Make $(OBJDIR)/bootrom.s19, the main bootrom\r
@echo + clean - Clean $(OBJDIR)\r