chipKIT® Development Platform

Inspired by Arduino™

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

Created Tue, 13 Dec 2016 17:50:02 +0000 by biomurph


biomurph

Tue, 13 Dec 2016 17:50:02 +0000

Hi,

I'm having the same problem that was posted on the Digilent forum here https://forum.digilentinc.com/topic/3125-compile-works-once-then-strange-error-when-recompiling-same-code/#comment-11567

I can compile my code once, but then when I try to compile the exact same code again, I get the following error with verbose output:

Arduino: 1.6.13 (Mac OS X), Board: "OpenBCI 32"

/Applications/Arduino.app/Contents/Java/arduino-builder -dump-prefs -logger=machine -hardware /Applications/Arduino.app/Contents/Java/hardware -hardware /Applications/Arduino.app/Contents/Java/portable/packages -tools /Applications/Arduino.app/Contents/Java/tools-builder -tools /Applications/Arduino.app/Contents/Java/hardware/tools/avr -tools /Applications/Arduino.app/Contents/Java/portable/packages -built-in-libraries /Applications/Arduino.app/Contents/Java/libraries -libraries /Users/biomurph/Documents/Arduino/libraries -fqbn=chipKIT:pic32:openbci -ide-version=10613 -build-path /var/folders/t3/l33f2l513k95rr5c2r8m16h40000gn/T/arduino_build_605801 -warnings=none -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.drivers-windows.path=/Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/tools/drivers-windows/v2 -prefs=runtime.tools.pic32-tools.path=/Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/tools/pic32-tools/1.42-pic32gcc -prefs=runtime.tools.pic32prog.path=/Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/tools/pic32prog/v2.1.24 -verbose /Users/biomurph/Documents/Arduino/libraries/OpenBCI_32bit_Library/examples/DefaultBoard/DefaultBoard.ino
/Applications/Arduino.app/Contents/Java/arduino-builder -compile -logger=machine -hardware /Applications/Arduino.app/Contents/Java/hardware -hardware /Applications/Arduino.app/Contents/Java/portable/packages -tools /Applications/Arduino.app/Contents/Java/tools-builder -tools /Applications/Arduino.app/Contents/Java/hardware/tools/avr -tools /Applications/Arduino.app/Contents/Java/portable/packages -built-in-libraries /Applications/Arduino.app/Contents/Java/libraries -libraries /Users/biomurph/Documents/Arduino/libraries -fqbn=chipKIT:pic32:openbci -ide-version=10613 -build-path /var/folders/t3/l33f2l513k95rr5c2r8m16h40000gn/T/arduino_build_605801 -warnings=none -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.drivers-windows.path=/Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/tools/drivers-windows/v2 -prefs=runtime.tools.pic32-tools.path=/Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/tools/pic32-tools/1.42-pic32gcc -prefs=runtime.tools.pic32prog.path=/Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/tools/pic32prog/v2.1.24 -verbose /Users/biomurph/Documents/Arduino/libraries/OpenBCI_32bit_Library/examples/DefaultBoard/DefaultBoard.ino
Using board 'openbci' from platform in folder: /Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/hardware/pic32/1.3.1
Using core 'pic32' from platform in folder: /Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/hardware/pic32/1.3.1
Detecting libraries used...
"/Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/tools/pic32-tools/1.42-pic32gcc/bin/pic32-g++" -c -g -O2 -w  -DARDUINO_ARCH_PIC32 -mno-smart-io -ffunction-sections -fdata-sections  -mdebugger -Wcast-align -fno-short-double -ftoplevel-reorder -MMD -fno-exceptions -w -x c++ -E -CC -mprocessor=32MX250F128B -DF_CPU=40000000L -DARDUINO=10613 -D_BOARD_DP32_ -DARDUINO_ARCH_PIC32 -DMPIDEVER=16777998 -DMPIDE=150 -DIDE=Arduino -G1024 -D_USE_USB_FOR_SERIAL_ -I/var/folders/t3/l33f2l513k95rr5c2r8m16h40000gn/T/arduino_build_605801/sketch "-I/Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/hardware/pic32/1.3.1/cores/pic32" "-I/Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/hardware/pic32/1.3.1/variants/OpenBCI" "/var/folders/t3/l33f2l513k95rr5c2r8m16h40000gn/T/arduino_build_605801/sketch/DefaultBoard.ino.cpp" -o "/dev/null"
"/Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/tools/pic32-tools/1.42-pic32gcc/bin/pic32-g++" -c -g -O2 -w  -DARDUINO_ARCH_PIC32 -mno-smart-io -ffunction-sections -fdata-sections  -mdebugger -Wcast-align -fno-short-double -ftoplevel-reorder -MMD -fno-exceptions -w -x c++ -E -CC -mprocessor=32MX250F128B -DF_CPU=40000000L -DARDUINO=10613 -D_BOARD_DP32_ -DARDUINO_ARCH_PIC32 -DMPIDEVER=16777998 -DMPIDE=150 -DIDE=Arduino -G1024 -D_USE_USB_FOR_SERIAL_ -I/var/folders/t3/l33f2l513k95rr5c2r8m16h40000gn/T/arduino_build_605801/sketch "-I/Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/hardware/pic32/1.3.1/cores/pic32" "-I/Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/hardware/pic32/1.3.1/variants/OpenBCI" "-I/Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/hardware/pic32/1.3.1/libraries/DSPI" "/var/folders/t3/l33f2l513k95rr5c2r8m16h40000gn/T/arduino_build_605801/sketch/DefaultBoard.ino.cpp" -o "/dev/null"
"/Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/tools/pic32-tools/1.42-pic32gcc/bin/pic32-g++" -c -g -O2 -w  -DARDUINO_ARCH_PIC32 -mno-smart-io -ffunction-sections -fdata-sections  -mdebugger -Wcast-align -fno-short-double -ftoplevel-reorder -MMD -fno-exceptions -w -x c++ -E -CC -mprocessor=32MX250F128B -DF_CPU=40000000L -DARDUINO=10613 -D_BOARD_DP32_ -DARDUINO_ARCH_PIC32 -DMPIDEVER=16777998 -DMPIDE=150 -DIDE=Arduino -G1024 -D_USE_USB_FOR_SERIAL_ -I/var/folders/t3/l33f2l513k95rr5c2r8m16h40000gn/T/arduino_build_605801/sketch "-I/Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/hardware/pic32/1.3.1/cores/pic32" "-I/Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/hardware/pic32/1.3.1/variants/OpenBCI" "-I/Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/hardware/pic32/1.3.1/libraries/DSPI" "-I/Users/biomurph/Documents/Arduino/libraries/OBCI32_SD" "/var/folders/t3/l33f2l513k95rr5c2r8m16h40000gn/T/arduino_build_605801/sketch/DefaultBoard.ino.cpp" -o "/dev/null"
"/Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/tools/pic32-tools/1.42-pic32gcc/bin/pic32-g++" -c -g -O2 -w  -DARDUINO_ARCH_PIC32 -mno-smart-io -ffunction-sections -fdata-sections  -mdebugger -Wcast-align -fno-short-double -ftoplevel-reorder -MMD -fno-exceptions -w -x c++ -E -CC -mprocessor=32MX250F128B -DF_CPU=40000000L -DARDUINO=10613 -D_BOARD_DP32_ -DARDUINO_ARCH_PIC32 -DMPIDEVER=16777998 -DMPIDE=150 -DIDE=Arduino -G1024 -D_USE_USB_FOR_SERIAL_ -I/var/folders/t3/l33f2l513k95rr5c2r8m16h40000gn/T/arduino_build_605801/sketch "-I/Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/hardware/pic32/1.3.1/cores/pic32" "-I/Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/hardware/pic32/1.3.1/variants/OpenBCI" "-I/Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/hardware/pic32/1.3.1/libraries/DSPI" "-I/Users/biomurph/Documents/Arduino/libraries/OBCI32_SD" "-I/Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/hardware/pic32/1.3.1/libraries/EEPROM" "/var/folders/t3/l33f2l513k95rr5c2r8m16h40000gn/T/arduino_build_605801/sketch/DefaultBoard.ino.cpp" -o "/dev/null"
"/Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/tools/pic32-tools/1.42-pic32gcc/bin/pic32-g++" -c -g -O2 -w  -DARDUINO_ARCH_PIC32 -mno-smart-io -ffunction-sections -fdata-sections  -mdebugger -Wcast-align -fno-short-double -ftoplevel-reorder -MMD -fno-exceptions -w -x c++ -E -CC -mprocessor=32MX250F128B -DF_CPU=40000000L -DARDUINO=10613 -D_BOARD_DP32_ -DARDUINO_ARCH_PIC32 -DMPIDEVER=16777998 -DMPIDE=150 -DIDE=Arduino -G1024 -D_USE_USB_FOR_SERIAL_ -I/var/folders/t3/l33f2l513k95rr5c2r8m16h40000gn/T/arduino_build_605801/sketch "-I/Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/hardware/pic32/1.3.1/cores/pic32" "-I/Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/hardware/pic32/1.3.1/variants/OpenBCI" "-I/Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/hardware/pic32/1.3.1/libraries/DSPI" "-I/Users/biomurph/Documents/Arduino/libraries/OBCI32_SD" "-I/Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/hardware/pic32/1.3.1/libraries/EEPROM" "-I/Users/biomurph/Documents/Arduino/libraries/OpenBCI_32bit_Library" "/var/folders/t3/l33f2l513k95rr5c2r8m16h40000gn/T/arduino_build_605801/sketch/DefaultBoard.ino.cpp" -o "/dev/null"
"/Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/tools/pic32-tools/1.42-pic32gcc/bin/pic32-g++" -c -g -O2 -w  -DARDUINO_ARCH_PIC32 -mno-smart-io -ffunction-sections -fdata-sections  -mdebugger -Wcast-align -fno-short-double -ftoplevel-reorder -MMD -fno-exceptions -w -x c++ -E -CC -mprocessor=32MX250F128B -DF_CPU=40000000L -DARDUINO=10613 -D_BOARD_DP32_ -DARDUINO_ARCH_PIC32 -DMPIDEVER=16777998 -DMPIDE=150 -DIDE=Arduino -G1024 -D_USE_USB_FOR_SERIAL_ -I/var/folders/t3/l33f2l513k95rr5c2r8m16h40000gn/T/arduino_build_605801/sketch "-I/Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/hardware/pic32/1.3.1/cores/pic32" "-I/Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/hardware/pic32/1.3.1/variants/OpenBCI" "-I/Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/hardware/pic32/1.3.1/libraries/DSPI" "-I/Users/biomurph/Documents/Arduino/libraries/OBCI32_SD" "-I/Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/hardware/pic32/1.3.1/libraries/EEPROM" "-I/Users/biomurph/Documents/Arduino/libraries/OpenBCI_32bit_Library" "/var/folders/t3/l33f2l513k95rr5c2r8m16h40000gn/T/arduino_build_605801/sketch/DefaultBoard.ino.cpp" -o "/var/folders/t3/l33f2l513k95rr5c2r8m16h40000gn/T/arduino_build_605801/preproc/ctags_target_for_gcc_minus_e.cpp"
panic: runtime error: index out of range

