sdk-ng: ZTEST with snprintf causes CPU fault on qemu_x86 (0.12.0)
As in title. 0.12.0-beta-2 works well. Zephyr commit HASH: c08ef381c81926483e1469df6972fe063ac25954 Below output log and sample ztest.
SeaBIOS (version zephyr-v1.0.0-0-g31d4e0e-dirty-20200714_234759-fv-az50-zephyr)
Booting from ROM..*** Booting Zephyr OS version 2.4.99 ***
Running test suite littlefs_tests
===================================================================
START - test_snprintf_bug
E: Floating point unit device not available
E: EAX: 0x00238e44, EBX: 0x0023f720, ECX: 0x0021e700, EDX: 0x0011adfe
E: ESI: 0x0023f720, EDI: 0x001093fd, EBP: 0x00238e20, ESP: 0x00238d28
E: EFLAGS: 0x00000246 CS: 0x0008 CR3: 0x00243000
E: call trace:
E: EIP: 0x001014f2
E: 0x001011f8 (0x23f720)
E: 0x00108c18 (0x238ec9)
E: 0x0010c941 (0x0)
E: 0x0010940c (0x23f2c0)
E: >>> ZEPHYR FATAL ERROR 0: CPU exception on CPU 0
E: Current thread: 0x11d000 (unknown)
E: Halting system
#include <ztest.h>
#define MAX_PATH_LEN 255
const char FS_MOUNTING_POINT[] = "/lfs";
static void test_snprintf_bug(void)
{
char fname[MAX_PATH_LEN];
//printk("before snprintf\r\n");
snprintf(fname, sizeof(fname), "%s/test_file", FS_MOUNTING_POINT);
// printk("after snprintf\r\n");
zassert_true(1==1, "Test Ok");
}
void test_main(void)
{
ztest_test_suite(littlefs_tests,
ztest_unit_test(test_snprintf_bug)
);
ztest_run_test_suite(littlefs_tests);
}
CONFIG_ZTEST=y
CONFIG_ZTEST_STACKSIZE=32768
CONFIG_CONSOLE=y
CONFIG_SERIAL=y
CONFIG_NEWLIB_LIBC=y
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 20 (19 by maintainers)
Adding CONFIG_FPU=y allows the test to pass.