pulp-platform / ri5cy_gnu_toolchain

22 stars 23 forks source link

Can't execute instruction "fdiv.d" which generated by double div operation #35

Open GUIDINGLI opened 4 years ago

GUIDINGLI commented 4 years ago

Hi,

Recently I use eth ri5cy toolchain to support pulp instruction.

Here is my steps.

  1. git clone https://github.com/pulp-platform/ri5cy_gnu_toolchain.git
  2. Compile toolchain with: make RISCY_FPU=1
  3. Compile C code with command: -march=RV32IMFDCXpulpv2 -mhard-float detail: ri5cy/bin/riscv32-unknown-elf-gcc -c -DNuttX -fno-builtin -Wall -Wstrict-prototypes -Wshadow -Wundef -g -Os -msave-restore -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer -ffunction-sections -fdata-sections -march=RV32IMFDCXpulpv2 -mhard-float fileA.c -o fileA.o

In my code, there is double operation:

define RND1_CONSTP 999563

static double_t frand1(void) { unsigned long randint = 30; return ((double_t)randint) / ((double_t)RND1_CONSTP); }

Very simple double operation. And after compile this C code will generate "fdiv.d" operation. But my core can't support "fdiv.d", after run this bin in ri5cy core, core will crash and report " Instruction Abort".

So, I remove the 'D', and it become: -march=RV32IMFCXpulpv2 -mhard-float

But this can't compile pass, meet: cc1: error: -march=RV32IMFCXpulpv2: single-precision-only is not yet supported

How to resolve this ?

Many thanks.

haresh-seenivasagan commented 4 months ago

Hi did you manage to address this issue ? i am facing the same issue