Core dump: "illegal instruction"



  • I'm testing a quite complex application built with Kendrite-freertos-SDK.
    The aplication builds without issues and runs correctly for some time, but crashes after some time with "illegal instruction":

    core 0, core dump: illegal instruction
    Cause 0x0000000000000002, EPC 0x000000008000051c
    reg[00](zero ) = 0x0000000000000000, reg[01](ra   ) = 0x0000000080037bf0
    reg[02](sp   ) = 0x00000000800c0780, reg[03](gp   ) = 0x000000008009f6a0
    reg[04](tp   ) = 0x0000000000000000, reg[05](t0   ) = 0x00000000800c10b8
    reg[06](t1   ) = 0x0000000000000000, reg[07](t2   ) = 0x0000000000000000
    reg[08](s0/fp) = 0x0000000050440000, reg[09](s1   ) = 0x0000000022415ed0
    reg[10](a0   ) = 0x000000002e7ddb00, reg[11](a1   ) = 0x0000000000000000
    reg[12](a2   ) = 0x000000008009d344, reg[13](a3   ) = 0x00000000800c10b8
    reg[14](a4   ) = 0x000000000000003c, reg[15](a5   ) = 0x0000000080087b7e
    reg[16](a6   ) = 0x0000000023fd064c, reg[17](a7   ) = 0x0000000000000000
    reg[18](s2   ) = 0x00000000224162b8, reg[19](s3   ) = 0x0000000080075170
    reg[20](s4   ) = 0x00000000000000c0, reg[21](s5   ) = 0x0000000000000001
    reg[22](s6   ) = 0x00000000000000b0, reg[23](s7   ) = 0x0000000000000000
    reg[24](s8   ) = 0x00000000801ef11c, reg[25](s9   ) = 0x00000000800c0df0
    reg[26](s10  ) = 0x0000000000000000, reg[27](s11  ) = 0x000000008006fcc0
    reg[28](t3   ) = 0x00000000800744d8, reg[29](t4   ) = 0x0000000000000000
    reg[30](t5   ) = 0x0000000000000000, reg[31](t6   ) = 0x0000000000000020
    freg[00](ft0 ) = 0x0000000000000000, freg[01](ft1 ) = 0x0000000000000000
    freg[02](ft2 ) = 0x0000000000000000, freg[03](ft3 ) = 0x0000000000000000
    freg[04](ft4 ) = 0x0000000000000000, freg[05](ft5 ) = 0x0000000000000000
    freg[06](ft6 ) = 0x0000000000000000, freg[07](ft7 ) = 0x0000000000000000
    freg[08](fs0 ) = 0x0000000000000000, freg[09](fs1 ) = 0x0000000000000000
    freg[10](fa0 ) = 0x3f5664c5196f30c5, freg[11](fa1 ) = 0x4000000000000000
    freg[12](fa2 ) = 0x3ff0000000000000, freg[13](fa3 ) = 0x404e000000000000
    freg[14](fa4 ) = 0x4000000000000000, freg[15](fa5 ) = 0x41c73eed80000000
    freg[16](fa6 ) = 0x0000000000000000, freg[17](fa7 ) = 0x0000000000000000
    freg[18](fs2 ) = 0x0000000000000000, freg[19](fs3 ) = 0x0000000000000000
    freg[20](fs4 ) = 0x0000000000000000, freg[21](fs5 ) = 0x0000000000000000
    freg[22](fs6 ) = 0x0000000000000000, freg[23](fs7 ) = 0x0000000000000000
    freg[24](fs8 ) = 0x0000000000000000, freg[25](fs9 ) = 0x0000000000000000
    freg[26](fs10) = 0x3f5664c5196f30c5, freg[27](fs11) = 0x4000000000000000
    freg[28](ft8 ) = 0x3ff0000000000000, freg[29](ft9 ) = 0x404e000000000000
    freg[30](ft10) = 0x4000000000000000, freg[31](ft11) = 0x41c73eed80000000
    W (224024233636) SYSCALL: sys_exit called with 0x539
    

    The crash sometimes occurs only couple of seconds after start, sometimes the application runs for 10-20 minutes without issues and then crashes.

    What are the possible reasons for "illegal instruction" crash?
    The application was tested on two different boards ("Dan Dock" and Sipeed MAIX-Bit) and the same crash occurs on both, so I would eliminate the hardware cause.



  • very good!



  • I've solved the issue, it was caused by accidentally writing to the code memory.