Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build simple ROMs for CI testing of APL etc #606

Merged
merged 3 commits into from
Nov 22, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand All @@ -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)

Expand Down
61 changes: 60 additions & 1 deletion src/arch/xtensa/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -234,6 +294,5 @@ vminstall-local:

clean-local:
rm -fr mod-*
rm -fr *.bin
rm -fr *.map
rm -fr *.dis
4 changes: 2 additions & 2 deletions src/arch/xtensa/smp/xtos/reset-vector.S
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
34 changes: 33 additions & 1 deletion src/arch/xtensa/up/xtos/crt1-boards.S
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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).
Expand Down Expand Up @@ -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]
Expand All @@ -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]
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/arch/xtensa/up/xtos/reset-vector.S
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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
Expand Down
Loading