arm: makefile improvements
This commit is contained in:
parent
d7a8f5b26d
commit
0226d314ec
@ -7,7 +7,7 @@ SECTIONS
|
|||||||
{
|
{
|
||||||
.text :
|
.text :
|
||||||
{
|
{
|
||||||
KEEP(vector_table.o(.vector_table))
|
KEEP(*(.vector_table))
|
||||||
|
|
||||||
*(.text*)
|
*(.text*)
|
||||||
*(.rodata*)
|
*(.rodata*)
|
||||||
|
18
arm/makefile
18
arm/makefile
@ -7,12 +7,13 @@ linker_script = bootloader.ld
|
|||||||
includes =
|
includes =
|
||||||
sources =
|
sources =
|
||||||
|
|
||||||
CFLAGS = -march=armv6-m -g -ffunction-sections -fdata-sections -O2 -Werror -Wall
|
CFLAGS = -march=armv6-m -g -ffunction-sections -fdata-sections -Os -Werror -Wall -flto
|
||||||
CXXFLAGS = $(CFLAGS) -std=c++20 -fno-exceptions
|
CXXFLAGS = $(CFLAGS) -std=c++20 -fno-exceptions -fcoroutines
|
||||||
|
CPPFLAGS = -MD -MP
|
||||||
LDFLAGS = -march=armv6-m \
|
LDFLAGS = -march=armv6-m \
|
||||||
-g --specs=nano.specs --specs=nosys.specs \
|
-g --specs=nano.specs --specs=nosys.specs \
|
||||||
-Wl,--gc-sections -O2 \
|
-Wl,--gc-sections -Os \
|
||||||
-Wl,--print-memory-usage
|
-Wl,--print-memory-usage -flto
|
||||||
|
|
||||||
sources += hal/lib/common/xil_assert.c
|
sources += hal/lib/common/xil_assert.c
|
||||||
includes += -Ihal/lib/common
|
includes += -Ihal/lib/common
|
||||||
@ -23,17 +24,18 @@ includes += -Ihal/uart
|
|||||||
bootloader_objects = uart.o bootloader.o vector_table.o $(sources:.c=.o)
|
bootloader_objects = uart.o bootloader.o vector_table.o $(sources:.c=.o)
|
||||||
app_objects = app_init.o main.o
|
app_objects = app_init.o main.o
|
||||||
|
|
||||||
CFLAGS += $(includes)
|
CPPFLAGS += $(includes)
|
||||||
|
|
||||||
all: bootloader.elf app.bin
|
all: bootloader.elf app.bin
|
||||||
|
|
||||||
%.bin: %.elf
|
%.bin: %.elf
|
||||||
$(OBJCOPY) -O binary $< $@
|
$(OBJCOPY) -O binary $< $@
|
||||||
|
|
||||||
bootloader.elf: $(bootloader_objects)
|
bootloader.elf: $(bootloader_objects) bootloader.ld
|
||||||
$(LD) -Wl,-Tbootloader.ld $(LDFLAGS) -o $@ $^
|
$(LD) -Wl,-Tbootloader.ld $(LDFLAGS) -o $@ $(bootloader_objects)
|
||||||
|
|
||||||
app.elf: $(app_objects)
|
app.elf: $(app_objects) app.ld
|
||||||
|
$(LD) -Wl,-Tapp.ld $(LDFLAGS) -o $@ $(app_objects)
|
||||||
|
|
||||||
%.elf:
|
%.elf:
|
||||||
$(LD) -Wl,-Tapp.ld $(LDFLAGS) -o $@ $^
|
$(LD) -Wl,-Tapp.ld $(LDFLAGS) -o $@ $^
|
||||||
|
Loading…
Reference in New Issue
Block a user