From 3bb9dc272d8f56504805d30dfcb3d6902915a3d2 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Mon, 24 Feb 2020 19:12:17 +0100 Subject: [PATCH] Makefile: MAX_SIZE --- mk/bluepill.mk | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mk/bluepill.mk b/mk/bluepill.mk index cf034b3..a155801 100644 --- a/mk/bluepill.mk +++ b/mk/bluepill.mk @@ -8,6 +8,8 @@ # LIB_OBJS list of library object files # WITH_BOOT_LOADER define if code origin should be shifted by 8K for boot loader # WITH_DFU_FLASH flashing uses dfu-util +# WITH_SERIAL_FLASH flashing uses the built-in serial boot-loader +# MAX_SIZE complain if the built firmware exceeds this size # vpath %.c $(ROOT)/lib @@ -83,6 +85,9 @@ include $(OPENCM3_DIR)/mk/genlink-rules.mk %.bin: %.elf @printf " OBJCOPY $(*).bin\n" $(Q)$(OBJCOPY) -Obinary $(*).elf $(*).bin +ifdef MAX_SIZE + $(Q)if [ $$(stat -c '%s' $(*).bin) -gt $(MAX_SIZE) ] ; then echo >&2 "Output too large!" ; false ; fi +endif %.elf: $(OBJS) $(UCW_LDSCRIPT) @printf " LD $(*).elf\n" -- 2.39.2