Skip to content
Open
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
3 changes: 3 additions & 0 deletions app/boards/qemu_xtensa_dc233c.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ CONFIG_IPC_MAJOR_4=y
CONFIG_ZTEST=y
CONFIG_MM_DRV=y
CONFIG_ZEPHYR_NATIVE_DRIVERS=y

# Ensure the kernel can exit QEMU on shutdown/panic
CONFIG_REBOOT=y
3 changes: 3 additions & 0 deletions app/boards/qemu_xtensa_dc233c_mmu.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ CONFIG_ZTEST=y
CONFIG_TEST_USERSPACE=y
CONFIG_MM_DRV=y
CONFIG_ZEPHYR_NATIVE_DRIVERS=y

# Ensure the kernel can exit QEMU on shutdown/panic
CONFIG_REBOOT=y
18 changes: 18 additions & 0 deletions app/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <zephyr/kernel.h>
#include <sof/boot_test.h>
#include <zephyr/logging/log.h>

LOG_MODULE_REGISTER(main, LOG_LEVEL_DBG);

/* define qemu boot tests if any qemu target is defined, add targets to end */
Expand Down Expand Up @@ -56,12 +57,29 @@ static int sof_app_main(void)
return 0;
}

#if CONFIG_SOF_BOOT_TEST && defined(QEMU_BOOT_TESTS)
/* cleanly exit qemu so CI can continue and check test results */
static inline void qemu_xtensa_exit(int status)
{
register int syscall_id __asm__ ("a2") = 1; /* SYS_exit is 1 */
register int exit_status __asm__ ("a3") = status;

__asm__ __volatile__ (
"simcall\n"
:
: "r" (syscall_id), "r" (exit_status)
: "memory"
);
}
#endif

#if CONFIG_ZTEST
void test_main(void)
{
sof_app_main();
#if CONFIG_SOF_BOOT_TEST && defined(QEMU_BOOT_TESTS)
sof_run_boot_tests();
qemu_xtensa_exit(0);
#endif
}
#else
Expand Down
Loading
Loading