user42225: While running a program compiled in the Arduino IDE 1.8.5 and then using the .ELF file inside LabCenter Proteus 8.0, for an Arduino Nano ATMEL Mega 328P, for a code involving the use of the SoftwareSerial.h Library, hence involving several loops, without user interaction, I am getting the following error:
Invalid opcode 0x0024 at PC=0x0096

Now I am completely lost. According the AVR Instruction Set Manual such opcode should (not sure about this?) be RETI - Return From Interrupt at the Program Line (?) no.150 = 0x096. The full code has 779 lines plus several library calls, and the line 150 happens to fall just before the loop() function (?), which should never repeat, being just a declaration. 
So, how should I debug this error? Evidently I am not asking to solve the problem for me but, how should I proceed for debugging it and find the real error?
I have been unable to find in Proteus a tool for "Debug Stop if Error"
I have been unable to isolate the error in a simple way to share. It should be related someway with interruptions used by the library SoftwareSerial.h, because at some modifications of the program, the code freezes at an interruption return. I am working on that, but advancing really slowly actually.




Related question No.1.

user70609: First: Use the ino.hex file instead of the  .ELF file
Second: this error is showing because you are compiling your code with a different board. Make sure you are using the correct board over at the Arduino IDE. My advice is: switch your board to Arduino Uno both in proteus and over at the Arduino IDE and see if it works. Later on, you can try different boards.

user78042: Guys if you are facing the error of invalid opcode 0xffff at pc = 0x3e402 in proteus using Arduino, the GO to Arduino IDE software, and from the top menu, click on 'tool' and change the board type, e.g., Arduino UNO to Arduino Mega 2560.

42225: <p>While running a program compiled in the Arduino IDE 1.8.5 and then using the <code>.ELF</code> file inside <em>LabCenter Proteus 8.0</em>, for an <em>Arduino Nano</em> <em>ATMEL Mega 328P</em>, for a code involving the use of the <code>SoftwareSerial.h</code> Library, hence involving several loops, without user interaction, I am getting the following error:</p>

<pre><code>Invalid opcode 0x0024 at PC=0x0096
</code></pre>

<p>Now I am completely lost. According the <a href="http://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-0856-AVR-Instruction-Set-Manual.pdf" rel="nofollow noreferrer">AVR Instruction Set Manual</a> such opcode should (not sure about this?) be <em>RETI - Return From Interrupt</em> at the Program Line (?) no.150 = 0x096. The full code has 779 lines plus several library calls, and the line 150 happens to fall just before the <code>loop()</code> function (?), which should never repeat, being just a declaration. </p>

<p>So, how should I debug this error? Evidently I am not asking to solve the problem for me but, how should I proceed for debugging it and find the real error?</p>

<p>I have been unable to find in Proteus a tool for "Debug Stop if Error"</p>

<p>I have been unable to isolate the error in a simple way to share. It should be related someway with interruptions used by the library <code>SoftwareSerial.h</code>, because at some modifications of the program, the code freezes at an interruption return. I am working on that, but advancing really slowly actually.</p>

<p><a href="https://i.stack.imgur.com/Ctx6N.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Ctx6N.png" alt="enter image description here"></a>
<a href="https://i.stack.imgur.com/UeXmh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UeXmh.png" alt="enter image description here"></a>
<a href="https://i.stack.imgur.com/Fowci.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Fowci.png" alt="enter image description here"></a>
<a href="https://i.stack.imgur.com/Y0b0g.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Y0b0g.png" alt="enter image description here"></a></p>

<p>Related question <a href="https://electronics.stackexchange.com/questions/65271/how-to-get-rid-of-invalid-opcode-0x002a-at-pc-0x004-in-isis-proteus">No.1</a>.</p>
 70609: <p>First: Use the ino.hex file instead of the  .ELF file
Second: this error is showing because you are compiling your code with a different board. Make sure you are using the correct board over at the Arduino IDE. My advice is: switch your board to Arduino Uno both in proteus and over at the Arduino IDE and see if it works. Later on, you can try different boards.</p>
 78042: <p>Guys if you are facing the error of invalid opcode 0xffff at pc = 0x3e402 in proteus using Arduino, the GO to Arduino IDE software, and from the top menu, click on 'tool' and change the board type, e.g., Arduino UNO to Arduino Mega 2560.</p>