goroutine 1 [running]:
panic(0x1519c0, 0xc4200100a0)
	/usr/local/go/src/runtime/panic.go:500 +0x1a1
arduino.cc/builder.findIncludesUntilDone(0xc42006f500, 0xc4203aacc0, 0x151ce0, 0xc42035d680, 0xc4202d01b6, 0x8, 0x0, 0x0)
	/Users/jenkins/jenkins/workspace/arduino-builder-macosx/src/arduino.cc/builder/container_find_includes.go:321 +0x138f
arduino.cc/builder.(*ContainerFindIncludes).Run(0x244c58, 0xc42006f500, 0x41bc3c3c, 0x0)
	/Users/jenkins/jenkins/workspace/arduino-builder-macosx/src/arduino.cc/builder/container_find_includes.go:149 +0x5e4
arduino.cc/builder.runCommands(0xc42006f500, 0xc4201a9af8, 0x22, 0x22, 0x1, 0x0, 0x0)
	/Users/jenkins/jenkins/workspace/arduino-builder-macosx/src/arduino.cc/builder/builder.go:189 +0xcd
arduino.cc/builder.(*Builder).Run(0xc4201a9d48, 0xc42006f500, 0xc42003bda8, 0x15cc60)
	/Users/jenkins/jenkins/workspace/arduino-builder-macosx/src/arduino.cc/builder/builder.go:124 +0xb90
