sdk-ng icon indicating copy to clipboard operation
sdk-ng copied to clipboard

xtensa-sample_controller_zephyr-elf: qemu_xtensa boot failure with Newlib nano

Open stephanosio opened this issue 2 years ago • 0 comments
trafficstars

Zephyr fails to boot on qemu_xtensa (using xtensa-sample_controller_zephyr-elf toolchain) when the Newlib nano variant is selected.

Note that this issue is not observed when using the Newlib full variant (i.e. CONFIG_NEWLIB_LIBC_NANO=n).

Apply the following patch to ${ZEPHYR_SDK_INSTALL_DIR}/cmake/zephyr/Kconfig:

--- Kconfig
+++ Kconfig
@@ -2,7 +2,7 @@
 
 config TOOLCHAIN_ZEPHYR_0_16
        def_bool y
-       select HAS_NEWLIB_LIBC_NANO if (ARC || (ARM && !ARM64) || RISCV)
+       select HAS_NEWLIB_LIBC_NANO # if (ARC || (ARM && !ARM64) || RISCV)
 
 config TOOLCHAIN_ZEPHYR_SUPPORTS_THREAD_LOCAL_STORAGE
        def_bool y

To reproduce, run the following command:

west build -p -b qemu_xtensa -T tests/lib/newlib/thread_safety/libraries.libc.newlib_nano.thread_safety

QEMU exits without any useful messages inside memset called from xtensa_stack_init.

p.s. This issue might not be specific to xtensa-sample_controller_zephyr-elf and qemu_xtensa, and may be observed on other Xtensa targets.

stephanosio avatar Apr 11 '23 13:04 stephanosio