When compiling PK with the latest GCC v15 with architecture RV64GCV the compiler uses vector instructions for uart init before mstatus.VS is properly set which causes illegal instruction error in spike.
I assume gcc uses vector calling convention now, since compiling with -fno-tree-vectorize does not fix the issue.
The PK make script needs to set proper compiler flags for disabling vectorisation and vector calling convention (which I am not aware of) or needs to set mstatus ASAP before any compiler generated code gets executed.
What I did as a temporary fix in minit.c:
void init_first_hart(uintptr_t hartid, uintptr_t dtb)
{
// set mstatus first
mstatus_init();
// Confirm console as early as possible
query_uart(dtb);
query_uart16550(dtb);
query_uart_litex(dtb);
query_htif(dtb);
...
When compiling PK with the latest GCC v15 with architecture RV64GCV the compiler uses vector instructions for uart init before
mstatus.VS
is properly set which causes illegal instruction error in spike.See the instruction sequence:
I assume gcc uses vector calling convention now, since compiling with
-fno-tree-vectorize
does not fix the issue. The PK make script needs to set proper compiler flags for disabling vectorisation and vector calling convention (which I am not aware of) or needs to set mstatus ASAP before any compiler generated code gets executed.What I did as a temporary fix in
minit.c
:and removed the line