summaryrefslogtreecommitdiff
path: root/Makefile.rules
diff options
context:
space:
mode:
authorBill Richardson <wfrichar@chromium.org>2015-09-20 23:09:24 -0700
committerchrome-bot <chrome-bot@chromium.org>2015-09-21 11:23:27 -0700
commit735e5a6ee2df4f04420b739b3ef05e6d1a81792a (patch)
tree0cd9e2d78054835711ee7dc46c49d4d751f3dec4 /Makefile.rules
parentf4b65c5d950cd9c89b132b576fad77299540fb0c (diff)
downloadchrome-ec-735e5a6ee2df4f04420b739b3ef05e6d1a81792a.tar.gz
Define SECTION=* and SECTION_IS_* when compiling
The linker scripts are passed through the preprocessor so that they can distinguish between RO and RW images. This change makes the same macros available when compiling, so that code can contain directives like #ifdef SECTION_IS_RO or #define FW_SIZE_(section) CONFIG_##section##_SIZE #define FW_SIZE(section) FW_SIZE_(section) int size = FW_SIZE(SECTION); BUG=none BRANCH=none TEST=make buildall Nothing uses this yet, so there's no change to the images. Change-Id: I6e03cd07c134f4b86aeddd9d516b74bbdb95b8a8 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/301255 Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'Makefile.rules')
-rw-r--r--Makefile.rules7
1 files changed, 1 insertions, 6 deletions
diff --git a/Makefile.rules b/Makefile.rules
index 98a388f922..3c51caafd8 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -26,18 +26,13 @@ _dir_create := $(foreach d,$(dirs),$(shell [ -d $(out)/$(BLD)/$(d) ] || \
_dir_y_create := $(foreach d,$(dirs-y),$(shell [ -d $(out)/$(BLD)/$(d) ] || \
mkdir -p $(out)/RO/$(d); mkdir -p $(out)/RW/$(d)))
-section = $(subst .,,$(suffix $(1)))
-section_is = $(subst .,,SECTION_IS_$(suffix $(1)))
-
# Decrease verbosity unless you pass V=1
quiet = $(if $(V),,@echo ' $(2)' $(subst $(out)/,,$@) ; )$(cmd_$(1))
silent = $(if $(V),,1>/dev/null)
silent_err = $(if $(V),,2>/dev/null)
# commands to build all targets
-cmd_lds = $(CPP) -P -C -MMD -MF $@.d -MT $@ $(CPPFLAGS) \
- -D$(call section_is,$*) \
- -DSECTION=$(call section,$*) $< -o $@
+cmd_lds = $(CPP) -P -C -MMD -MF $@.d -MT $@ $(CPPFLAGS) $< -o $@
# Allow obj_to_bin to be overridden by board or chip specific commands
cmd_obj_to_bin ?= $(OBJCOPY) --gap-fill=0xff -O binary $^ $(out)/$*.bin.tmp
cmd_flat_to_obj = $(CC) -T $(out)/firmware_image.lds -nostdlib $(CPPFLAGS) \