summaryrefslogtreecommitdiff
path: root/chip
diff options
context:
space:
mode:
authorTom Hughes <tomhughes@chromium.org>2021-09-23 18:39:31 +0000
committerCommit Bot <commit-bot@chromium.org>2021-10-11 19:15:36 +0000
commitf050111663cb33a061cfbdc07dc836a5af13d362 (patch)
tree0a2266b910027c12b8f4b2c06e09f288e908a987 /chip
parent187f9155f684d0aeda4546bf04451ae8825f2de8 (diff)
downloadchrome-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 'chip')
-rw-r--r--chip/npcx/build.mk4
1 files changed, 2 insertions, 2 deletions
diff --git a/chip/npcx/build.mk b/chip/npcx/build.mk
index 4be1b2994f..1de37f6b0a 100644
--- a/chip/npcx/build.mk
+++ b/chip/npcx/build.mk
@@ -69,13 +69,13 @@ show_esct_cmd=$(if $(V),,echo ' ECST ' $(subst $(out)/,,$@) ; )
# size when the CONFIG_CHIP_INIT_ROM_REGION is used. Note that the -fwlen
# parameter for the ecst utility must be in hex.
cmd_fwlen=$(shell awk '\
- /__flash_used =/ {flash_used = strtonum($$1)} \
+ /__flash_used/ {flash_used = strtonum("0x" $$1)} \
END {printf ("%x", flash_used)}' $(1))
# ECST options for header
bld_ecst=${out}/util/ecst -chip $(CHIP_VARIANT) \
-usearmrst -mode bt -ph -i $(1) -o $(2) -nohcrc -nofcrc -flashsize 8 \
- -fwlen $(call cmd_fwlen, $(patsubst %.flat,%.map,$(2))) \
+ -fwlen $(call cmd_fwlen, $(patsubst %.flat,%.smap,$(2))) \
-spimaxclk 50 -spireadmode dual 1> /dev/null
# Replace original one with the flat file including header