summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.rules17
-rw-r--r--chip/ish/aontaskfw/ish_aontask.lds.S (renamed from chip/ish/aontaskfw/ish_aontask.ld.in)0
-rw-r--r--chip/ish/build.mk50
3 files changed, 38 insertions, 29 deletions
diff --git a/Makefile.rules b/Makefile.rules
index 25e54b9055..d6280c098f 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -68,6 +68,7 @@ cmd_elf_to_signed ?= $(SIGNER) --key=util/signer/$(3) \
--b --input=$< --format=bin --output=$@.signed $(SIGNER_EXTRAS) \
&& sudo chown $(shell whoami) $@.signed && mv $@.signed $@
cmd_elf_to_dis = $(OBJDUMP) -D $< > $@
+cmd_elf_to_bin = $(OBJCOPY) -O binary $< $@
cmd_elf_to_hex = $(OBJCOPY) -O ihex $< $@
cmd_bin_to_hex = $(OBJCOPY) -I binary -O ihex \
--change-addresses $(_program_memory_base) $^ $@
@@ -586,22 +587,6 @@ $(npcx-monitor-hdr-rw-bin):$(out)/$(npcx-monitor-hdr)_rw.o
$(if $(V),,@echo ' EXTBIN ' $(subst $(out)/,,$@) ; )
-@ $(OBJCOPY) -O binary $< $@
-# rules for building ISH aon task fw
-$(ish-aontask-fw-bin):$(out)/$(ish-aontask-fw).ld
- $(if $(V),,@echo ' EXTBIN ' $(subst $(out)/,,$@) ; )
- -@ $(CC) $(CFLAGS) -MMD -MF $(out)/$(ish-aontask-fw).d -c $(ish-aontask-fw).c \
- -o $(out)/$(ish-aontask-fw).o
- -@ $(CC) $(CFLAGS) -MMD -MF $(out)/$(ish-aontask-dma).d -c $(ish-aontask-dma).c \
- -o $(out)/$(ish-aontask-dma).o
- -@ $(CC) $(out)/$(ish-aontask-fw).o $(out)/$(ish-aontask-dma).o $(LDFLAGS) \
- -o $(out)/$(ish-aontask-fw).elf -Wl,-T,$(out)/$(ish-aontask-fw).ld \
- -Wl,-Map,$(out)/$(ish-aontask-fw).map
- -@ $(OBJCOPY) -O binary $(out)/$(ish-aontask-fw).elf $@
-
-$(out)/$(ish-aontask-fw).ld:$(ish-aontask-fw).ld.in
- -@ mkdir -p $(@D)
- @ $(CC) $(CFLAGS) -x assembler-with-cpp -E -P $< -o $@
-
.PHONY: xrefs
xrefs: $(call targ_if_prog,etags,$(out)/TAGS) \
$(call targ_if_prog,ctags,$(out)/tags)
diff --git a/chip/ish/aontaskfw/ish_aontask.ld.in b/chip/ish/aontaskfw/ish_aontask.lds.S
index b5361432a2..b5361432a2 100644
--- a/chip/ish/aontaskfw/ish_aontask.ld.in
+++ b/chip/ish/aontaskfw/ish_aontask.lds.S
diff --git a/chip/ish/build.mk b/chip/ish/build.mk
index 40fd5420d5..34eace379e 100644
--- a/chip/ish/build.mk
+++ b/chip/ish/build.mk
@@ -30,26 +30,50 @@ chip-$(CONFIG_LOW_POWER_IDLE)+=power_mgt.o
# There is no framework for on-board tests in ISH. Do not specify any.
test-list-y=
-ifeq ($(CONFIG_ISH_PM_AONTASK),y)
+# Build ish aon task fw
+ish-aon-name=ish_aontask
+ish-aon-$(CONFIG_ISH_PM_AONTASK)=aontaskfw/ish_aontask.o dma.o
-ish-aontask-fw=chip/ish/aontaskfw/ish_aontask
-ish-aontask-dma=chip/ish/dma
-ish-aontask-fw-bin=$(out)/$(ish-aontask-fw).bin
-PROJECT_EXTRA+=$(ish-aontask-fw-bin)
+# Rules for building ish aon task fw
+ish-aon-out=$(out)/aontaskfw
+ish-aon-bin-$(CONFIG_ISH_PM_AONTASK)=$(ish-aon-out)/$(ish-aon-name).bin
+ish-aon-elf-$(CONFIG_ISH_PM_AONTASK)=$(ish-aon-out)/$(ish-aon-name).elf
+ish-aon-lds-$(CONFIG_ISH_PM_AONTASK)=$(ish-aon-out)/$(ish-aon-name).lds
-_aon_size_str=$(shell stat -L -c %s $(ish-aontask-fw-bin))
-_aon_size=$(shell echo "$$(($(_aon_size_str)))")
+ish-aon-objs=$(call objs_from_dir,$(ish-aon-out)/chip/$(CHIP),ish-aon)
+ish-aon-deps+=$(addsuffix .d, $(ish-aon-objs)) $(ish-aon-lds-y).d
-$(out)/$(PROJECT).bin: $(ish-aontask-fw-bin) $(out)/RW/$(PROJECT).RW.flat
+cmd_ish_aon_elf = $(CC) $(ish-aon-objs) $(LDFLAGS) \
+ -o $@ -Wl,-T,$< -Wl,-Map,$(patsubst %.elf,%.map,$@)
-endif
+PROJECT_EXTRA+=$(ish-aon-bin-y)
+deps-$(CONFIG_ISH_PM_AONTASK)+=$(ish-aon-deps)
-_kernel_size_str=$(shell stat -L -c %s $(out)/RW/$(PROJECT).RW.flat)
-_kernel_size=$(shell echo "$$(($(_kernel_size_str)))")
+$(out)/$(PROJECT).bin: $(ish-aon-bin-y) $(out)/RW/$(PROJECT).RW.flat
+
+$(ish-aon-bin-y): $(ish-aon-elf-y)
+ $(call quiet,elf_to_bin,EXTBIN )
+
+$(ish-aon-elf-y): $(ish-aon-lds-y) $(ish-aon-objs)
+ $(call quiet,ish_aon_elf,LD )
-# location of the scripts used to pack image
+$(ish-aon-lds-y): chip/$(CHIP)/aontaskfw/ish_aontask.lds.S
+ -@ mkdir -p $(@D)
+ $(call quiet,lds,LDS )
+
+$(ish-aon-out)/%.o: %.c
+ -@ mkdir -p $(@D)
+ $(call quiet,c_to_o,CC )
+
+# Location of the scripts used to pack image
SCRIPTDIR:=./chip/${CHIP}/util
+# Calculate aon binary file size and kernel binary file size
+_aon_size_str=$(shell stat -L -c %s $(ish-aon-bin-y))
+_aon_size=$(shell echo "$$(($(_aon_size_str)))")
+
+_kernel_size_str=$(shell stat -L -c %s $(out)/RW/$(PROJECT).RW.flat)
+_kernel_size=$(shell echo "$$(($(_kernel_size_str)))")
# Commands to convert ec.RW.flat to $@.tmp - This will add the manifest header
# needed to load the FW onto the ISH HW.
@@ -58,7 +82,7 @@ ifeq ($(CONFIG_ISH_PM_AONTASK),y)
cmd_obj_to_bin = ${SCRIPTDIR}/pack_ec.py -o $@.tmp \
-k $(out)/RW/$(PROJECT).RW.flat \
--kernel-size $(_kernel_size) \
- -a $(ish-aontask-fw-bin) \
+ -a $(ish-aon-bin-y) \
--aon-size $(_aon_size);
else
cmd_obj_to_bin = ${SCRIPTDIR}/pack_ec.py -o $@.tmp \