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

undefined reference to `sys_arch_reboot' #31854

Closed
Dream-math opened this issue Feb 2, 2021 · 14 comments · Fixed by #31918
Closed

undefined reference to `sys_arch_reboot' #31854

Dream-math opened this issue Feb 2, 2021 · 14 comments · Fixed by #31918
Assignees
Labels
bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug

Comments

@Dream-math
Copy link

When I build my own application, it gets error during linking to generate zephyr_prebuilt.elf

/home/hye/bin/zephyr-sdk-0.12.2/riscv64-zephyr-elf/bin/../lib/gcc/riscv64-zephyr-elf/10.2.0/../../../../riscv64-zephyr-elf/bin/ld: libzephyr.a(reboot.c.obj): in function `sys_reboot':
/home/hye/tmp/zephyrproject/zephyr/subsys/power/reboot.c:25: undefined reference to `sys_arch_reboot'

but with the same prj.conf file it works in sample/hello_world, there are no errors. I try to find the differences of this two applications

my application:

/home/hye/bin/zephyr-sdk-0.12.2/riscv64-zephyr-elf/bin/riscv64-zephyr-elf-g++ CMakeFiles/zephyr_prebuilt.dir/misc/empty_file.c.obj -o zephyr_prebuilt.elf  -Wl,-T linker.cmd -Wl,-Map=/home/hye/tmp/tvm/tests/micro/qemu/test_zephyr-host-workspace/2021-02-01T17-04-41/build/runtime/zephyr/zephyr_prebuilt.map -Wl,--whole-archive libzephyr.a ../app/libapp.a arch/common/libarch__common.a arch/arch/riscv/core/libarch__riscv__core.a lib/libc/newlib/liblib__libc__newlib.a lib/posix/liblib__posix.a subsys/random/libsubsys__random.a drivers/serial/libdrivers__serial.a -Wl,--no-whole-archive kernel/libkernel.a CMakeFiles/offsets.dir/arch/riscv/core/offsets/offsets.c.obj -L"/home/hye/bin/zephyr-sdk-0.12.2/riscv64-zephyr-elf/bin/../lib/gcc/riscv64-zephyr-elf/10.2.0/rv32imafc/ilp32f" -L/home/hye/tmp/tvm/tests/micro/qemu/test_zephyr-host-workspace/2021-02-01T17-04-41/build/runtime/zephyr -lgcc -Wl,--print-memory-usage /home/hye/tmp/tvm/tests/micro/qemu/zephyr-runtime/libtvm__libutvm_rpc_server.a /home/hye/tmp/tvm/tests/micro/qemu/zephyr-runtime/libtvm__libutvm_rpc_common.a /home/hye/tmp/tvm/tests/micro/qemu/zephyr-runtime/libtvm__libcommon.a /home/hye/tmp/tvm/tests/micro/qemu/zephyr-runtime/libtvm__libsrc.a /home/hye/tmp/tvm/tests/micro/qemu/zephyr-runtime/libtvm__libmodule.a arch/common/libisr_tables.a -mabi=ilp32f -march=rv32imafc -Wl,--gc-sections -Wl,--build-id=none -Wl,--sort-common=descending -Wl,--sort-section=alignment -Wl,-u,_OffsetAbsSyms -Wl,-u,_ConfigAbsSyms -nostdlib -static -no-pie -Wl,-X -Wl,-N -Wl,--orphan-handling=warn -lm -Wl,-lc -L"/home/hye/bin/zephyr-sdk-0.12.2/riscv64-zephyr-elf/riscv64-zephyr-elf"/lib/rv32imafc/ilp32f -Wl,-lgcc -lc -specs=nano.specs
/home/hye/bin/zephyr-sdk-0.12.2/riscv64-zephyr-elf/bin/../lib/gcc/riscv64-zephyr-elf/10.2.0/../../../../riscv64-zephyr-elf/bin/ld: libzephyr.a(reboot.c.obj): in function `sys_reboot':
/home/hye/tmp/zephyrproject/zephyr/subsys/power/reboot.c:25: undefined reference to `sys_arch_reboot'

hello world

