[Sound-open-firmware] [PATCH] build: add build support for cannonlake

Liam Girdwood liam.r.girdwood at linux.intel.com
Tue Jan 23 17:40:17 CET 2018


Build the Intel Cannonklake platform.

Signed-off-by: Liam Girdwood <liam.r.girdwood at linux.intel.com>
---
 configure.ac                     | 27 ++++++++++++
 src/arch/xtensa/Makefile.am      | 91 +++++++++++++++++++++++++++++++++++++---
 src/arch/xtensa/hal/Makefile.am  | 34 +++++++++++++++
 src/arch/xtensa/xtos/Makefile.am |  6 +++
 src/platform/Makefile.am         |  4 ++
 5 files changed, 156 insertions(+), 6 deletions(-)

diff --git a/configure.ac b/configure.ac
index 744d815..d37fc67 100644
--- a/configure.ac
+++ b/configure.ac
@@ -157,6 +157,23 @@ case "$with_platform" in
 	AC_DEFINE([CONFIG_BROADWELL], [1], [Configure for Broadwell])
 	AC_DEFINE([CONFIG_HOST_PTABLE], [1], [Configure handling host page table])
     ;;
+   cannonlake*)
+
+	PLATFORM_LDSCRIPT="cannonlake.x"
+	AC_SUBST(PLATFORM_LDSCRIPT)
+
+	PLATFORM="cannonlake"
+	AC_SUBST(PLATFORM)
+
+	FW_NAME="cnl"
+	AC_SUBST(FW_NAME)
+
+	XTENSA_CORE="hifi4_std"
+	AC_SUBST(XTENSA_CORE)
+
+	AC_DEFINE([CONFIG_CANNONLAKE], [1], [Configure for Cannonlake])
+	AC_DEFINE([CONFIG_IRQ_MAP], [1], [Configure IRQ maps])
+    ;;
     *)
         AC_MSG_ERROR([Host platform not specified])
     ;;
@@ -167,6 +184,8 @@ AM_CONDITIONAL(BUILD_CHERRYTRAIL,  test "$FW_NAME" = "cht")
 AM_CONDITIONAL(BUILD_HASWELL,  test "$FW_NAME" = "hsw")
 AM_CONDITIONAL(BUILD_BROADWELL,  test "$FW_NAME" = "bdw")
 AM_CONDITIONAL(BUILD_APOLLOLAKE,  test "$FW_NAME" = "apl")
+AM_CONDITIONAL(BUILD_CANNONLAKE,  test "$FW_NAME" = "cnl")
+AM_CONDITIONAL(BUILD_BOOTLOADER,  test "$FW_NAME" = "cnl")
 AM_CONDITIONAL(BUILD_MODULE,  test "$FW_NAME" = "apl" -o "$FW_NAME" = "cnl")
 
 # DSP core support (Optional)
