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

posix:fpu: Enabling CONFIG_FPU and CONFIG_FPU_SHARING causes compiler error #81781

Open
allemanm opened this issue Nov 22, 2024 · 0 comments
Open
Labels
bug The issue is a bug, or the PR is fixing a bug

Comments

@allemanm
Copy link
Contributor

Describe the bug
When I build the hello_world sample for native_sim with CONFIG_FPU and CONFIG_FPU_SHARING enabled, the compiler throws an error. I am checked out on Zephyr 53738cf92479610bcf79fe738636a2b920224a36.

To Reproduce
Run the following command:
west build samples/hello_world -b native_sim -p -- -DCONFIG_FPU=y -DCONFIG_FPU_SHARING=y

Expected behavior
I would expect it to build successfully.

Logs and console output
Compiler output:

FAILED: zephyr/CMakeFiles/native_runner_executable zephyr/zephyr.exe /home/project/zephyr/build/zephyr/CMakeFiles/native_runner_executable /home/project/zephyr/build/zephyr/zephyr.exe 
cd /home/project/zephyr/build/zephyr && /usr/bin/make -f /home/project/zephyr/scripts/native_simulator/Makefile all --warn-undefined-variables -r NSI_CONFIG_FILE=/home/project/zephyr/build/zephyr/NSI/nsi_config
/usr/bin/ld: /home/project/zephyr/build/zephyr/NSI/home/project/zephyr/build/zephyr/zephyr.elf.loc_cpusw.o: in function `halt_thread':
/home/project/zephyr/kernel/sched.c:1372: undefined reference to `arch_float_disable'
collect2: error: ld returned 1 exit status
make: *** [/home/project/zephyr/scripts/native_simulator/Makefile:131: /home/project/zephyr/build/zephyr/zephyr.exe] Error 1
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: /usr/bin/cmake --build /home/project/zephyr/build

Additional context
I added the following to zephyr/arch/posix/core/thread.c but I am not sure if this is correct.

#if defined(CONFIG_FPU) && defined(CONFIG_FPU_SHARING)
int arch_float_disable(struct k_thread *thread)
{
	/* Posix always has FPU enabled so cannot be disabled */
	return -ENOTSUP;
}

int arch_float_enable(struct k_thread *thread, unsigned int options)
{
	/* Posix always has FPU enabled so nothing to do here */
	return 0;
}
#endif /* CONFIG_FPU && CONFIG_FPU_SHARING */
@allemanm allemanm added the bug The issue is a bug, or the PR is fixing a bug label Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue is a bug, or the PR is fixing a bug
Projects
None yet
Development

No branches or pull requests

1 participant