Replies: 3 comments
-
Beta Was this translation helpful? Give feedback.
-
Hrm. Maybe it's picking the wrong library because Zephyr doesn't know about this target? I just checked the C library using this command, which uses objdump on the entire library and looks for any instance of
|
Beta Was this translation helpful? Give feedback.
-
TL;DR: Copying I did some more digging just now, and it seems to indeed be some problem with the toolchain / how it is used. Here's the output from the default build when grepping for mul (just to show the issue is present). I marked the problematic ones with
I don't have a good understanding of GCC internals and its libc handling, but I played a bit around with the toolchain and managed to get rid of the MULs. It's not a fix, but it makes the problem go away, and I hope someone with a better understanding of GCC can help me come up with a proper fix. (I also played with So what I did was open the toolchain lib directory and replace the default set of files with the files from the rv32i directory:
(There are multiple "lib" directories, do it in all.) After that, building the hello_world sample again yields:
The offending MULs are gone. The remaining mul/mulhu/mulhsu are only part of the debug_info, so not actually part of the binary. Can anyone point me in the right direction on how to fix this properly? I might have some more time to dig into this in the upcoming days, but some pointers would centainly help. Markus |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I am on the latest release (v3.5.0) version of Zephyr with a not officially supported RV32I CPU (https://github.com/olofk/serv), built using the latest SDK (v0.16.4). When I build any example for this CPU, the emitted code contains MUL/DIV instructions and therefore fails to run on my rv32i (no m) CPU. The DTS does, however, clearly specify the RV32I instruction set: https://github.com/olofk/serv/blob/main/zephyr/dts/riscv/serv.dtsi#L18
The SERV repository is set up to be used as a west manifest, so you should be able to quickly reproduce this problem by building for the "service" target and looking at the disassembly.
From my troubleshooting so far, it looks as if the "offending" MULs/DIVs come from picolibc code (that afaik is delivered precompiled with the SDK). The -march to the rest of the code is fine, and it does not contain any MULs/DIVs.
I opened this as a discussion instead of an issue as suggested in the template to make sure there is no user error here. But we can migrate if this should turn out to be an issue in Zephyr / the related toolchain.
Thanks!
Markus
CC: @olofk
Beta Was this translation helpful? Give feedback.
All reactions