summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.rules30
-rw-r--r--core/cortex-m/ec.lds.S2
-rw-r--r--core/cortex-m0/ec.lds.S2
-rw-r--r--core/nds32/ec.lds.S2
4 files changed, 26 insertions, 10 deletions
diff --git a/Makefile.rules b/Makefile.rules
index a11635b6b3..6e4b8ff6a1 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -160,10 +160,16 @@ buildall: build_boards
$(MAKE) runtests
@touch .tests-passed
@echo "$@ completed successfully!"
- @echo "Tightest boards' RW images, bytes left:"
- @grep . build/*/RW/space_left.txt |\
- sed 's,build/\([^/]*\)/RW/space_left.txt:\(.*\)$$,\2 \1,' | \
- sort -n |head -3 | while read size board; do \
+ @echo "Tightest boards' RW flash images, bytes free:"
+ @grep . build/*/RW/space_free_flash.txt | \
+ sed 's,build/\([^/]*\)/RW/space_free_flash.txt:\(.*\)$$,\2 \1,' | \
+ sort -n | head -3 | while read size board; do \
+ printf "%-10s: %6d\n" $$board $$size; \
+ done
+ @echo "Tightest boards' RW RAM images, bytes free:"
+ @grep . build/*/RW/space_free_ram.txt | \
+ sed 's,build/\([^/]*\)/RW/space_free_ram.txt:\(.*\)$$,\2 \1,' | \
+ sort -n | head -3 | while read size board; do \
printf "%-10s: %6d\n" $$board $$size; \
done
@@ -306,10 +312,12 @@ else
cmd_size=$(Q)awk '\
/__image_size =/ {image_size = strtonum($$1)} \
/^FLASH/ {flash_size = strtonum($$3)} \
- END {room_left = flash_size - image_size; \
- print room_left > "$(out)/RW/space_left.txt"; \
- printf (" *** %s bytes still available in flash on $(BOARD) ****\n", \
- room_left)}' $(out)/RW/$(PROJECT).RW.map
+ /__ram_free =/ {ram_free = strtonum($$1)} \
+ END {room_free = flash_size - image_size; \
+ print room_free > "$(out)/RW/space_free_flash.txt"; \
+ print ram_free > "$(out)/RW/space_free_ram.txt"; \
+ printf (" *** %s bytes in flash and %s bytes in RAM still available on $(BOARD) ****\n", \
+ room_free, ram_free)}' $(out)/RW/$(PROJECT).RW.map
endif
build/host/%.info: run-%
@@ -570,7 +578,8 @@ help:
.PHONY: savesizes
savesizes:
- @find $(BUILD_DIR) -name '*.flat' -printf "%s %p\n" | sort --key 2 > \
+ @grep . build/*/*/space_free_*.txt | \
+ sed 's,\(.*\).txt:\(.*\),\2 \1,' | sort --key 2 > \
$(FLATSIZE_FILE)
@if [ -s $(FLATSIZE_FILE) ]; then \
echo "Saved sizes for $$(cat $(FLATSIZE_FILE) | wc -l) files"; \
@@ -589,7 +598,8 @@ newsizes:
FILES_IN_LIST=0; \
FILES_COMPARED=0; \
FILE_SIZE_CHANGE=0; \
- NEW_SIZES=$$(find $(BUILD_DIR) -name '*.flat' -printf "%s %p\n"); \
+ NEW_SIZES=$$(grep . build/*/*/space_free_*.txt | \
+ sed 's,\(.*\).txt:\(.*\),\2 \1,'); \
while read -r -u 10 line; do \
FILES_IN_LIST=$$((FILES_IN_LIST+1)); \
FLATFILE=$$(echo "$$line" | cut -f2 -d ' '); \
diff --git a/core/cortex-m/ec.lds.S b/core/cortex-m/ec.lds.S
index cb7a426e60..df7aea5fde 100644
--- a/core/cortex-m/ec.lds.S
+++ b/core/cortex-m/ec.lds.S
@@ -355,6 +355,8 @@ SECTIONS
ASSERT((__shared_mem_buf + CONFIG_SHAREDMEM_MINIMUM_SIZE) <=
(CONFIG_RAM_BASE + CONFIG_RAM_SIZE),
"Not enough space for shared memory.")
+ __ram_free = (CONFIG_RAM_BASE + CONFIG_RAM_SIZE) -
+ (__shared_mem_buf + CONFIG_SHAREDMEM_MINIMUM_SIZE);
/* The linker won't notice if the .data section is too big to fit,
* apparently because we're sending it into IRAM, not FLASH. The following
diff --git a/core/cortex-m0/ec.lds.S b/core/cortex-m0/ec.lds.S
index beec66f21e..68cfa6aa6f 100644
--- a/core/cortex-m0/ec.lds.S
+++ b/core/cortex-m0/ec.lds.S
@@ -229,6 +229,8 @@ SECTIONS
ASSERT((__shared_mem_buf + CONFIG_SHAREDMEM_MINIMUM_SIZE) <=
(CONFIG_RAM_BASE + CONFIG_RAM_SIZE),
"Not enough space for shared memory.")
+ __ram_free = (CONFIG_RAM_BASE + CONFIG_RAM_SIZE) -
+ (__shared_mem_buf + CONFIG_SHAREDMEM_MINIMUM_SIZE);
/* The linker won't notice if the .data section is too big to fit,
* apparently because we're sending it into IRAM, not FLASH. The following
diff --git a/core/nds32/ec.lds.S b/core/nds32/ec.lds.S
index 2b822f2403..999eb8fbc6 100644
--- a/core/nds32/ec.lds.S
+++ b/core/nds32/ec.lds.S
@@ -227,6 +227,8 @@ SECTIONS
ASSERT((__shared_mem_buf + CONFIG_SHAREDMEM_MINIMUM_SIZE) <=
(CONFIG_RAM_BASE + CONFIG_RAM_SIZE),
"Not enough space for shared memory.")
+ __ram_free = (CONFIG_RAM_BASE + CONFIG_RAM_SIZE) -
+ (__shared_mem_buf + CONFIG_SHAREDMEM_MINIMUM_SIZE);
__image_size = LOADADDR(.data) + SIZEOF(.data) - FW_OFF(SECTION);