mirror of
https://github.com/avem-labs/Avem.git
synced 2023-09-01 15:18:49 +08:00
51 lines
1.5 KiB
Makefile
51 lines
1.5 KiB
Makefile
# general Makefile
|
|
# make OptLIB=0 OptSRC=0 all tshow
|
|
include Makefile.common
|
|
LDFLAGS=$(COMMONFLAGS) -fno-exceptions -ffunction-sections -fdata-sections -L$(LIBDIR) -nostartfiles -Wl,--gc-sections,-Tlinker.ld
|
|
|
|
LDLIBS+=-lm
|
|
LDLIBS+=-lstm32
|
|
|
|
STARTUP=startup.c
|
|
|
|
all: libs src
|
|
$(CC) -o $(PROGRAM).elf $(LDFLAGS) \
|
|
-Wl,--whole-archive \
|
|
src/app.a \
|
|
-Wl,--no-whole-archive \
|
|
$(LDLIBS)
|
|
$(OBJCOPY) -O ihex $(PROGRAM).elf $(PROGRAM).hex
|
|
$(OBJCOPY) -O binary $(PROGRAM).elf $(PROGRAM).bin
|
|
#Extract info contained in ELF to readable text-files:
|
|
arm-none-eabi-readelf -a $(PROGRAM).elf > $(PROGRAM).info_elf
|
|
arm-none-eabi-size -d -B -t $(PROGRAM).elf > $(PROGRAM).info_size
|
|
arm-none-eabi-objdump -S $(PROGRAM).elf > $(PROGRAM).info_code
|
|
arm-none-eabi-nm -t d -S --size-sort -s $(PROGRAM).elf > $(PROGRAM).info_symbol
|
|
|
|
.PHONY: libs src clean tshow
|
|
|
|
libs:
|
|
$(MAKE) -C libs $@
|
|
src:
|
|
$(MAKE) -C src $@
|
|
clean:
|
|
$(MAKE) -C src $@
|
|
$(MAKE) -C libs $@
|
|
rm -f $(PROGRAM).elf $(PROGRAM).hex $(PROGRAM).bin $(PROGRAM).info_elf $(PROGRAM).info_size
|
|
rm -f $(PROGRAM).info_code
|
|
rm -f $(PROGRAM).info_symbol
|
|
rm -f DUMP.s
|
|
tshow:
|
|
@echo "=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_"
|
|
@echo "=🍺====>> optimize settings: $(InfoTextLib), $(InfoTextSrc)"
|
|
@echo "=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_"
|
|
|
|
flash:
|
|
stm32flash -w $(TOP)/main.bin -v -g 0 /dev/tty.SLAB_USBtoUART
|
|
dump:
|
|
arm-none-eabi-objdump -D main.elf > DUMP.s
|
|
open DUMP.s
|
|
say "Bazinga"
|
|
tty:
|
|
screen /dev/tty.SLAB_USBtoUART 115200
|