/home/hye/bin/zephyr-sdk-0.12.2/riscv64-zephyr-elf/bin/riscv64-zephyr-elf-g++ CMakeFiles/zephyr_prebuilt.dir/misc/empty_file.c.obj -o zephyr_prebuilt.elf  -Wl,-T linker.cmd -Wl,-Map=/home/hye/tmp/zephyrproject/zephyr/samples/hello_world/build/zephyr/zephyr_prebuilt.map -Wl,--whole-archive ../app/libapp.a libzephyr.a arch/common/libarch__common.a arch/arch/riscv/core/libarch__riscv__core.a lib/libc/newlib/liblib__libc__newlib.a lib/posix/liblib__posix.a subsys/random/libsubsys__random.a drivers/serial/libdrivers__serial.a -Wl,--no-whole-archive kernel/libkernel.a CMakeFiles/offsets.dir/arch/riscv/core/offsets/offsets.c.obj -L"/home/hye/bin/zephyr-sdk-0.12.2/riscv64-zephyr-elf/bin/../lib/gcc/riscv64-zephyr-elf/10.2.0/rv32imafc/ilp32f" -L/home/hye/tmp/zephyrproject/zephyr/samples/hello_world/build/zephyr -lgcc -Wl,--print-memory-usage arch/common/libisr_tables.a -mabi=ilp32f -march=rv32imafc -Wl,--gc-sections -Wl,--build-id=none -Wl,--sort-common=descending -Wl,--sort-section=alignment -Wl,-u,_OffsetAbsSyms -Wl,-u,_ConfigAbsSyms -nostdlib -static -no-pie -Wl,-X -Wl,-N -Wl,--orphan-handling=warn -lm -Wl,-lc -L"/home/hye/bin/zephyr-sdk-0.12.2/riscv64-zephyr-elf/riscv64-zephyr-elf"/lib/rv32imafc/ilp32f -Wl,-lgcc -lc -specs=nano.specs

still can't solve it, can anybody help me, thanks!

@Dream-math
Copy link
Author

It seems the error gets with multiple qemu simulated boards, it works on qemu_x86. Does it mean sys_arch_reboot need to be supported by soc, for example qemu_riscv32?

@nashif nashif added bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug labels Feb 2, 2021
@katsuster
Copy link
Member

Thanks for reporting. Additional information.

Reproduce this issue
Set CONFIG_REBOOT = y with qemu_riscv32/64 boards. If something got wrong please tell me.

@katsuster
Copy link
Member

I hope PR #31901 fixes this issue.

@Dream-math
Copy link
Author

Dream-math commented Feb 3, 2021

@katsuster thanks for your help, it does help to make the build work, but when I run my application, it will not exit normally, it just hangs out, I can only quit by Ctr+C, I will try to find the reason, thanks, you help me a lot!

@katsuster
Copy link
Member

OK, QEMU riscv-virt pc machine mode can reboot by writing special register.
I can add it by another PR...

@katsuster
Copy link
Member

Add PR #31918. I hope this helps.

@Dream-math
Copy link
Author

DO I need to add this new PR based on the old one? or recover the old one firstly, use this new alone? Thanks!

@katsuster
Copy link
Member

I checked on adding #31918 after #31901.
But I think #31918 will work alone and fine.

@katsuster
Copy link
Member

@nashif @MaureenHelm
I think it's better also merging #31901 to avoid build error around CONFIG_REBOOT features for RISC-V in other and future added boards.

@katsuster katsuster reopened this Feb 12, 2021
@katsuster
Copy link
Member

@nashif @MaureenHelm
Ping... How about this?

@MaureenHelm
Copy link
Member

@nashif @MaureenHelm
Ping... How about this?

@katsuster I don't understand your question?

@katsuster
Copy link
Member

@MaureenHelm
Sorry for cofusing.
In this issue, only #31918 is merged. But I think it's better also merge #31901.

@MaureenHelm
Copy link
Member

MaureenHelm commented Mar 4, 2021

Sorry for cofusing.
In this issue, only #31918 is merged. But I think it's better also merge #31901.

No problem, thanks for clarifying!

Can we close this issue now?

@katsuster
Copy link
Member

Thanks for merging. Yes we can close.

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 priority: low Low impact/importance bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants