Arduino code is C/C++ - should be able to write an init function and main loop and copy the contents of Arduino code, taking care to name the pins correctly as its different in C. Then compile it, see which functions fail, and add them from the Arduino library for SPI until all of it converted to C. You may need to add in C libraries in places such as serial comms and SPI.
The alternative is to export the Arduino code from the Arduino IDE as elf file, and then run the elf file on second core. For the duo that is relatively easy with the duo 1.0.9 Arduino distro - see here How to compile v1.0.9 to get the arduino-milkv-duo-v1.0.9-2024-0228.img? . Don’t fully understand how to get the second core working on duoS or a distro like ArchLinux that hasn’t got it yet. Doing a buildroot diff check between Arduino branch and default branch shows too many differences, and at the moment I can’t find any documentation on how its done. Ideally a script or a patch that adds Arduino functionality needed to stop having to hunt for solutions. Or merge the two ‘wasteful’ develop and Arduino branches and use a compile switch to add or remove the Arduino functionality.