arduino.cc/builder.RunBuilder(0xc42006f500, 0xc42003bda8, 0x244c58)
	/Users/jenkins/jenkins/workspace/arduino-builder-macosx/src/arduino.cc/builder/builder.go:220 +0x35
main.main()
	/Users/jenkins/jenkins/workspace/arduino-builder-macosx/src/arduino.cc/arduino-builder/main.go:316 +0x912
/Applications/Arduino.app/Contents/Java/arduino-builder returned 2
Error compiling for board OpenBCI 32.

I'm using Arduino 1.6.13 with ChipKIT 1.3.1 installed. I can't post the verbose output when compilation is successful, because it is too many characters.

If I close the programming window (not quit out of the IDE, just close the window) and then reopen the program, I can compile again OK, but only once. The code that I'm using is from this repo https://github.com/OpenBCI/OpenBCI_32bit_Library and I'm trying to deploy the DefaultBoard.ino from the examples folder. Can you see if you can reproduce the problem? Or perhaps the verbose output will help figure out where the error is happening.


majenko

Tue, 13 Dec 2016 21:24:51 +0000

It looks like this is actually a bug in Arduino-Builder, part of the IDE.


jasonk

Tue, 13 Dec 2016 21:32:28 +0000

/usr/local/go/src/runtime/panic.go:500 +0x1a1 arduino.cc/builder.findIncludesUntilDone

