From: Martin Mares Date: Mon, 24 Feb 2020 18:12:17 +0000 (+0100) Subject: Makefile: MAX_SIZE X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=3bb9dc272d8f56504805d30dfcb3d6902915a3d2;p=home-hw.git Makefile: MAX_SIZE --- 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"