Digistump Forums
The Oak by Digistump => Oak Support => Topic started by: ajpowell on January 23, 2016, 10:31:22 am
-
Hi everyone,
Here are 4 issues that I have found when trying to compile my first Oak blink code and upload to my device - I have solutions to some of the issues (details below to help others hitting same problems and get folded into the code in due course) - because the uploader cannot find the particle config.json, I have not yet been able to upload my code to my device.
My environment:
- MacBook Pro running OSX 10.11.2 (El Capitan)
- Arduino IDE 1.6.7
These issues were encountered when compiling for the first time following the initial tutorial at http://digistump.com/wiki/oak/tutorials/arduino (http://digistump.com/wiki/oak/tutorials/arduino)
The setup of the Oak device and connection to Particle has worked perfectly - the firmware appears to have updated.
Note - to differentiate the blink slightly from the default blink I see on the device, I have modified the blink code, so that the on time is much shorter than the off time, otherwise the code is as listed:
// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(1, OUTPUT); //LED on Model A
}
// the loop routine runs over and over again forever:
void loop() {
digitalWrite(1, HIGH); // turn the LED on (HIGH is the voltage level)
Particle.delay(250); // wait for a tenth second
digitalWrite(1, LOW); // turn the LED off by making the voltage LOW
Particle.delay(1000); // wait for a second
}
1. First compilation attempt failed with:
"/Users/apowell/Library/Arduino15/packages/digistump/tools/esptool2/0.9.0/esptool2" -quiet -bin -boot2 -4096 -iromchksum "/var/folders/9s/c2psyzzd6g73bn_7kth3cqvm0000gn/T/buildda9acfd3e334df2868c83c8c224f82f1.tmp/oak_blink.ino.elf" "/var/folders/9s/c2psyzzd6g73bn_7kth3cqvm0000gn/T/buildda9acfd3e334df2868c83c8c224f82f1.tmp/oak_blink.ino.bin" .text .data .rodata
fork/exec /Users/apowell/Library/Arduino15/packages/digistump/tools/esptool2/0.9.0/esptool2: permission denied
Error compiling.
FIX: From command prompt,
cd ~/Library/Arduino15/packages/digistump/tools/esptool2/0.9.0/
chmod 755 esptool2
2. Recompiling then failed with the following:
Sketch uses 254,820 bytes (24%) of program storage space. Maximum is 1,040,368 bytes.
Global variables use 50,710 bytes (61%) of dynamic memory, leaving 31,210 bytes for local variables. Maximum is 81,920 bytes.
/Users/apowell/Library/Arduino15/packages/digistump/tools/oakcli/0.9.0/oak /var/folders/9s/c2psyzzd6g73bn_7kth3cqvm0000gn/T/buildda9acfd3e334df2868c83c8c224f82f1.tmp/oak_blink.ino.bin
java.io.IOException: Cannot run program "/Users/apowell/Library/Arduino15/packages/digistump/tools/oakcli/0.9.0/oak": error=13, Permission denied
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at java.lang.Runtime.exec(Runtime.java:620)
at java.lang.Runtime.exec(Runtime.java:485)
at processing.app.helpers.ProcessUtils.exec(ProcessUtils.java:11)
at cc.arduino.packages.Uploader.executeUploadCommand(Uploader.java:123)
at cc.arduino.packages.uploaders.SerialUploader.uploadUsingPreferences(SerialUploader.java:167)
at cc.arduino.UploaderUtils.upload(UploaderUtils.java:78)
at processing.app.Sketch.upload(Sketch.java:1178)
at processing.app.Sketch.exportApplet(Sketch.java:1152)
at processing.app.Sketch.exportApplet(Sketch.java:1124)
at processing.app.Editor$DefaultExportHandler.run(Editor.java:2430)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.IOException: error=13, Permission denied
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:248)
at java.lang.ProcessImpl.start(ProcessImpl.java:134)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
... 11 more
So, now the compiler appears to have succeeded, but was unable to run oakcli
FIX: From command prompt,
cd ~/Library/Arduino15/packages/digistump/tools/oakcli/0.9.0/
chmod 755 oak
3. Error when trying to find the configuration file:
"/Users/apowell/Library/Arduino15/packages/digistump/tools/esptool2/0.9.0/esptool2" -quiet -bin -boot2 -4096 -iromchksum "/var/folders/9s/c2psyzzd6g73bn_7kth3cqvm0000gn/T/buildda9acfd3e334df2868c83c8c224f82f1.tmp/oak_blink.ino.elf" "/var/folders/9s/c2psyzzd6g73bn_7kth3cqvm0000gn/T/buildda9acfd3e334df2868c83c8c224f82f1.tmp/oak_blink.ino.bin" .text .data .rodata
Sketch uses 254,820 bytes (24%) of program storage space. Maximum is 1,040,368 bytes.
Global variables use 50,710 bytes (61%) of dynamic memory, leaving 31,210 bytes for local variables. Maximum is 81,920 bytes.
/Users/apowell/Library/Arduino15/packages/digistump/tools/oakcli/0.9.0/oak /var/folders/9s/c2psyzzd6g73bn_7kth3cqvm0000gn/T/buildda9acfd3e334df2868c83c8c224f82f1.tmp/oak_blink.ino.bin
Config file not found at: undefined\oak\config.json - please run the oak tool from the command line with no arguments to configure.
So this is looking good - compilation seems to have worked, just now unable to run the oak tool - it is mentioned in the tutorial that you need to run the oakcli one-time to set up the Particle credentials, so ran the oakcli tool from the version I had installed i.e. at:
~/Library/Arduino15/packages/digistump/tools/oakcli/0.9.0/oak
I was prompted for Particle username/password and selected my device from the list - the configuration was written:
Adrians-MBP:0.9.0 apowell$ ./oak
Particle Username/Email:particle.io@xxxx.xx.xx
Particle Password:************
[1] Unnamed Device (Device ID: )xxxxxxxxxxxxxxxxxxxx77f6
Which device would you like to use? [1/0] :1
Configuration saved. You can now use this tool to upload files to your device.
4. Re-compiling and uploading then gives the following - still saying config not found:
Sketch uses 254,820 bytes (24%) of program storage space. Maximum is 1,040,368 bytes.
Global variables use 50,710 bytes (61%) of dynamic memory, leaving 31,210 bytes for local variables. Maximum is 81,920 bytes.
/Users/apowell/Library/Arduino15/packages/digistump/tools/oakcli/0.9.0/oak /var/folders/9s/c2psyzzd6g73bn_7kth3cqvm0000gn/T/buildda9acfd3e334df2868c83c8c224f82f1.tmp/oak_blink.ino.bin
Config file not found at: undefined\oak\config.json - please run the oak tool from the command line with no arguments to configure.
I notice now that the path that the tool is using is undefined\oak\config.json - this looks to be the issue, but not yet found a solution - doing a find across my whole system does not find an config.json file.
Does anyone have any ideas on the last issue?
-
"Config file not found at: undefined\oak\config.json - please run the oak tool from the command line with no arguments to configure."
there's a CLI tool that has to be run first to tell the IDE what oak device you're using. Check the readme at the bottom for the osx version
https://github.com/digistump/OakCLI
-
Thanks aja175.
I did do this - just checked that the version on Github was the same as the version pulled down during the board install process - oak -v reports v1.5.4 for both - it states that config is saved, but from Arduino IDE, it still shows:
/Users/apowell/Library/Arduino15/packages/digistump/tools/oakcli/0.9.0/oak /var/folders/9s/c2psyzzd6g73bn_7kth3cqvm0000gn/T/buildda9acfd3e334df2868c83c8c224f82f1.tmp/oak_blink.ino.bin
Config file not found at: undefined\oak\config.json - please run the oak tool from the command line with no arguments to configure.
I have now found the file - the contents of the directory now shows:
Adrians-MBP:0.9.0 apowell$ ls
oak undefined\oak\ undefined\oak\config.json
My guess is that this is not the intended location of the file...looking in the source for oak.js at https://github.com/digistump/OakCLI/blob/master/oak.js (https://github.com/digistump/OakCLI/blob/master/oak.js), I see:
pathToConfig = (process.env.APPDATA + "\\oak\\" || (process.platform == 'darwin' ? process.env.HOME + 'Library/Preferences/oak/' : process.env.HOME + '.oak/'));
As this is a Mac, the platform should report as 'darwin', so should be using ~/Library/Preferences/oak...that directory does not exist - I did try creating this and copying over the undefined\oak\config.json as config.json - but this still fails - when the Arduino IDE calls oak, it isn't using that path.
Will try to set up node.js so that I can build oak cli for myself and see if I can figure out the problem...though only dabbled with node.js a few years ago.
-
undefined\oak\config.json
There's probably supposed to be a file path there. Undefined doesn't bode well for it working.
-
I have been setting up node.js as detailed in issue #1 for the oakcli repository - I think I now have it working for OSX and can run in node, but can't yet get nexe working.
First the fix - probably a bit of a hack (javascript is not my forte):
Problem on my environment is that APPDATA is not defined (hence message given), so have modified the following line (line 10):
pathToConfig = (process.env.APPDATA + "\\oak\\" || (process.platform == 'darwin' ? process.env.HOME + 'Library/Preferences/oak/' : process.env.HOME + '.oak/'));
to:
pathToConfig = (process.platform == 'win32' ? process.env.APPDATA + "\\oak\\" : (process.platform == 'darwin' ? process.env.HOME + '/Library/Preferences/oak/' : process.env.HOME + '.oak/'));
So...added a test for win32 platform - if we are on win32, use APPDATA, if darwin (Mac OSX), using $HOME/Library/Preferences/oak, else (Linux) use $HOME/.oak - I also added a missing '/' in front of Library...
With some debug statements, I see that this now gives me:
pathToConfig: /Users/apowell/Library/Preferences/oak/
The config.json file is written to that directory.
Which is pretty much what I'd expect...What I cannot do is test on windows or Linux at the moment to ensure that still works...
Once I get nexe compiling, I hope that uploading the code will work...will report back later.
edit:
BTW, I am getting the following when running nexe:
Adrians-MBP:OakCLI apowell$ nexe -i ./oak.js -o ./oak
....> ERROR: option nodeConfigureArgs was empty
-
I have been setting up node.js as detailed in issue #1 for the oakcli repository - I think I now have it working for OSX and can run in node, but can't yet get nexe working.
First the fix - probably a bit of a hack (javascript is not my forte):
Problem on my environment is that APPDATA is not defined (hence message given), so have modified the following line (line 10):
pathToConfig = (process.env.APPDATA + "\\oak\\" || (process.platform == 'darwin' ? process.env.HOME + 'Library/Preferences/oak/' : process.env.HOME + '.oak/'));
to:
pathToConfig = (process.platform == 'win32' ? process.env.APPDATA + "\\oak\\" : (process.platform == 'darwin' ? process.env.HOME + '/Library/Preferences/oak/' : process.env.HOME + '.oak/'));
So...added a test for win32 platform - if we are on win32, use APPDATA, if darwin (Mac OSX), using $HOME/Library/Preferences/oak, else (Linux) use $HOME/.oak - I also added a missing '/' in front of Library...
With some debug statements, I see that this now gives me:
pathToConfig: /Users/apowell/Library/Preferences/oak/
The config.json file is written to that directory.
Which is pretty much what I'd expect...What I cannot do is test on windows or Linux at the moment to ensure that still works...
Once I get nexe compiling, I hope that uploading the code will work...will report back later.
edit:
BTW, I am getting the following when running nexe:
Adrians-MBP:OakCLI apowell$ nexe -i ./oak.js -o ./oak
....> ERROR: option nodeConfigureArgs was empty
In the comments section of the kickstarter comments page, DarkLotus has posted a link to his pull request for oak-cli (which includes a link to a binary for OS X). I've been able to flash my board, but it does not blink right now. So maybe it's better to wait :P
Issue created for the Fatal 28 issue on github
Linux and osx copies of oakcli built with path fix can be found at https://github.com/digistump/OakCLI/pull/2 for anyone eager.
-
Hey @djflix,
Good spot - I hadn't seen that!
I pulled it down and ran it standalone - works fine and save config in the correct location.
Copied the oak binary to:
cp oak ~/Library/Arduino15/packages/digistump/tools/oakcli/0.9.0/
And re-ran the Arduino IDE compile/upload again and it reports success:
Sketch uses 254,820 bytes (24%) of program storage space. Maximum is 1,040,368 bytes.
Global variables use 50,710 bytes (61%) of dynamic memory, leaving 31,210 bytes for local variables. Maximum is 81,920 bytes.
/Users/apowell/Library/Arduino15/packages/digistump/tools/oakcli/0.9.0/oak /var/folders/9s/c2psyzzd6g73bn_7kth3cqvm0000gn/T/buildda9acfd3e334df2868c83c8c224f82f1.tmp/oak_blink.ino.bin
Sending file to cloud, to flash to device.
Device flashing started successfully.
However, I think my fiddling (which included running the non-nexe version of oak and pointing to the build output oak_blink.ino.bin) has bricked the device (doesn't flash at all now) - just as well I bought 10 of them! Will hopefully recover the first device later...
-
Using a second Oak, it did appear to upload to Particle and claimed success, but I see no blinking at all.
I have now hooked up to the serial lines and once I had the rate correct (115200-8-N-1), I see the following being repeated:
Fatal exception (28):
epc1=0x40001800, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00637ff0, depc=0x00000000
Not quite sure how to proceed from here - Erik does mention that instructions for this will follow in the release notes here: https://github.com/digistump/OakCore/releases (https://github.com/digistump/OakCore/releases) - can't seem to get it to boot to WiFi Config as described in those notes either, so I guess I will have to wait until more details are published.
-
I think @ajpowell you already are aware of this - but for the record here - this is fixed in the newest beta release