Maybe something funky with the include files?


majenko

Tue, 13 Dec 2016 22:28:21 +0000

I have just submitted a PR to OpenBCI to fix the use of plib.h in one of their libraries (OBCI32_SD.h) which was causing it to break on the more recent compilers. This library is used in the DefaultBoard.ino example. You can manually remove plib.h from your copy (OBCI32_SD/utility/Sd2Card.cpp) by just removing the "#include <plib.h>" line.

See if that helps it to compile.


biomurph

Tue, 13 Dec 2016 22:35:34 +0000

Merged your pull request. Thanks majenko!

This does not fix the problem of compile success happening only once, and then failing after. Were you able to replicate the error? Paul Stoffregen links to his code repo that has the same problem in the Digilent forum post I linked to above.


majenko

Tue, 13 Dec 2016 22:50:07 +0000

Compilation works fine in UECIDE with all the latest chipKIT core and compiler (now plib is removed), which leads me to suspect the IDE is to blame. I don't have it installed at the moment so I can't try it.

By the way, there's at least one place in the examples where there is a capitalization problem in the include filenames. It breaks compiling on operating systems with case sensitive filesystems (32Bit vs 32bit is the one I found).


majenko

Tue, 13 Dec 2016 23:01:59 +0000

I can't get it to even start to compile in the Arduino IDE in Linux due to (again) a b0rk with capitalization (damned windows users!!!!!)


majenko

Tue, 13 Dec 2016 23:06:26 +0000

PR to chipKIT-core submitted to fix that gripe.

In Linux on 1.6.9 I can compile DefaultBoard.ino over and over and over again.

Same on 1.6.11. I need to download a newer one...


majenko

Tue, 13 Dec 2016 23:15:33 +0000

Bingo. 1.6.13: panic: runtime error: index out of range

Same in 1.6.12

So something broke in the IDE between 1.6.11 and 1.6.12


biomurph

Tue, 13 Dec 2016 23:23:51 +0000

Ok, well I guess I'm forum hopping! Thanks, majenko for helping to chase down this problem.


majenko

Wed, 14 Dec 2016 00:06:06 +0000

's OK...

I guess the next step will be to identify the commits that happened between 1.6.11 and 1.6.12 and find the one that broke it.


majenko

Wed, 14 Dec 2016 00:54:08 +0000

Wild guess:

commit 17063d0fec7d3269d65a0563dbd9e5bd8f4459ef
Author: Martino Facchin &lt;m.facchin@arduino.cc&gt;
Date:   Thu Sep 15 18:10:51 2016 +0200

    Update arduino-builder to 1.3.21_r1
    
    Like 1.3.21 but recompiled with go 1.7.1 on OSX to avoid crashing on Sierra

majenko

Wed, 14 Dec 2016 00:56:23 +0000

Nope. Maybe this one:

commit e9439c2c32ca6cf7c731dbc1402de3ae37435af9
Author: jenkins &lt;jenkins@jenkins.fablabtorino&gt;
Date:   Fri Aug 26 19:19:46 2016 +0200

    update arduino-builder to 1.3.21

