sipeed / platform-gd32v

GD32V: development platform for PlatformIO
https://registry.platformio.org/platforms/platformio/gd32v
Other
183 stars 46 forks source link

Problem with building "Error: illegal operands `addi sp,sp,-20*(1<<2)-20*FPREGBYTES'" #26

Open Dranzey opened 4 years ago

Dranzey commented 4 years ago

Hello everyone! Firstly i hope this is right place to post my problem. If it's not please redirect me to another section. I'm trying to build a Cmake based project on target: Sipeed Longan Nano, which is GD32VF103CBT6 MCU with RISC-V 32-bit core of GigaDevice. During configuration process i faced a problem with "entry.S" file, which was connected to the toolchain. I thinks it's some startup code. This are Assembler messages:

Error: illegal operands addi sp,sp,-20(1<<2)-20FPREGBYTES' Error: unrecognized opcode fpstore f0,(20(1<<2)+0FPREGBYTES)(sp)' Error: unrecognized opcode fpstore f1,(20(1<<2)+1FPREGBYTES)(sp)' Error: unrecognized opcode fpstore f2,(20(1<<2)+2FPREGBYTES)(sp)' Error: unrecognized opcode fpload f0,(20(1<<2)+0FPREGBYTES)(sp)' Error: unrecognized opcode fpload f1,(20(1<<2)+1FPREGBYTES)(sp)'

GPSBabelDeveloper commented 4 years ago

GD32V is an RV32IMAC core. It has integer the integer core (that's the I) and multiply and divide (that's the M) plus Atomics and Compressed. It doesn't have floating point. I would not expect fpload and fpstore to be valid opcodes.

I suspect that startup code that you don't understand doesn't understand this family of chips. I'm pretty sure that Longan Nano just doesn't have floating point. Maybe your configuration process needs a tweak to Not Do That, but if your mystery program really needs FP, you should brace yourself for floating point emulation libraries which can be terribly slow. So a lot depends on how badly your app really assumes the presence of FP.