summaryrefslogtreecommitdiff
path: root/Makefile.rules
diff options
context:
space:
mode:
authorCHLin <CHLIN56@nuvoton.com>2017-12-14 16:31:56 +0800
committerchrome-bot <chrome-bot@chromium.org>2018-01-03 22:42:59 -0800
commit5b1c4868d762f5f0c27748c690fdfbad54d03b9c (patch)
treecbdcd51bdf689a615a0c3db91803d2171695f627 /Makefile.rules
parent5789d6925777d82db30d80cd2eef62f57e5c9ca7 (diff)
downloadchrome-ec-5b1c4868d762f5f0c27748c690fdfbad54d03b9c.tar.gz
npcx: modify the npcxspiflash little firmware to support UUT
The original ec_npcxspiflash lfw is used by the openocd to program SPI flash via Servo JTAG. In order to support UUT mode to program SPI flash, this CL modified the lfw with the following changes: 1. Rename the lfw ec_npcxflash to npcx_monitor to unify the naming. 2. The npcx_monitor will read the first 4 bytes from the area of monitor header. If the monitor identifies the first 4 bytes is a UUT tag, it will read parameters(SPI_OFFSET/IMAGE_SIZE) from the relative offset of monitor header. Otherwise, it will read parameter from the general register r0/r1 which will be restored by openocd script in advance. 3. Add monitor_hdr.c to generate the monitor header binary files (monitor_hdr_ro.bin/monitor_hdr_rw.bin)) automatically after compiled. The memory layout to restore the reuqired binaries are listed below: ec firmware(RO/RW) - the start address of Code RAM area. monitor header - 0x200C3000 npcx_monitor - 0x200C3020 BRANCH=none BUG=none TEST=No build errors for "make buildall". TEST=Follow instructions in CL:826763; make sure the ec firmware is updated and ec can boot up. CQ-DEPEND=CL:828341 Change-Id: I5de997a4dee5449d578972e2f929c6e08c5dff67 Signed-off-by: CHLin <CHLIN56@nuvoton.com> Reviewed-on: https://chromium-review.googlesource.com/826909 Commit-Ready: CH Lin <chlin56@nuvoton.com> Tested-by: CH Lin <chlin56@nuvoton.com> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
Diffstat (limited to 'Makefile.rules')
-rw-r--r--Makefile.rules28
1 files changed, 21 insertions, 7 deletions
diff --git a/Makefile.rules b/Makefile.rules
index 460a1888db..4d12ef7113 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -421,15 +421,29 @@ $(out)/tags: $(out)/cscope.files
$(call quiet,ctags,CTAGS )
# TODO: optional make rules for PROJECT_EXTRA
-$(npcx-flash-fw-bin):
+$(npcx-monitor-fw-bin):
$(if $(V),,@echo ' EXTBIN ' $(subst $(out)/,,$@) ; )
-@ mkdir -p $(@D)
- -@ $(CC) $(CFLAGS) -MMD -MF $(out)/$(npcx-lfw).d -c $(npcx-flash-fw).c \
- -o $(out)/$(npcx-flash-fw).o
- -@ $(CC) $(out)/$(npcx-flash-fw).o $(LDFLAGS) \
- -o $(out)/$(npcx-flash-fw).elf -Wl,-T,$(npcx-flash-fw).ld \
- -Wl,-Map,$(out)/$(npcx-flash-fw).map
- -@ $(OBJCOPY) -O binary $(out)/$(npcx-flash-fw).elf $@
+ -@ $(CC) $(CFLAGS) -MMD -MF $(out)/$(npcx-lfw).d -c $(npcx-monitor-fw).c \
+ -o $(out)/$(npcx-monitor-fw).o
+ -@ $(CC) $(out)/$(npcx-monitor-fw).o $(LDFLAGS) \
+ -o $(out)/$(npcx-monitor-fw).elf -Wl,-T,$(npcx-monitor-fw).ld \
+ -Wl,-Map,$(out)/$(npcx-monitor-fw).map
+ -@ $(OBJCOPY) -O binary $(out)/$(npcx-monitor-fw).elf $@
+
+$(out)/$(npcx-monitor-hdr)_ro.o:$(npcx-monitor-hdr).c
+ -@ $(CC) $(CFLAGS) -D SECTION_IS_RO -MMD -c $(npcx-monitor-hdr).c -o $@
+
+$(npcx-monitor-hdr-ro-bin):$(out)/$(npcx-monitor-hdr)_ro.o
+ $(if $(V),,@echo ' EXTBIN ' $(subst $(out)/,,$@) ; )
+ -@ $(OBJCOPY) -O binary $< $@
+
+$(out)/$(npcx-monitor-hdr)_rw.o:$(npcx-monitor-hdr).c
+ -@ $(CC) $(CFLAGS) -MMD -c $(npcx-monitor-hdr).c -o $@
+
+$(npcx-monitor-hdr-rw-bin):$(out)/$(npcx-monitor-hdr)_rw.o
+ $(if $(V),,@echo ' EXTBIN ' $(subst $(out)/,,$@) ; )
+ -@ $(OBJCOPY) -O binary $< $@
.PHONY: xrefs
xrefs: $(call targ_if_prog,etags,$(out)/TAGS) \