mirror of
https://github.com/rfivet/stm32bringup.git
synced 2024-12-18 06:46:23 -05:00
Revise linker flags generation. Remove extra word alignment introduced for STM32 Flash Loader Demonstrator (deprecated).
This commit is contained in:
parent
1a6278a2ae
commit
5d11a2cdfa
41
Makefile
41
Makefile
@ -39,7 +39,7 @@ SIZE = $(BINPFX)size
|
||||
|
||||
### STM32F030F4P6 based board
|
||||
|
||||
PROJECT = f030f4.$(FLASHSTART)
|
||||
PROJECT = f030f4
|
||||
|
||||
# In RAM Execution
|
||||
# Bootloader uses first 2K of RAM, execution from bootloader
|
||||
@ -90,16 +90,18 @@ WARNINGS=-pedantic -Wall -Wextra -Wstrict-prototypes -Wno-unused-parameter
|
||||
CFLAGS = $(CPU) -g $(WARNINGS) -Os $(CDEFINES)
|
||||
|
||||
LD_SCRIPT = generic.ld
|
||||
LDDEFS = --defsym,FLASHSTART=$(FLASHSTART),--defsym,FLASHSIZE=$(FLASHSIZE)
|
||||
LDDEFINES = $(LDDEFS),--defsym,RAMSTART=$(RAMSTART),--defsym,RAMSIZE=$(RAMSIZE)
|
||||
LIBSTEM = stm32
|
||||
LIBS = -l$(LIBSTEM)
|
||||
LDOPTS =--defsym FLASHSTART=$(FLASHSTART) --defsym FLASHSIZE=$(FLASHSIZE)
|
||||
LDOPTS +=--defsym RAMSTART=$(RAMSTART) --defsym RAMSIZE=$(RAMSIZE)
|
||||
LDOPTS +=-Map=$(subst .elf,.map,$@) -cref --print-memory-usage
|
||||
comma :=,
|
||||
space :=$() # one space before the comment
|
||||
LDFLAGS =-Wl,$(subst $(space),$(comma),$(LDOPTS))
|
||||
|
||||
### Build rules
|
||||
|
||||
.PHONY: clean all version
|
||||
|
||||
all: $(PROJECT).hex $(PROJECT).bin
|
||||
all: $(PROJECT).hex $(PROJECT).$(FLASHSTART).bin
|
||||
|
||||
version:
|
||||
@echo make $(MAKE_VERSION) $(MAKE_HOST)
|
||||
@ -110,27 +112,30 @@ clean:
|
||||
@echo CLEAN
|
||||
@rm -f *.o *.elf *.map *.lst *.bin *.hex *.a
|
||||
|
||||
$(PROJECT).elf: $(OBJS) lib$(LIBSTEM).a
|
||||
@echo $@
|
||||
$(CC) $(CPU) -T$(LD_SCRIPT) -L. -Wl,$(LDDEFINES),-Map=$(PROJECT).map,-cref \
|
||||
-nostartfiles -o $@ $(OBJS) $(LIBS)
|
||||
$(SIZE) $@
|
||||
$(OBJDUMP) -hS $@ > $(PROJECT).lst
|
||||
$(PROJECT).elf: $(OBJS) libstm32.a
|
||||
boot.elf: boot.o
|
||||
ledon.elf: ledon.o
|
||||
blink.elf: blink.o
|
||||
ledtick.elf: ledtick.o
|
||||
cstartup.elf: cstartup.o
|
||||
|
||||
%.elf: %.o lib$(LIBSTEM).a
|
||||
%.elf:
|
||||
@echo $@
|
||||
$(CC) $(CPU) -T$(LD_SCRIPT) -L. -Wl,$(LDDEFINES),-Map=$*.map,-cref \
|
||||
-nostartfiles -o $@ $< $(LIBS)
|
||||
$(SIZE) $@
|
||||
$(OBJDUMP) -hS $@ > $*.lst
|
||||
$(CC) $(CPU) -T$(LD_SCRIPT) $(LDFLAGS) -nostartfiles -o $@ $+
|
||||
$(SIZE) -G $@
|
||||
$(OBJDUMP) -hS $@ > $(subst .elf,.lst,$@)
|
||||
|
||||
%.bin: %.elf
|
||||
@echo $@
|
||||
$(OBJCOPY) -O binary $< $@
|
||||
|
||||
%.$(FLASHSTART).bin: %.elf
|
||||
@echo $@
|
||||
$(OBJCOPY) -O binary $< $@
|
||||
|
||||
%.hex: %.elf
|
||||
@echo $@
|
||||
$(OBJCOPY) -O ihex $< $@
|
||||
|
||||
lib$(LIBSTEM).a: $(LIBOBJS)
|
||||
libstm32.a: $(LIBOBJS)
|
||||
$(AR) rc $@ $?
|
||||
|
@ -70,7 +70,6 @@ SECTIONS
|
||||
*(.rodata*)
|
||||
|
||||
*(.eh_frame*)
|
||||
. = ALIGN(4);
|
||||
} > FLASH
|
||||
|
||||
.ARM.extab :
|
||||
|
@ -73,7 +73,6 @@ SECTIONS
|
||||
*(.rodata*)
|
||||
|
||||
*(.eh_frame*)
|
||||
. = ALIGN(4);
|
||||
} > FLASH
|
||||
|
||||
.ARM.extab :
|
||||
|
@ -74,7 +74,6 @@ SECTIONS
|
||||
*(.rodata*)
|
||||
|
||||
*(.eh_frame*)
|
||||
. = ALIGN(4);
|
||||
} > FLASH
|
||||
|
||||
.ARM.extab :
|
||||
@ -129,7 +128,7 @@ SECTIONS
|
||||
__etext = ALIGN (4);
|
||||
|
||||
/* In RAM isr vector reserved space at beginning of RAM */
|
||||
.isrdata (COPY):
|
||||
.isrdata (NOLOAD):
|
||||
{
|
||||
KEEP(*(.ram_vector))
|
||||
} > RAM
|
||||
|
Loading…
Reference in New Issue
Block a user