majenko

Wed, 14 Dec 2016 00:59:27 +0000

Yep, that's the puppy. Upgrading to Arduino-builder 1.3.21 broke it.


majenko

Wed, 14 Dec 2016 01:09:19 +0000

Ok, tomorrow's task - trawl through arduino-builder's commits between 1.3.20 and 1.3.21 and see what broke (btw, I tried upgrading to 1.3.22 and it was just as broken).


photomankc

Wed, 11 Jan 2017 06:48:27 +0000

Any news on this issue? I've run right into it on my system with Arduino 1.8.1 and ChipKit 1.3.0 and 1.3.1. Very frustrating. I have to change boards under tools for each compile after the first one.


majenko

Wed, 11 Jan 2017 10:41:56 +0000

The simple fix is to not use Arduino IDE past 1.6.11. Better, use UECIDE - there is no problem with that.

Arduino Builder is very much a closed book to me. It's written in some strange language that only three people on the planet understand.


photomankc

Wed, 11 Jan 2017 19:00:36 +0000

Thanks for the tip! I downgraded to 1.6.11 and presto it's working again. I really only use it to push the code to the board so as long as it compiles and loads the program, I'm good to go. I use Eclipse to edit the source so I don't much care about the Arduino IDE features so no big bother to back-track.

I tried the UCEIDE, and it almost worked but it chokes on some 3rd party libraries even when I point the locations preferences to the folders or copy them into the default libraries folder. Didn't pry much further because 1.6.11 works and I'm lazy. I'll just stay at 1.6.11. I do like the interface and code organization from what I saw.

Thanks again for pointing me to the right version. I'm on now to writing working code!

=======================================================+

Just an observation from someone coming back after several years. The development tools are kind of a tangled web. MPIDE is mentioned all over of course but a note says it's no longer developed and Arduino is preferred and where to go for current Programming. That of course leads one to the 1.8.1 version now. But now we have this bug and it sounds as though that's not going to be fixed soon. Then MPLAB X is mentioned but that is a whole 'nother world to jump into and now you are developing for only the PIC platform.

Don't take this as a swipe, it's not, just noting that for a person first looking at the platform it's a bit confusing how to get the right development environment going.


majenko

Wed, 11 Jan 2017 20:59:04 +0000

You are quite right, yes, it is a bit confusing.

MPIDE is dead. The problem is the documentation doesn't know it.

Arduino IDE is broken, but isn't under our control, so getting it fixed isn't an easy job, especially as we don't really know what is wrong with it.

MPLAB-X is not for mere humans.

UECIDE is what I would always recommend, but it is only me working on it. Feedback on things not working is essential so I can get it working. I'd love it if you could give it another go and let me know what isn't working.


photomankc

Wed, 11 Jan 2017 22:28:32 +0000

UECIDE is what I would always recommend, but it is only me working on it. Feedback on things not working is essential so I can get it working. I'd love it if you could give it another go and let me know what isn't working.

Very nice effort for a one-man show! I'll try to create something simple from the ground up and see if I can isolate what it's griping about really. The library in question was a psuedo-threading library and the compiler was claiming the included headers were not found despite including it in the preferences dialog under locations. So it's just an environment setup issue. I imagine if I pulled it all into the project folder it would compile fine.


majenko

Thu, 12 Jan 2017 01:08:48 +0000

This will be a file naming issue. Your library folder is called "ArduinoThread" yet there is no "ArduinoThread.h" file within it. One of the more strict rules of UECIDE is that a library has to be "xxx/xxx.h" where xxx is the same for both the folder and the master header file.

It needs this so that it can treat each library as a discrete entity in its own right - that way it can then look for libraries this library depends on and automatically include them - something the Arduino IDE can't do ;)

So if you rename the folder "Thread" then it should work fine, and that library will be known as "Thread".


photomankc

Fri, 13 Jan 2017 14:15:41 +0000

That makes sense. Good catch. I see now that I need to right-click the Library side-bar item and add the Library, which does as you indicate and plops in an include pointing at "FolderName.h". Change or remove that include and the library disappears in the side-bar. I get it now. Thanks!

ETA: With a bit of fix-up on the naming of things the project compiles great! Much faster than ArduinoIDE too!


