rom: ci: build xtensa ROM images for CI boot testing.

Some platforms like APL, CNL and ICL have a ROM that read the manifest
and loads the boot loader. This builds a simple ROM so that qemu can
boot APL, CNL and ICL firmware images for CI boot testing.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
This commit is contained in:
Liam Girdwood 2018-11-21 20:58:45 +00:00
parent c0a77679d1
commit 93540c74eb
5 changed files with 102 additions and 5 deletions

View File

@ -413,6 +413,8 @@ AM_CONDITIONAL(BUILD_BOOTLOADER, test "$FW_NAME" = "apl" -o "$FW_NAME" = "cnl"
AM_CONDITIONAL(BUILD_CAVS, test "$FW_NAME" = "apl" -o "$FW_NAME" = "cnl" -o "$FW_NAME" = "icl" -o "$FW_NAME" = "sue" -o "$FW_NAME" = "skl" -o "$FW_NAME" = "kbl")
AM_CONDITIONAL(BUILD_MODULE, test "$FW_NAME" = "apl" -o "$FW_NAME" = "cnl" -o "$FW_NAME" = "icl" -o "$FW_NAME" = "sue" -o "$FW_NAME" = "skl" -o "$FW_NAME" = "kbl")
AM_CONDITIONAL(BUILD_APL_SSP, test "$FW_NAME" = "apl" -o "$FW_NAME" = "cnl" -o "$FW_NAME" = "icl" -o "$FW_NAME" = "sue" -o "$FW_NAME" = "skl" -o "$FW_NAME" = "kbl")
AM_CONDITIONAL(BUILD_VM_ROM, test "$FW_NAME" = "apl" -o "$FW_NAME" = "cnl" -o "$FW_NAME" = "icl" -o "$FW_NAME" = "sue" -o "$FW_NAME" = "skl" -o "$FW_NAME" = "kbl")
# DSP core support (Optional)
AC_ARG_WITH([dsp-core],
@ -427,6 +429,9 @@ case "$with_dsp_core" in
esac
PLATFORM_ROM_LDSCRIPT="rom.x"
AC_SUBST(PLATFORM_ROM_LDSCRIPT)
PLATFORM_BOOT_LDR_LDSCRIPT="boot_ldr.x"
AC_SUBST(PLATFORM_BOOT_LDR_LDSCRIPT)

View File

@ -202,6 +202,66 @@ RIMAGE_BOOT_FLAGS += boot_ldr-$(FW_NAME)
BIN_FLAGS +=boot_ldr-local
endif
if BUILD_VM_ROM
# ROM
noinst_PROGRAMS += \
rom
LINK_ROM_SCRIPT = ../../platform/$(PLATFORM)/$(PLATFORM_ROM_LDSCRIPT)
BUILT_SOURCES += $(LINK_ROM_SCRIPT)
CLEANFILES += $(LINK_ROM_SCRIPT)
nodist_rom_SOURCES = $(LINK_ROM_SCRIPT).in
$(LINK_ROM_SCRIPT): Makefile $(LINK_ROM_SCRIPT).in $(LINK_DEPS)
cat $(LINK_ROM_SCRIPT).in | $(CPP) -P $(PLATFORM_INCDIR) $(SOF_INCDIR) $(ARCH_INCDIR) - >$@
rom_LDADD = \
-lgcc
# SMP ROM uses UP CRT1
if BUILD_XTENSA_SMP
rom_SOURCES = \
smp/xtos/memctl_default.S \
smp/xtos/reset-vector.S \
up/xtos/crt1-boards.S
else
rom_SOURCES = \
up/xtos/reset-vector.S \
up/xtos/crt1-boards.S
endif
rom_CFLAGS = \
$(ARCH_INCDIR) \
$(AM_CFLAGS) \
$(ARCH_CFLAGS) \
$(PLATFORM_INCDIR) \
$(SOF_INCDIR) \
-DCONFIG_VM_ROM
rom_CCASFLAGS = \
$(ARCH_INCDIR) \
$(ASFLAGS) \
$(AM_CCASFLAGS) \
$(PLATFORM_INCDIR) \
-DCONFIG_VM_ROM
rom_LDFLAGS = \
$(AM_LDFLAGS) \
$(ARCH_LDFLAGS) \
-T ../../platform/$(PLATFORM)/$(PLATFORM_ROM_LDSCRIPT)
rom-local:
cp rom rom-$(FW_NAME)
$(OBJCOPY) -O binary rom rom-$(FW_NAME).bin
$(OBJDUMP) -h -D rom > rom-$(FW_NAME).map
$(OBJDUMP) -S rom > rom-$(FW_NAME).lst
$(OBJDUMP) -D rom > rom-$(FW_NAME).dis
BIN_FLAGS += rom-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 \

View File

@ -564,7 +564,7 @@ unpackdone:
*/
#if HAVE_XSR && (XCHAL_HAVE_XEA1 || XCHAL_HAVE_XEA2)
#if !CONFIG_BOOT_LOADER
#if !defined(CONFIG_BOOT_LOADER) || defined(CONFIG_VM_ROM)
# ifndef XCHAL_DEBUGLEVEL /* debug option not selected? */
# define XCHAL_DEBUGLEVEL 99 /* bogus value outside 2..6 */
# endif
@ -615,7 +615,7 @@ unpackdone:
* Note: This needs to be call0 regardless of the selected ABI.
*/
#if CONFIG_BOOT_LOADER
#if defined(CONFIG_BOOT_LOADER) && !defined(CONFIG_VM_ROM)
movi a0, SOF_TEXT_START
callx0 a0
#else

View File

@ -29,6 +29,7 @@
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <xtensa/coreasm.h>
#include <platform/memory.h>
#include <config.h>
// DF #include "xtos-internal.h"
//#include <xtensa/../../src/xtos/xtos-internal.h>
@ -93,6 +94,20 @@ _ResetVector:
.text
.align 4
.literal_position
// VM ROM jumps to boot loader in IMR/SRAM
#if defined(CONFIG_VM_ROM)
#if defined(CONFIG_SUECREEK)
_boot_ldr_entry:
.word BOOT_LDR_TEXT_ENTRY_BASE
#else
_boot_ldr_entry:
.word IMR_BOOT_LDR_TEXT_ENTRY_BASE
#endif
.align 4
#endif /* VM_ROM */
_start:
// _start is typically NOT at the beginning of the text segment --
// it is always called from either the reset vector or other code
@ -195,7 +210,7 @@ _start:
1:
/* boot loader takes care of zeroing BSS */
#if !defined(CONFIG_BOOT_LOADER)
#if !defined(CONFIG_BOOT_LOADER) && !defined(CONFIG_VM_ROM)
/*
* Clear the BSS (uninitialized data) segments.
* This code supports multiple zeroed sections (*.bss).
@ -272,6 +287,20 @@ _start:
*/
// Pass an empty argv array, with an empty string as the program name.
// VM ROM jumps to bootloader here.
#if defined(CONFIG_VM_ROM)
l32r a0, _boot_ldr_entry // load SRAM reset handler address
#if defined(CONFIG_SUECREEK)
callx8 a0 // jump to the handler
#else
callx12 a0
#endif
dead: nop
j dead
#endif /* VM ROM */
#if 0
movi ARG1, _start_argc // argc address
movi ARG2, _start_argv // argv = ["", 0]
@ -281,6 +310,8 @@ _start:
l32i ARG1, ARG1, 0 // argc = 1
CALL __clibrary_init
#endif
#if !defined(CONFIG_VM_ROM)
// Call: int main(int argc, char ** argv, char ** environ);
movi ARG1, _start_argc // argc address
movi ARG2, _start_argv // argv = ["", 0]
@ -291,6 +322,7 @@ _start:
// as the first outgoing argument.
// CALL exit // exit with main's return value
// Does not return here.
#endif
.data
// Mark argc/argv/envp parameters as weak so that an external

View File

@ -525,7 +525,7 @@ unpackdone:
*/
#if HAVE_XSR
#if !defined(CONFIG_BOOT_LOADER)
#if !defined(CONFIG_BOOT_LOADER) || defined(CONFIG_VM_ROM)
/* For asm macros; works for positive a,b smaller than 1000: */
# define GREATERTHAN(a,b) (((b)-(a)) & ~0xFFF)
@ -579,7 +579,7 @@ unpackdone:
* Note: This needs to be call0 regardless of the selected ABI.
*/
#if CONFIG_BOOT_LOADER
#if defined(CONFIG_BOOT_LOADER) && !defined(CONFIG_VM_ROM)
/*ToDo refine the _start*/
movi a0, SOF_TEXT_START
callx0 a0