Added verify_size action
This commit is contained in:
commit
3afe25ba5a
3 changed files with 31 additions and 4 deletions
|
@ -116,6 +116,9 @@ The following are the list of changes that I have made or merged in this fork. H
|
||||||
- Make everybody depend on the makefile, in case cflags are changed, etc.
|
- Make everybody depend on the makefile, in case cflags are changed, etc.
|
||||||
- Make the makefile error if the arduino port is not present.
|
- Make the makefile error if the arduino port is not present.
|
||||||
|
|
||||||
|
### 0.10.2 15.xii.2012 Sudar
|
||||||
|
- Added sketch size verification. (https://github.com/fornellas)
|
||||||
|
|
||||||
## Know Issues
|
## Know Issues
|
||||||
- Because of the way the makefile is structured, the configuration parameters gets printed twice.
|
- Because of the way the makefile is structured, the configuration parameters gets printed twice.
|
||||||
- Doesn't work with Leonardo yet.
|
- Doesn't work with Leonardo yet.
|
||||||
|
|
|
@ -141,6 +141,9 @@
|
||||||
# - Make everybody depend on the makefile, in case cflags are changed, etc. (https://github.com/rpavlik)
|
# - Make everybody depend on the makefile, in case cflags are changed, etc. (https://github.com/rpavlik)
|
||||||
# - Make the makefile error if the arduino port is not present. (https://github.com/rpavlik)
|
# - Make the makefile error if the arduino port is not present. (https://github.com/rpavlik)
|
||||||
#
|
#
|
||||||
|
# 0.10.2 15.xii.2012 Sudar
|
||||||
|
# - Added sketch size verification. (https://github.com/fornellas)
|
||||||
|
#
|
||||||
########################################################################
|
########################################################################
|
||||||
#
|
#
|
||||||
# PATHS YOU NEED TO SET UP
|
# PATHS YOU NEED TO SET UP
|
||||||
|
@ -261,6 +264,8 @@
|
||||||
# make disasm - generate a .lss file in build-cli that contains
|
# make disasm - generate a .lss file in build-cli that contains
|
||||||
# disassembly of the compiled file interspersed
|
# disassembly of the compiled file interspersed
|
||||||
# with your original source code.
|
# with your original source code.
|
||||||
|
# make verify_size - Verify that the size of the final file is less than
|
||||||
|
# the capacity of the micro controller.
|
||||||
#
|
#
|
||||||
########################################################################
|
########################################################################
|
||||||
#
|
#
|
||||||
|
@ -591,6 +596,10 @@ ifndef OBJDIR
|
||||||
OBJDIR = build-$(BOARD_TAG)
|
OBJDIR = build-$(BOARD_TAG)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifndef HEX_MAXIMUM_SIZE
|
||||||
|
HEX_MAXIMUM_SIZE = $(shell $(PARSE_BOARD_CMD) $(BOARD_TAG) upload.maximum_size)
|
||||||
|
endif
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
# Local sources
|
# Local sources
|
||||||
#
|
#
|
||||||
|
@ -883,7 +892,7 @@ AVRDUDE_ISP_OPTS = -P $(ISP_PORT) $(ISP_PROG)
|
||||||
# Explicit targets start here
|
# Explicit targets start here
|
||||||
#
|
#
|
||||||
|
|
||||||
all: $(OBJDIR) $(TARGET_HEX)
|
all: $(OBJDIR) $(TARGET_HEX) verify_size
|
||||||
|
|
||||||
$(OBJDIR):
|
$(OBJDIR):
|
||||||
mkdir $(OBJDIR)
|
mkdir $(OBJDIR)
|
||||||
|
@ -899,7 +908,7 @@ $(DEP_FILE): $(OBJDIR) $(DEPS)
|
||||||
|
|
||||||
upload: raw_upload
|
upload: raw_upload
|
||||||
|
|
||||||
raw_upload: reset $(TARGET_HEX)
|
raw_upload: reset $(TARGET_HEX) verify_size
|
||||||
$(AVRDUDE) $(AVRDUDE_COM_OPTS) $(AVRDUDE_ARD_OPTS) \
|
$(AVRDUDE) $(AVRDUDE_COM_OPTS) $(AVRDUDE_ARD_OPTS) \
|
||||||
-U flash:w:$(TARGET_HEX):i
|
-U flash:w:$(TARGET_HEX):i
|
||||||
|
|
||||||
|
@ -917,7 +926,7 @@ reset_stty:
|
||||||
(sleep 0.1 || sleep 1) ;\
|
(sleep 0.1 || sleep 1) ;\
|
||||||
$$STTYF $(call get_arduino_port) -hupcl
|
$$STTYF $(call get_arduino_port) -hupcl
|
||||||
|
|
||||||
ispload: $(TARGET_HEX)
|
ispload: $(TARGET_HEX) verify_size
|
||||||
$(AVRDUDE) $(AVRDUDE_COM_OPTS) $(AVRDUDE_ISP_OPTS) -e \
|
$(AVRDUDE) $(AVRDUDE_COM_OPTS) $(AVRDUDE_ISP_OPTS) -e \
|
||||||
-U lock:w:$(ISP_LOCK_FUSE_PRE):m \
|
-U lock:w:$(ISP_LOCK_FUSE_PRE):m \
|
||||||
-U hfuse:w:$(ISP_HIGH_FUSE):m \
|
-U hfuse:w:$(ISP_HIGH_FUSE):m \
|
||||||
|
@ -949,10 +958,16 @@ disasm: $(OBJDIR)/$(TARGET).lss
|
||||||
symbol_sizes: $(OBJDIR)/$(TARGET).sym
|
symbol_sizes: $(OBJDIR)/$(TARGET).sym
|
||||||
@$(ECHO) A symbol listing sorted by their size have been dumped to $(OBJDIR)/$(TARGET).sym
|
@$(ECHO) A symbol listing sorted by their size have been dumped to $(OBJDIR)/$(TARGET).sym
|
||||||
|
|
||||||
|
$(TARGET_HEX).sizeok: $(TARGET_HEX)
|
||||||
|
$(ARDMK_PATH)/ard-verify-size $(TARGET_HEX) $(HEX_MAXIMUM_SIZE)
|
||||||
|
touch $@
|
||||||
|
|
||||||
|
verify_size: $(TARGET_HEX) $(TARGET_HEX).sizeok
|
||||||
|
|
||||||
generated_assembly: $(OBJDIR)/$(TARGET).s
|
generated_assembly: $(OBJDIR)/$(TARGET).s
|
||||||
@$(ECHO) Compiler-generated assembly for the main input source has been dumped to $(OBJDIR)/$(TARGET).s
|
@$(ECHO) Compiler-generated assembly for the main input source has been dumped to $(OBJDIR)/$(TARGET).s
|
||||||
|
|
||||||
.PHONY: all upload raw_upload reset reset_stty ispload clean depends size show_boards monitor disasm symbol_sizes generated_assembly
|
.PHONY: all upload raw_upload reset reset_stty ispload clean depends size show_boards monitor disasm symbol_sizes generated_assembly verify_size
|
||||||
|
|
||||||
# added - in the beginning, so that we don't get an error if the file is not present
|
# added - in the beginning, so that we don't get an error if the file is not present
|
||||||
ifneq ($(MAKECMDGOALS),clean)
|
ifneq ($(MAKECMDGOALS),clean)
|
||||||
|
|
9
bin/ard-verify-size
Executable file
9
bin/ard-verify-size
Executable file
|
@ -0,0 +1,9 @@
|
||||||
|
#!/bin/bash
|
||||||
|
TARGET_HEX="$1"
|
||||||
|
MAX_SIZE="$2"
|
||||||
|
HEX_SIZE="$(cut -c12- < $TARGET_HEX | tr -d \\n | tr -d \\r | wc -c | awk '{print $1/2}')"
|
||||||
|
if [ $HEX_SIZE -gt $MAX_SIZE ]
|
||||||
|
then
|
||||||
|
echo "Sketch size is ${HEX_SIZE} bytes and maximum allowed is ${MAX_SIZE} bytes; see http://www.arduino.cc/en/Guide/Troubleshooting#size for tips on reducing it." 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
Loading…
Reference in a new issue