diff options
author | Tom Hughes <tomhughes@chromium.org> | 2021-09-23 18:39:31 +0000 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-10-11 19:15:36 +0000 |
commit | f050111663cb33a061cfbdc07dc836a5af13d362 (patch) | |
tree | 0a2266b910027c12b8f4b2c06e09f288e908a987 /Makefile.rules | |
parent | 187f9155f684d0aeda4546bf04451ae8825f2de8 (diff) | |
download | chrome-ec-f050111663cb33a061cfbdc07dc836a5af13d362.tar.gz |
core: Fix flash size calculation when linking with lld (clang)
The map file generated by lld has a different format than the gnu linker
(ld). (We save this map file into build/<board>/<image>/ec.<image>.map
during the build.)
Instead of trying to parse the different formats in the .map file, use
the .smap file (the output of "nm"), which has the values of the symbols
and has the same format whether using lld or ld. We need to add a new
"__flash_size" symbol so that we can use that symbol to get the size
from the .smap.
This add flash sizes to a few boards that previously didn't have it:
asurada_scp, cherry_scp, and kukui_scp, since the previous logic was
always looking for FLASH and these use IROM.
BRANCH=none
BUG=b:172020503
TEST=make buildall -j
TEST=make CC=arm-none-eabi-clang BOARD=elemi
TEST=bcompare build_before_change build_after_change
=> only difference between space_free_flash.txt and
space_free_ram.txt files in the two builds is that this change adds
the space_free_flash.txt files for asurada_scp, cherry_scp, and
kukui_scp.
Signed-off-by: Tom Hughes <tomhughes@chromium.org>
Change-Id: I7c64b6ba9bceeeb4044559188c1c1bebbf60471d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3179314
Reviewed-by: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'Makefile.rules')
-rw-r--r-- | Makefile.rules | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Makefile.rules b/Makefile.rules index bd26637b11..42afb26e6f 100644 --- a/Makefile.rules +++ b/Makefile.rules @@ -426,9 +426,9 @@ ifeq ($(V),0) cmd_size= else cmd_size=$(Q)awk '\ - /__flash_used =/ {flash_used = strtonum($$1)} \ - /^FLASH / {flash_size = strtonum($$3)} \ - /__ram_free =/ {ram_free = strtonum($$1)} \ + /__flash_used/ {flash_used = strtonum("0x" $$1)} \ + /__flash_size/ {flash_size = strtonum("0x" $$1)} \ + /__ram_free/ {ram_free = strtonum("0x" $$1)} \ END {room_free = flash_size - flash_used; \ print ram_free > "$(out)/$(1)/space_free_ram.txt"; \ printf " *** "; \ @@ -438,7 +438,7 @@ cmd_size=$(Q)awk '\ } \ printf ("%s bytes in RAM still available on $(BOARD) $(1) ****\n", \ ram_free) \ - }' $(out)/$(1)/$(PROJECT).$(1).map + }' $(out)/$(1)/$(PROJECT).$(1).smap endif # List the smallest free flash spaces |