# 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
%.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"