TS80P is sensitive to build assembly order?

Stinks of something weird playing with the miniware bootloader tbh
This commit is contained in:
Ben V. Brown
2020-12-17 18:22:25 +11:00
parent 28afe13a27
commit abfb982c59

View File

@@ -115,19 +115,19 @@ HEXFILE_DIR=Hexfile
OUTPUT_DIR_BASE=Objects OUTPUT_DIR_BASE=Objects
OUTPUT_DIR=Objects/$(model) OUTPUT_DIR=Objects/$(model)
# code optimisation ------------------------------------------------------------ # code optimisation ------------------------------------------------------------
OPTIM=-Os -flto -fdiagnostics-color -ffunction-sections -fdata-sections -finline-small-functions -findirect-inlining OPTIM=-Os -flto -finline-small-functions -findirect-inlining -fdiagnostics-color -ffunction-sections -fdata-sections
# global defines --------------------------------------------------------------- # global defines ---------------------------------------------------------------
GLOBAL_DEFINES += $(DEV_GLOBAL_DEFS) -D USE_RTOS_SYSTICK -D LANG_$(lang) -D LANG -D MODEL_$(model) -D VECT_TAB_OFFSET=$(bootldr_size)U GLOBAL_DEFINES += $(DEV_GLOBAL_DEFS) -D USE_RTOS_SYSTICK -D LANG_$(lang) -D LANG -D MODEL_$(model) -D VECT_TAB_OFFSET=$(bootldr_size)U
# Without debug code
DEBUG=
ifdef swd_enable ifdef swd_enable
GLOBAL_DEFINES += -DSWD_ENABLE GLOBAL_DEFINES += -DSWD_ENABLE
endif
# Enable debug code generation # Enable debug code generation
DEBUG=-g DEBUG=-g
# Without debug code endif
#DEBUG=
# libs ------------------------------------------------------------------------- # libs -------------------------------------------------------------------------
@@ -136,7 +136,8 @@ LIBS=
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
COMPILER=gcc COMPILER=gcc
# arm-none-eabi is the general ARM compiler, # arm-none-eabi is the general ARM compiler,
#riscv-none-embed- is the riscv compiler # riscv-none-embed is the riscv compiler
# riscv-nuclei-elf is the nuclei tuned one for their cores
ifeq ($(model),$(filter $(model),TS100 TS80 TS80P)) ifeq ($(model),$(filter $(model),TS100 TS80 TS80P))
COMPILER_PREFIX=arm-none-eabi COMPILER_PREFIX=arm-none-eabi
endif endif
@@ -151,7 +152,7 @@ OBJCOPY=$(COMPILER_PREFIX)-objcopy
OBJDUMP=$(COMPILER_PREFIX)-objdump OBJDUMP=$(COMPILER_PREFIX)-objdump
SIZE=$(COMPILER_PREFIX)-size SIZE=$(COMPILER_PREFIX)-size
# For the Pinecil, use GCC rather than as? (Copying other makefiles) # For the Pinecil, use gcc in assembler mode
ifeq ($(model),Pinecil) ifeq ($(model),Pinecil)
AS=$(COMPILER_PREFIX)-gcc -x assembler-with-cpp AS=$(COMPILER_PREFIX)-gcc -x assembler-with-cpp
endif endif
@@ -168,6 +169,7 @@ LINKER_FLAGS= -Wl,--gc-sections \
-Wl,--defsym=__FLASH_SIZE__=$(flash_size) \ -Wl,--defsym=__FLASH_SIZE__=$(flash_size) \
-Wl,--defsym=__BOOTLDR_SIZE__=$(bootldr_size) \ -Wl,--defsym=__BOOTLDR_SIZE__=$(bootldr_size) \
$(DEV_LDFLAGS) \ $(DEV_LDFLAGS) \
-flto \
--specs=nano.specs --specs=nano.specs
# compiler flags --------------------------------------------------------------- # compiler flags ---------------------------------------------------------------
@@ -284,29 +286,22 @@ all: $(OUT_HEXFILE).hex $(OUT_HEXFILE).bin
$(OUT_HEXFILE).elf : $(OUT_OBJS_S) $(OUT_OBJS) $(OUT_OBJS_CPP) Makefile $(LDSCRIPT) $(OUT_HEXFILE).elf : $(OUT_OBJS_S) $(OUT_OBJS) $(OUT_OBJS_CPP) Makefile $(LDSCRIPT)
@test -d $(@D) || mkdir -p $(@D) @test -d $(@D) || mkdir -p $(@D)
@echo Linking $(OUTPUT_EXE).elf @echo Linking $(OUTPUT_EXE).elf
@echo $(LINKER_FLAGS) @$(CPP) $(CXXFLAGS) $(OUT_OBJS_S) $(OUT_OBJS) $(OUT_OBJS_CPP) $(LIBS) $(LINKER_FLAGS)
@$(CPP) $(CXXFLAGS) $(OUT_OBJS) $(OUT_OBJS_CPP) $(OUT_OBJS_S) $(LIBS) $(LINKER_FLAGS)
$(OUT_OBJS): $(OUTPUT_DIR)/%.o : %.c Makefile $(OUT_OBJS): $(OUTPUT_DIR)/%.o : %.c Makefile
@test -d $(@D) || mkdir -p $(@D) @test -d $(@D) || mkdir -p $(@D)
@echo Compiling ${<} @echo Compiling ${<}
@$(CC) -c $(CFLAGS) $< -o $@ @$(CC) -c $(CFLAGS) $< -o $@
@$(OBJDUMP) -d -S $@ > $@.lst
$(OUT_OBJS_CPP): $(OUTPUT_DIR)/%.o : %.cpp Makefile $(OUT_OBJS_CPP): $(OUTPUT_DIR)/%.o : %.cpp Makefile
@test -d $(@D) || mkdir -p $(@D) @test -d $(@D) || mkdir -p $(@D)
@echo Compiling ${<} @echo Compiling ${<}
@$(CPP) -c $(CXXFLAGS) $< -o $@ @$(CPP) -c $(CXXFLAGS) $< -o $@
@$(OBJDUMP) -d -S $@ > $@.lst
$(OUT_OBJS_S): $(OUTPUT_DIR)/%.o: %.S Makefile $(OUT_OBJS_S): $(OUTPUT_DIR)/%.o: %.S Makefile
@test -d $(@D) || mkdir -p $(@D) @test -d $(@D) || mkdir -p $(@D)
@echo 'Building file: $<' @echo 'Building file: $<'
@echo 'Invoking: MCU GCC Assembler'
@echo @$(AS) -c $(AFLAGS) $< -o $@
@$(AS) -c $(AFLAGS) $< -o $@ @$(AS) -c $(AFLAGS) $< -o $@
@echo 'Finished building: $<'
@echo ' '
clean : clean :