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
|
### STM32F030F4P6 based board
|
||||||
|
|
||||||
PROJECT = f030f4.$(FLASHSTART)
|
PROJECT = f030f4
|
||||||
|
|
||||||
# In RAM Execution
|
# In RAM Execution
|
||||||
# Bootloader uses first 2K of RAM, execution from bootloader
|
# 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)
|
CFLAGS = $(CPU) -g $(WARNINGS) -Os $(CDEFINES)
|
||||||
|
|
||||||
LD_SCRIPT = generic.ld
|
LD_SCRIPT = generic.ld
|
||||||
LDDEFS = --defsym,FLASHSTART=$(FLASHSTART),--defsym,FLASHSIZE=$(FLASHSIZE)
|
LDOPTS =--defsym FLASHSTART=$(FLASHSTART) --defsym FLASHSIZE=$(FLASHSIZE)
|
||||||
LDDEFINES = $(LDDEFS),--defsym,RAMSTART=$(RAMSTART),--defsym,RAMSIZE=$(RAMSIZE)
|
LDOPTS +=--defsym RAMSTART=$(RAMSTART) --defsym RAMSIZE=$(RAMSIZE)
|
||||||
LIBSTEM = stm32
|
LDOPTS +=-Map=$(subst .elf,.map,$@) -cref --print-memory-usage
|
||||||
LIBS = -l$(LIBSTEM)
|
comma :=,
|
||||||
|
space :=$() # one space before the comment
|
||||||
|
LDFLAGS =-Wl,$(subst $(space),$(comma),$(LDOPTS))
|
||||||
|
|
||||||
### Build rules
|
### Build rules
|
||||||
|
|
||||||
.PHONY: clean all version
|
.PHONY: clean all version
|
||||||
|
|
||||||
all: $(PROJECT).hex $(PROJECT).bin
|
all: $(PROJECT).hex $(PROJECT).$(FLASHSTART).bin
|
||||||
|
|
||||||
version:
|
version:
|
||||||
@echo make $(MAKE_VERSION) $(MAKE_HOST)
|
@echo make $(MAKE_VERSION) $(MAKE_HOST)
|
||||||
@ -110,27 +112,30 @@ clean:
|
|||||||
@echo CLEAN
|
@echo CLEAN
|
||||||
@rm -f *.o *.elf *.map *.lst *.bin *.hex *.a
|
@rm -f *.o *.elf *.map *.lst *.bin *.hex *.a
|
||||||
|
|
||||||
$(PROJECT).elf: $(OBJS) lib$(LIBSTEM).a
|
$(PROJECT).elf: $(OBJS) libstm32.a
|
||||||
@echo $@
|
boot.elf: boot.o
|
||||||
$(CC) $(CPU) -T$(LD_SCRIPT) -L. -Wl,$(LDDEFINES),-Map=$(PROJECT).map,-cref \
|
ledon.elf: ledon.o
|
||||||
-nostartfiles -o $@ $(OBJS) $(LIBS)
|
blink.elf: blink.o
|
||||||
$(SIZE) $@
|
ledtick.elf: ledtick.o
|
||||||
$(OBJDUMP) -hS $@ > $(PROJECT).lst
|
cstartup.elf: cstartup.o
|
||||||
|
|
||||||
%.elf: %.o lib$(LIBSTEM).a
|
%.elf:
|
||||||
@echo $@
|
@echo $@
|
||||||
$(CC) $(CPU) -T$(LD_SCRIPT) -L. -Wl,$(LDDEFINES),-Map=$*.map,-cref \
|
$(CC) $(CPU) -T$(LD_SCRIPT) $(LDFLAGS) -nostartfiles -o $@ $+
|
||||||
-nostartfiles -o $@ $< $(LIBS)
|
$(SIZE) -G $@
|
||||||
$(SIZE) $@
|
$(OBJDUMP) -hS $@ > $(subst .elf,.lst,$@)
|
||||||
$(OBJDUMP) -hS $@ > $*.lst
|
|
||||||
|
|
||||||
%.bin: %.elf
|
%.bin: %.elf
|
||||||
@echo $@
|
@echo $@
|
||||||
$(OBJCOPY) -O binary $< $@
|
$(OBJCOPY) -O binary $< $@
|
||||||
|
|
||||||
|
%.$(FLASHSTART).bin: %.elf
|
||||||
|
@echo $@
|
||||||
|
$(OBJCOPY) -O binary $< $@
|
||||||
|
|
||||||
%.hex: %.elf
|
%.hex: %.elf
|
||||||
@echo $@
|
@echo $@
|
||||||
$(OBJCOPY) -O ihex $< $@
|
$(OBJCOPY) -O ihex $< $@
|
||||||
|
|
||||||
lib$(LIBSTEM).a: $(LIBOBJS)
|
libstm32.a: $(LIBOBJS)
|
||||||
$(AR) rc $@ $?
|
$(AR) rc $@ $?
|
||||||
|
@ -70,7 +70,6 @@ SECTIONS
|
|||||||
*(.rodata*)
|
*(.rodata*)
|
||||||
|
|
||||||
*(.eh_frame*)
|
*(.eh_frame*)
|
||||||
. = ALIGN(4);
|
|
||||||
} > FLASH
|
} > FLASH
|
||||||
|
|
||||||
.ARM.extab :
|
.ARM.extab :
|
||||||
|
@ -73,7 +73,6 @@ SECTIONS
|
|||||||
*(.rodata*)
|
*(.rodata*)
|
||||||
|
|
||||||
*(.eh_frame*)
|
*(.eh_frame*)
|
||||||
. = ALIGN(4);
|
|
||||||
} > FLASH
|
} > FLASH
|
||||||
|
|
||||||
.ARM.extab :
|
.ARM.extab :
|
||||||
|
@ -74,7 +74,6 @@ SECTIONS
|
|||||||
*(.rodata*)
|
*(.rodata*)
|
||||||
|
|
||||||
*(.eh_frame*)
|
*(.eh_frame*)
|
||||||
. = ALIGN(4);
|
|
||||||
} > FLASH
|
} > FLASH
|
||||||
|
|
||||||
.ARM.extab :
|
.ARM.extab :
|
||||||
@ -129,7 +128,7 @@ SECTIONS
|
|||||||
__etext = ALIGN (4);
|
__etext = ALIGN (4);
|
||||||
|
|
||||||
/* In RAM isr vector reserved space at beginning of RAM */
|
/* In RAM isr vector reserved space at beginning of RAM */
|
||||||
.isrdata (COPY):
|
.isrdata (NOLOAD):
|
||||||
{
|
{
|
||||||
KEEP(*(.ram_vector))
|
KEEP(*(.ram_vector))
|
||||||
} > RAM
|
} > RAM
|
||||||
|
Loading…
Reference in New Issue
Block a user