Instructionfetchprohibited

db1992ger
Posts: 1
Joined: Sat Nov 25, 2023 11:28 am

Instructionfetchprohibited

Postby db1992ger » Sat Nov 25, 2023 11:59 am

Hello,

I use a ESP32 WROOM 32E Dev board and I have a question about the register dump I get. It looks like this:

Code: Select all

Guru Meditation Error: Core  1 panic'ed (InstrFetchProhibited). Exception was unhandled.

Core  1 register dump:
PC      : 0x00000000  PS      : 0x00060c30  A0      : 0x800d386d  A1      : 0x3ffd9740  
A2      : 0x3ffd5c58  A3      : 0x00000005  A4      : 0x3ffbdbac  A5      : 0x00000000  
A6      : 0x00000001  A7      : 0x00000064  A8      : 0x800d2691  A9      : 0x3ffd9720  
A10     : 0x3ffd3954  A11     : 0x00000000  A12     : 0x3ffbdbaf  A13     : 0x00000009  
A14     : 0x00000004  A15     : 0x3ffd96f0  SAR     : 0x0000000a  EXCCAUSE: 0x00000014  
EXCVADDR: 0x00000000  LBEG    : 0x4008751d  LEND    : 0x4008752d  LCOUNT  : 0xffffffff  


Backtrace: 0xfffffffd:0x3ffd9740 0x400d386a:0x3ffd9760 0x400d479c:0x3ffd9780
The last two pairs of instruction adresses in the backtrace lead to the task and the function in which the fatal error happens. But if my understanding is correct, then the PC in the first pair of adresses isn't a valid memory adress, because it should only go up to 0x5000_1FFF or it rather should be between 0x4007_0000 and 0x4009_FFFF (SRAM0).

The code and instruction in question are running fine for quite some time, so that there must be something else that corrupts the instruction adress. Where does "0xfffffffd" come from and what are possible causes for corrupting an instruction adress during runtime like this?

Here's a simplified version of what the code looks like. It works a million times.

Code: Select all

class aclass{
       bool set;
       void action(){
           Serial.println("test"); //
          // other stuff;
       };
}

aclass aclass_array[100];

loop{

  for(int i = 0; i < 100; i++){
       if(aclass_array[i].set){
               Serial.print("i = ");
               Serial.println(i); //When it chrashes, this is the last working line, although "i" is "valid". The serial.print at the beginning of 
                                          //the function won't be executed anymore
               aclass_array[i].action();
       }
  
   }
 //other stuff
}

ESP_Sprite
Posts: 9729
Joined: Thu Nov 26, 2015 4:08 am

Re: Instructionfetchprohibited

Postby ESP_Sprite » Sun Nov 26, 2023 12:35 am

Yep, 0x400d386a is the last valid address the PC had. Suggest you look at that line, see if it calls a function via a pointer (or e.g. a virtual function), and then try to figure out if you're overflowing a nearby buffer that causes that pointer to be corrupted.

Who is online

Users browsing this forum: Bing [Bot], Majestic-12 [Bot] and 72 guests