Compilation error 'panic: runtime error: index out of range'

EmbeddedMan
Posts: 597
Joined: Tue May 24, 2011 9:24 pm
Location: Minneapolis, MN
Contact:

Re: Compilation error 'panic: runtime error: index out of range'

Post by EmbeddedMan » Wed May 31, 2017 10:06 pm

jam123,

I'd like to try and reproduce this problem. Can you tell me what sketch you're trying to compile, and with what libraries, and for what board?

Thanks-

*Brian

jam123
Posts: 10
Joined: Tue Aug 02, 2011 3:43 am

Re: Compilation error 'panic: runtime error: index out of range'

Post by jam123 » Thu Jun 01, 2017 1:22 am

Sure. The arduino library that im using that causes the problem is from here:

( https://www.dimensionengineering.com/info/arduino )
https://www.dimensionengineering.com/so ... raries.zip

And I have followed the instructions at the chipkit site to install the chipkit build tools using the arduino board manager. Then I select the chipKit MAX32 board. Click verify, it compiles. Click verify again, it throws up the error.

Here is the sketch:

Code: Select all

// playing with motor driver
#include <SabertoothSimplified.h>

#define MAIN_LED_PIN 13

SabertoothSimplified ST( Serial1 );
                                        
void setup()
{
  pinMode( MAIN_LED_PIN, OUTPUT );

  //SabertoothTXPinSerial.begin(38400);
  Serial1.begin( 38400 );
}

void loop()
{
  ST.motor(1, 127);  // Go forward at full power.
  ST.motor(2, 127);
  delay( 2000 );       // Wait 2 seconds.
  ST.motor(1, 0);    // Stop.
  ST.motor(2, 50);
  delay(2000);       // Wait 2 seconds.
  ST.motor(1, -127); // Reverse at full power.
  ST.motor(2, -80 );
  delay(2000);       // Wait 2 seconds.
  ST.motor(1, 0);    // Stop.
  ST.motor(2, -127 );
  delay(2000);
  ST.motor( 2, 0 );
  delay( 1000 );

  // do heartbeat blink
  digitalWrite( MAIN_LED_PIN, HIGH );
  delay( 500 );
  digitalWrite( MAIN_LED_PIN, LOW );
  delay( 500 );
}

EmbeddedMan
Posts: 597
Joined: Tue May 24, 2011 9:24 pm
Location: Minneapolis, MN
Contact:

Re: Compilation error 'panic: runtime error: index out of range'

Post by EmbeddedMan » Thu Jun 01, 2017 4:14 am

I am unable to reproduce this. I copied all four of the sabertooth library folders into the sketchbook library folder, created a new sketch for MAX32, copied your sketch code in, and compiled twice, and neither time did I get any errors. This is under Arduino v1.8.2 IDE.

Am I doing anything differently than you did?

*Brian

jam123
Posts: 10
Joined: Tue Aug 02, 2011 3:43 am

Re: Compilation error 'panic: runtime error: index out of range'

Post by jam123 » Fri Jun 02, 2017 1:50 am

No that is what im doing. I'm on 64 bit Linux, maybe that is the reason? I downloaded the xz file directly from arduino com/org, unpacked it, and ran it from the folder.

Code: Select all

panic: runtime error: index out of range

goroutine 1 [running]:
panic(0x556bc0, 0xc420014230)
	/home/jenkins/go/src/runtime/panic.go:500 +0x1a1
arduino.cc/builder.findIncludesUntilDone(0xc420044c00, 0xc4201a2240, 0x556f40, 0xc4201d4ff0, 0xc42031e1bd, 0x18, 0x0, 0x0)
	/home/jenkins/workspace/arduino-builder-all-cross/src/arduino.cc/builder/container_find_includes.go:321 +0x138f
arduino.cc/builder.(*ContainerFindIncludes).Run(0x64d248, 0xc420044c00, 0x41bc3c3c, 0x0)
	/home/jenkins/workspace/arduino-builder-all-cross/src/arduino.cc/builder/container_find_includes.go:149 +0x5e4
arduino.cc/builder.runCommands(0xc420044c00, 0xc4204bfad8, 0x22, 0x22, 0x1, 0x0, 0x0)
	/home/jenkins/workspace/arduino-builder-all-cross/src/arduino.cc/builder/builder.go:191 +0xcd
arduino.cc/builder.(*Builder).Run(0xc4204bfd28, 0xc420044c00, 0xc420055d88, 0x562240)
	/home/jenkins/workspace/arduino-builder-all-cross/src/arduino.cc/builder/builder.go:124 +0xb9c
arduino.cc/builder.RunBuilder(0xc420044c00, 0xc420055d88, 0x64d248)
	/home/jenkins/workspace/arduino-builder-all-cross/src/arduino.cc/builder/builder.go:222 +0x35
main.main()
	/home/jenkins/workspace/arduino-builder-all-cross/src/arduino.cc/arduino-builder/main.go:338 +0x99c
/home/user...blah/arduino-1.8.2/arduino-builder returned 2
Error compiling for board chipKIT MAX32.

User avatar
majenko
Site Admin
Posts: 2164
Joined: Wed Nov 09, 2011 7:51 pm
Location: UK
Contact:

Re: Compilation error 'panic: runtime error: index out of range'

Post by majenko » Fri Jun 02, 2017 10:26 am

Maybe it is something specific to the Linux version (maybe they bundle a different version of "go") - I just had it fail on Linux with 1.8.2

All the more reason to ditch the Arduino IDE and switch to UECIDE...
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".

User avatar
majenko
Site Admin
Posts: 2164
Joined: Wed Nov 09, 2011 7:51 pm
Location: UK
Contact:

Re: Compilation error 'panic: runtime error: index out of range'

Post by majenko » Fri Jun 02, 2017 10:35 am

I have badgered them with a new issue for arduino-builder.
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".

User avatar
majenko
Site Admin
Posts: 2164
Joined: Wed Nov 09, 2011 7:51 pm
Location: UK
Contact:

Re: Compilation error 'panic: runtime error: index out of range'

Post by majenko » Fri Jun 02, 2017 10:24 pm

We're making progress. We've narrowed it down to the caching of the library details. For some reason it's not storing some of the cache data when it should.

Investigations continue...
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".

User avatar
majenko
Site Admin
Posts: 2164
Joined: Wed Nov 09, 2011 7:51 pm
Location: UK
Contact:

Re: Compilation error 'panic: runtime error: index out of range'

Post by majenko » Tue Jun 06, 2017 12:54 pm

OK, we nailed it. A PR with a fix has been submitted to chipKIT-core, and arduino-builder is also going to be hardened to prevent future similar issues.
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".

EmbeddedMan
Posts: 597
Joined: Tue May 24, 2011 9:24 pm
Location: Minneapolis, MN
Contact:

Re: Compilation error 'panic: runtime error: index out of range'

Post by EmbeddedMan » Tue Jun 06, 2017 2:37 pm

Very nice job Matt! Great detective work. I've merged the PR, so the fix will be in whatever the next chipKIT core version is.

Who did you work with at Arduino to get the AB fix in?

*Brian

User avatar
majenko
Site Admin
Posts: 2164
Joined: Wed Nov 09, 2011 7:51 pm
Location: UK
Contact:

Re: Compilation error 'panic: runtime error: index out of range'

Post by majenko » Tue Jun 06, 2017 3:28 pm

It was Matthijs Kooijman (@matthijskooijman on Github) that actually found what the cause was.
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".

Post Reply