AVR Invalid instruction
Quote from czarusGG on December 14, 2023, 11:47 amHello everyone!
I wanted to report the following BUG:
"ERROR: AVR Invalid instruction: ELPM with no RAMPZ"
SimulIDE:
1.1.0 rev 2068
1.1.0 rev 1909Version:
WINDOWS 64Microcontroller:
ATMEGA 1284The error occurs when trying to use a class in C++
I'M GOING:
MICROCHIP STUDIO 7.0.2594Compiler:
AVR-GCCThe same HEX file loaded into the physical microcontroller works properly. It also runs correctly in the MICROCHIP STUDIO simulator and debugs correctly.
Regards...
PS. Sorry for any mistakes (google translate)
Hello everyone!
I wanted to report the following BUG:
"ERROR: AVR Invalid instruction: ELPM with no RAMPZ"
SimulIDE:
1.1.0 rev 2068
1.1.0 rev 1909
Version:
WINDOWS 64
Microcontroller:
ATMEGA 1284
The error occurs when trying to use a class in C++
I'M GOING:
MICROCHIP STUDIO 7.0.2594
Compiler:
AVR-GCC
The same HEX file loaded into the physical microcontroller works properly. It also runs correctly in the MICROCHIP STUDIO simulator and debugs correctly.
Regards...
PS. Sorry for any mistakes (google translate)
Uploaded files:Quote from arcachofo on December 14, 2023, 12:07 pmHi.
Seems that RAMPZ register is missing from atmega1284.
Please try this and let me know if the program is working:
Edit file data/AVR/mega1284 and add this at line 7:<regblock name="I/O_REG" start="0x003B" end="0x003B" offset="32"> <register name="RAMPZ" addr="0x003B" bits="" /> </regblock>
The file should look like this:
<!DOCTYPE SimulIDE> <mcu name="mega1284" core="AVR" data="16640" prog="131072" progword="2" eeprom="4096" inst_cycle="1" freq="16000000" > <include file="avr/avr_gpr.xml" /> <include file="megaxx4/mxx4_regs.xml" /> <regblock name="I/O_REG" start="0x003B" end="0x003B" offset="32"> <register name="RAMPZ" addr="0x003B" bits="" /> </regblock> <datablock name="RAM" start="0x0100" end="0x40FF"/> <include file="megaxx4/mxx4_int.xml" /> <include file="megaxx4/mxx4_perif.xml" /> </mcu>
Hi.
Seems that RAMPZ register is missing from atmega1284.
Please try this and let me know if the program is working:
Edit file data/AVR/mega1284 and add this at line 7:
<regblock name="I/O_REG" start="0x003B" end="0x003B" offset="32">
<register name="RAMPZ" addr="0x003B" bits="" />
</regblock>
The file should look like this:
<!DOCTYPE SimulIDE>
<mcu name="mega1284" core="AVR" data="16640" prog="131072" progword="2" eeprom="4096" inst_cycle="1" freq="16000000" >
<include file="avr/avr_gpr.xml" />
<include file="megaxx4/mxx4_regs.xml" />
<regblock name="I/O_REG" start="0x003B" end="0x003B" offset="32">
<register name="RAMPZ" addr="0x003B" bits="" />
</regblock>
<datablock name="RAM" start="0x0100" end="0x40FF"/>
<include file="megaxx4/mxx4_int.xml" />
<include file="megaxx4/mxx4_perif.xml" />
</mcu>
Quote from czarusGG on December 14, 2023, 12:46 pmSUCCESS!
Works in both versions of SimulIDE 🙂
Thank you very much!
Now, you need to remember to add the entry to the MCU definition 🙂
Thank you very much for your help.
SUCCESS!
Works in both versions of SimulIDE 🙂
Thank you very much!
Now, you need to remember to add the entry to the MCU definition 🙂
Thank you very much for your help.
Quote from average_simulide_enjoyer on November 26, 2024, 5:59 pmQuote from arcachofo on December 14, 2023, 12:07 pmHi.
Seems that RAMPZ register is missing from atmega1284.
Please try this and let me know if the program is working:
Edit file data/AVR/mega1284 and add this at line 7:<regblock name="I/O_REG" start="0x003B" end="0x003B" offset="32"> <register name="RAMPZ" addr="0x003B" bits="" /> </regblock>
XML
The file should look like this:
<!DOCTYPE SimulIDE> <mcu name="mega1284" core="AVR" data="16640" prog="131072" progword="2" eeprom="4096" inst_cycle="1" freq="16000000" > <include file="avr/avr_gpr.xml" /> <include file="megaxx4/mxx4_regs.xml" /> <regblock name="I/O_REG" start="0x003B" end="0x003B" offset="32"> <register name="RAMPZ" addr="0x003B" bits="" /> </regblock> <datablock name="RAM" start="0x0100" end="0x40FF"/> <include file="megaxx4/mxx4_int.xml" /> <include file="megaxx4/mxx4_perif.xml" /> </mcu>
XML
I have the same issue, but in regular ATmega128. It happens when i try to do one of these operations in C:
PORTC = displays[display_pos]; // tabela[displays[display_pos]];
if i use display_pos, it works. if i try to use it as an index of displays (array of 4 unsigned chars) and also that result as an index of table (an arraty of 12 unsigned chars). In the simulator, it just shows as 0, so all segments light up (im using PORTC as inputs for 7seg displays)
Quote from arcachofo on December 14, 2023, 12:07 pmHi.
Seems that RAMPZ register is missing from atmega1284.
Please try this and let me know if the program is working:
Edit file data/AVR/mega1284 and add this at line 7:<regblock name="I/O_REG" start="0x003B" end="0x003B" offset="32"> <register name="RAMPZ" addr="0x003B" bits="" /> </regblock>
XML
The file should look like this:
<!DOCTYPE SimulIDE> <mcu name="mega1284" core="AVR" data="16640" prog="131072" progword="2" eeprom="4096" inst_cycle="1" freq="16000000" > <include file="avr/avr_gpr.xml" /> <include file="megaxx4/mxx4_regs.xml" /> <regblock name="I/O_REG" start="0x003B" end="0x003B" offset="32"> <register name="RAMPZ" addr="0x003B" bits="" /> </regblock> <datablock name="RAM" start="0x0100" end="0x40FF"/> <include file="megaxx4/mxx4_int.xml" /> <include file="megaxx4/mxx4_perif.xml" /> </mcu>
XML
I have the same issue, but in regular ATmega128. It happens when i try to do one of these operations in C:
if i use display_pos, it works. if i try to use it as an index of displays (array of 4 unsigned chars) and also that result as an index of table (an arraty of 12 unsigned chars). In the simulator, it just shows as 0, so all segments light up (im using PORTC as inputs for 7seg displays)
Quote from arcachofo on November 27, 2024, 8:04 amI have the same issue, but in regular ATmega128. It happens when i try to do one of these operations in C:
Thanks for reporting.
The solution is the same but in file: data/AVR/mega128.mcu
I have the same issue, but in regular ATmega128. It happens when i try to do one of these operations in C:
Thanks for reporting.
The solution is the same but in file: data/AVR/mega128.mcu