jam123

Mon, 06 Feb 2017 04:54:31 +0000

Same problem here trying to compile with a library for a Sabertooth motor controller. Arduino 1.6.12. Chipkit max32. Just wanted to add meself here in case there is any news.


williamhdean

Mon, 20 Feb 2017 22:04:32 +0000

Thanks for the work. Question - when trying to install UCIDE on linux, where are the instructions for installing after I get the jar file? Sorry ... Newb.


majenko

Mon, 20 Feb 2017 22:22:58 +0000

On linux you should really use the repository (assuming a debian based system like ubuntu) - it'll keep you up to date properly.

Add to /etc/apt/sources.list:

deb http://majenko.co.uk/debian stable main
deb http://majenko.co.uk/debian unstable main

Run:

$ sudo apt-get update
$ sudo apt-get install majenko-keyring
$ sudo apt-get update
$ sudo apt-get install uecide

If you don't have a debian based Linux (say you're on Fedora Core, or Gentoo or something) then you should download the ZIP version. In there is a script to run that executes java with the jar file. Just like Arduino.

If you want to run the jar file manually you can:

$ java -jar uecide.jar

jpswensen

Mon, 15 May 2017 22:17:49 +0000

Any update on getting this solved? I was giving a PID control tutorial to the Robotics Club at the university and we spent more time dealing with this problem than actually getting any tutorial'ing done.

I have a student in lab who is now struggling with the same thing. It would be really nice to develop for all our boards out of the same IDE, but maybe that isn't possible unless I switch to UECIDE?!?!?!


EmbeddedMan

Tue, 16 May 2017 00:45:01 +0000

jpswensen,

Just to clarify - are you trying to run all 4 boards under UECIDE, and you get these compile errors in that situation? Or are you using chipKIT-core in the Arduino IDE?

*Brian


majenko

Tue, 16 May 2017 09:37:25 +0000

The index out of range thing is a known bug in Arduino Builder, which UECIDE doesn't use. I haven't seen it mentioned recently though so it may be fixed in the 1.8.x series? I'll dig one out and have a play.


majenko

Tue, 16 May 2017 09:54:10 +0000

Well the OpenBCI DefaultBoard sketch compiles cleanly in IDE version 1.8.2 with chipKIT Core 1.4.1 installed. No Wukkas, to quote Dave....


jam123

Wed, 31 May 2017 20:26:58 +0000

>>Same problem here trying to compile with a library for a Sabertooth motor controller. Arduino 1.6.12. Chipkit max32. Just wanted to add meself here in case there is any news. <<

I just tried arduino 1.8.2 and it is still broken for me.


EmbeddedMan

Wed, 31 May 2017 21:06:12 +0000

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

Thu, 01 Jun 2017 00:22:40 +0000

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

( https://www.dimensionengineering.com/info/arduino ) [url]https://www.dimensionengineering.com/software/SabertoothArduinoLibraries.zip[/url]

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:

// playing with motor driver
#include &lt;SabertoothSimplified.h&gt;

#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

Thu, 01 Jun 2017 03:14:51 +0000

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

Fri, 02 Jun 2017 00:50:11 +0000

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.

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.

majenko

Fri, 02 Jun 2017 09:26:32 +0000

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...


majenko

Fri, 02 Jun 2017 09:35:22 +0000

I have badgered them with a new issue for arduino-builder.


majenko

Fri, 02 Jun 2017 21:24:21 +0000

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...


majenko

Tue, 06 Jun 2017 11:54:17 +0000

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.


EmbeddedMan

Tue, 06 Jun 2017 13:37:53 +0000

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


majenko

Tue, 06 Jun 2017 14:28:09 +0000

It was Matthijs Kooijman (@matthijskooijman on Github) that actually found what the cause was.


rasmadrak

Thu, 29 Jun 2017 14:06:14 +0000

Awesome!

I'll still be using UECIDE though... ;D


majenko

Fri, 30 Jun 2017 09:31:18 +0000

Good man :)


jam123

Thu, 20 Jul 2017 20:10:32 +0000

I just tried arduino 1.8.3. No problems.


majenko

Thu, 20 Jul 2017 21:26:25 +0000

The fix has been rolled into the newly released chipKIT Core 1.4.2.