diff options
author | Jett Rink <jettrink@chromium.org> | 2018-08-28 09:34:29 -0600 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-08-29 16:09:17 -0700 |
commit | 475f67828ff64d5398616a3998f70178b96e2864 (patch) | |
tree | 8c4a923284b82bb9c323b82aab1971f8e190b9bc | |
parent | f854f9f7c4433952a61b9ecfb77e989f8d3579df (diff) | |
download | chrome-ec-475f67828ff64d5398616a3998f70178b96e2864.tar.gz |
build: print out remaining RAM space
Some boards are pretty tight on RAM space. Print out remain RAM bytes
for each board along with the tightest 3 boards during buildall.
BRANCH=none
BUG=none
TEST=buildall now outputs the tightest boards on RAM.
Change-Id: I819e554400e88937bb937f2ca51daf737588a9a5
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1194342
Reviewed-by: Jonathan Brandmeyer <jbrandmeyer@chromium.org>
-rw-r--r-- | Makefile.rules | 30 | ||||
-rw-r--r-- | core/cortex-m/ec.lds.S | 2 | ||||
-rw-r--r-- | core/cortex-m0/ec.lds.S | 2 | ||||
-rw-r--r-- | core/nds32/ec.lds.S | 2 |
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); |