@@ -193,6 +212,9 @@ AS_IF([test "x$enable_dma_trace" != "xno"], [
 
 AM_CONDITIONAL(BUILD_DMA_TRACE,  test "x$enable_dma_trace" != "xno")
 
+PLATFORM_BOOT_LDR_LDSCRIPT="boot_ldr.x"
+AC_SUBST(PLATFORM_BOOT_LDR_LDSCRIPT)
+
 # Test after CFLAGS set othewise test of cross compiler fails. 
 AM_PROG_AS
 AM_PROG_AR
@@ -246,6 +268,11 @@ AC_CONFIG_FILES([
 	src/platform/haswell/include/platform/Makefile
 	src/platform/haswell/include/xtensa/Makefile
 	src/platform/haswell/include/xtensa/config/Makefile
+	src/platform/cannonlake/Makefile
+	src/platform/cannonlake/include/Makefile
+	src/platform/cannonlake/include/platform/Makefile
+	src/platform/cannonlake/include/xtensa/Makefile
+	src/platform/cannonlake/include/xtensa/config/Makefile
 ])
 AC_OUTPUT
 
diff --git a/src/arch/xtensa/Makefile.am b/src/arch/xtensa/Makefile.am
index 32e4aa5..b055a82 100644
--- a/src/arch/xtensa/Makefile.am
+++ b/src/arch/xtensa/Makefile.am
@@ -35,6 +35,11 @@ reef_SOURCES = \
 	timer.c \
 	task.c
 
+if BUILD_CANNONLAKE
+reef_SOURCES += \
+	main-entry.S
+endif
+
 reef_CFLAGS = \
 	$(ARCH_INCDIR) \
 	$(ARCH_CFLAGS) \
@@ -69,17 +74,91 @@ reef_LDFLAGS = \
 	$(ARCH_LDFLAGS) -Wl,-Map=reef-$(FW_NAME).map \
 	-T ../../platform/$(PLATFORM)/$(PLATFORM_LDSCRIPT)
 
-bin-local: reef
-	$(OBJCOPY) -O binary reef reef-$(FW_NAME).bin
-	$(OBJDUMP) -S reef > reef-$(FW_NAME).lst
-	$(OBJDUMP) -D reef > reef-$(FW_NAME).dis
-	rimage -i reef -o reef-$(FW_NAME).ri -m $(FW_NAME)
+RIMAGE_FLAGS = reef-$(FW_NAME)
+RIMAGE_BOOT_FLAGS =
+BIN_FLAGS = reef
+
+if BUILD_BOOTLOADER
+
+noinst_PROGRAMS += \
+	boot_ldr
+
+LINK_BOOT_LDR_SCRIPT = ../../platform/$(PLATFORM)/$(PLATFORM_BOOT_LDR_LDSCRIPT)
+BUILT_SOURCES += $(LINK_BOOT_LDR_SCRIPT)
+CLEANFILES += $(LINK_BOOT_LDR_SCRIPT)
+
+nodist_boot_ldr_SOURCES = $(LINK_BOOT_LDR_SCRIPT).in
+$(LINK_BOOT_LDR_SCRIPT): Makefile $(LINK_BOOT_LDR_SCRIPT).in $(LINK_DEPS)
+	cat $(LINK_BOOT_LDR_SCRIPT).in | $(CPP) -P $(PLATFORM_INCDIR) $(REEF_INCDIR) - >$@
+
+boot_ldr_SOURCES = \
+	boot_entry.S \
+	_vectors.S \
+	boot_loader.c
+
+boot_ldr_CFLAGS = \
+	$(ARCH_INCDIR) \
+	$(ARCH_CFLAGS) \
+	$(REEF_INCDIR) \
+	$(PLATFORM_INCDIR)
+
+boot_ldr_CCASFLAGS = \
+	$(ARCH_INCDIR) \
+	$(ASFLAGS) \
+	$(ARCH_ASFLAGS) \
+	$(PLATFORM_INCDIR)
+
+boot_ldr_LDADD = \
+	hal/libhal.a \
+	libreset.a \
+	xtos/libxtos.a \
+	xtos/libxlevel2.a \
+	xtos/libxlevel3.a \
+	xtos/libxlevel4.a \
+	xtos/libxlevel5.a \
+	-lgcc
+
+boot_ldr_LDFLAGS = \
+	$(ARCH_LDFLAGS) \
+	-T ../../platform/$(PLATFORM)/$(PLATFORM_BOOT_LDR_LDSCRIPT)
+
+boot_ldr-local:
+	cp boot_ldr boot_ldr-$(FW_NAME)
+	$(OBJCOPY) -O binary ../../platform/$(PLATFORM)/boot_module mod-boot-$(FW_NAME).bin
+	$(OBJCOPY) --add-section .module=mod-boot-$(FW_NAME).bin \
+		--set-section-flags .module=load,readonly boot_ldr-$(FW_NAME)
+	$(OBJCOPY) -O binary boot_ldr boot_ldr-$(FW_NAME).bin
+	$(OBJDUMP) -h -D boot_ldr > boot_ldr-$(FW_NAME).map
+	$(OBJDUMP) -S boot_ldr > boot_ldr-$(FW_NAME).lst
+	$(OBJDUMP) -D boot_ldr > boot_ldr-$(FW_NAME).dis
+
+RIMAGE_BOOT_FLAGS += boot_ldr-$(FW_NAME)
+BIN_FLAGS +=boot_ldr-local
+endif
+
+if BUILD_MODULE
+MODULE_COPY=$(OBJCOPY) -O binary ../../platform/$(PLATFORM)/module mod-$(FW_NAME).bin
+MODULE_INSERT=$(OBJCOPY) --add-section .module=mod-$(FW_NAME).bin \
+		--set-section-flags .module=load,readonly reef-$(FW_NAME)
+else
+MODULE_COPY=
+MODULE_INSERT=
+endif
+
+bin-local: $(BIN_FLAGS)
+	cp reef reef-$(FW_NAME)
+	$(MODULE_COPY)
+	$(MODULE_INSERT)
+	$(OBJDUMP) -S reef-$(FW_NAME) > reef-$(FW_NAME).lst
+	$(OBJDUMP) -D reef-$(FW_NAME) > reef-$(FW_NAME).dis
+	rimage -o reef-$(FW_NAME).ri -m $(FW_NAME) $(RIMAGE_BOOT_FLAGS) $(RIMAGE_FLAGS)
 
 vminstall-local:
 	scp -P 5555 reef-*.ri root at localhost:/lib/firmware/intel/
 
 clean-local:
-	rm -f reef-*.bin
+	rm -fr mod-*
+	rm -fr *.bin
 	rm -fr *.lst
 	rm -fr *.map
 	rm -fr *.dis
diff --git a/src/arch/xtensa/hal/Makefile.am b/src/arch/xtensa/hal/Makefile.am
index 247473e..d9c3a55 100644
--- a/src/arch/xtensa/hal/Makefile.am
+++ b/src/arch/xtensa/hal/Makefile.am
@@ -41,6 +41,31 @@ STATE_DEFS = \
 	-D__SPLIT__get_cpenable \
 	-D__SPLIT__set_cpenable
 
+STATE_DEFS_CNL = \
+	-D__SPLIT__extra_size \
+	-D__SPLIT__extra_align \
+	-D__SPLIT__cpregs_size \
+	-D__SPLIT__cpregs_align \
+	-D__SPLIT__cp_names \
+	-D__SPLIT__all_extra_size \
+	-D__SPLIT__all_extra_align \
+	-D__SPLIT__num_coprocessors \
+	-D__SPLIT__cp_num \
+	-D__SPLIT__cp_max \
+	-D__SPLIT__cp_mask \
+	-D__SPLIT__cp_id_mappings \
+	-D__SPLIT__cp_mask_mappings \
+	-D__SPLIT__init_mem_extra \
+	-D__SPLIT__init_mem_cp \
+	-D__SPLIT__save_extra \
+	-D__SPLIT__restore_extra \
+	-D__SPLIT__cpregs_save_fn \
+	-D__SPLIT__cpregs_restore_fn \
+	-D__SPLIT__validate_cp \
+	-D__SPLIT__invalidate_cp \
+	-D__SPLIT__get_cpenable \
+	-D__SPLIT__set_cpenable
+
 DISASS_DEFS = \
 	-D__SPLIT__op0_format_lengths \
 	-D__SPLIT__byte0_format_lengths \
@@ -161,6 +186,15 @@ PLATFORM_DEFS = \
 	$(CACHE_DEFS)
 endif
 
+if BUILD_CANNONLAKE
+PLATFORM_DEFS = \
+	$(STATE_DEFS_CNL) \
+	$(DISASS_DEFS) \
+	$(MISC_DEFS) \
+	$(INTERRUPTS_DEFS) \
+	$(CACHE_DEFS)
+endif
+
 noinst_LIBRARIES = libhal.a
 
 libhal_a_SOURCES = \
diff --git a/src/arch/xtensa/xtos/Makefile.am b/src/arch/xtensa/xtos/Makefile.am
index 9fff986..2e855e7 100644
--- a/src/arch/xtensa/xtos/Makefile.am
+++ b/src/arch/xtensa/xtos/Makefile.am
@@ -45,6 +45,12 @@ if BUILD_HASWELL
 PLATFORM_DEFS = $(VECTOR_DEFS)
 endif
 
+if BUILD_CANNONLAKE
+PLATFORM_DEFS = $(VECTOR_DEFS)
+noinst_LIBRARIES += libxlevel6.a
+VECTOR_DEFS += -D__SPLIT__level6
+endif
+
 LEVEL_SRC = \
 	int-handler.S \
 	int-vector.S \
diff --git a/src/platform/Makefile.am b/src/platform/Makefile.am
index 79446d0..93742b0 100644
--- a/src/platform/Makefile.am
+++ b/src/platform/Makefile.am
@@ -17,3 +17,7 @@ endif
 if BUILD_BROADWELL
 SUBDIRS = haswell
 endif
+
+if BUILD_CANNONLAKE
+SUBDIRS = cannonlake
+endif
-- 
2.14.1



More information about the Sound-open-firmware mailing list