amperka / ino

Command line toolkit for working with Arduino hardware
http://inotool.org
MIT License
1.08k stars 232 forks source link

Can not work with Arduino IDE 1.5 #111

Open wengkai opened 11 years ago

wengkai commented 11 years ago

Because in the 1.5, the boards.txt is in /Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/avr

Will there be a simple way to specify the directory?

mikezter commented 11 years ago

I symlinked the IDE's hardware folder to one of Ino's load paths:

mkdir -p /usr/local/share/arduino/hardware
ln -s /Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/avr/ /usr/local/share/arduino/hardware/arduino
adamfeuer commented 11 years ago

I too am not able to get ino working with Arduino 1.5. I tried the symlink trick mentioned by @miketzer, and that got me further, but ran into some problems parsing the new boards.txt file.

I added some code to environment.py to get the file parsed, but now am failing because ino is trying to use the avr toolchain, while I need the sam toolchain because I have an Arduino Due.

Any ideas on how to proceed?

mikezter commented 11 years ago

Did you change the link target to /Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/sam ?

adamfeuer commented 11 years ago

No, I did not! Thanks!

I updated the link. But it still doesn't work. I'm getting this error now when I do ino build:

$ ino build
make: execvp: /bin/sh: Argument list too long
make: *** [.build/uno/src/sketch.d] Error 127
adamfeuer commented 11 years ago

Well, there was another problem - the .build/environment.pickle file was holding the old cached avr values.

I deleted that, and ino list-boards now reports the correct list of Due boards. But ino build still gives the error above.

I tried doing the following

$ ino build -m arduino_due_x --make /Applications/Arduino.app/Contents/Resources/Java//hardware/tools/avr/bin/make --cxx /Applications/Arduino.app/Contents/Resources/Java//hardware/tools/g++_arm_none_eabi/arm-none-eabi/bin/g++ --cc /Applications/Arduino.app/Contents/Resources/Java//hardware/tools/g++_arm_none_eabi/arm-none-eabi/bin/gcc --objcopy /Applications/Arduino.app/Contents/Resources/Java//hardware/tools/g++_arm_none_eabi/bin/arm-none-eabi-objcopy --ar /Applications/Arduino.app/Contents/Resources/Java//hardware/tools/g++_arm_none_eabi/arm-none-eabi/bin/ar

But I still get the same error.

paulhandy commented 11 years ago

I can second this error. Not having debugged this myself, I assume that the input arg is truncated, which leads to the error

osune commented 11 years ago
<osune@insektenprinz:~/Coding/arduino/radio>
zsh/3 58 [1] % ino build -d ~/.local/bin/arduino-nightly       
Searching for Board description file (boards.txt) ... /home/osune/.local/bin/arduino-nightly/hardware/arduino/boards.txt
Traceback (most recent call last):
  File "/home/osune/.local/bin/ino", line 6, in <module>
    main()
  File "/home/osune/.local/lib/pyhthon2.7/site-packages/ino/runner.py", line 64, in main
    e.process_args(args)
  File "/home/osune/.local/lib/python2.7/site-packages/ino/environment.py", line 263, in process_args
    all_models = self.board_models()
  File "/home/osune/.local/lib/python2.7/site-packages/ino/environment.py", line 204, in board_models
    subdict[key] = {}
TypeError: 'str' object does not support item assignment
zsh: exit 1     ino build -d ~/.local/bin/arduino-nightly

Running Arch Linux, and using a local copy of one of the latest nightly builds for Arduino 1.5. Ino version is 0.3.6, installed via pip. I also symlinked hardware/arduino/avr/boards.txt to hardware/arduino/boards.txt (for MEGA2560). Thought I would share my stacktrace, hope it helps!

octalsrc commented 11 years ago

I am receiving the exact same error as osune. I am also running Arch Linux, and am using Ino version 0.3.6-1 from the Arch User Repository and am using Arduino-Beta 1.5.4-1, also from the Arch User Repository.

octalsrc commented 11 years ago

I tried running [preproc], and now I am not getting osune's error anymore but am getting make error 127 (/bin/sh: Argument list too long) when I run [build].

justonia commented 11 years ago

I am currently working on a fork of this repo that works with Arduino 1.5.x:

https://github.com/justonia/ino

Right now my version breaks backwards compatibility with Arduino 1.0, though I'm considering fixing that as well so it'll work with both. You should be using the 1.5x branch, not master.

adamfeuer commented 11 years ago

On Mon, Nov 11, 2013 at 4:53 PM, Justin Larrabee notifications@github.comwrote:

I am currently working on a fork of this repo that works with Arduino 1.5.x, and thus the Due:

Cool!

Will you let me know if I can help?

cheers

adam

Adam Feuer adam@adamfeuer.com

bilics commented 10 years ago

Hi, did somebody worked this out ? I tried Justonia's fork but it gives the same errors as mentioned on this thread.

skraelings commented 10 years ago

Works for me, have downloaded arduino distribution (arduino-1.5.6-r2) with the 1.5x branch

ino build -m arduino_due_x_debug -d ~/arduino-1.5.6-r2 ino upload -m arduino_due_x_dbg -d ~/arduino-1.5.6-r2 -p /dev/ttyACM0

jurahudak commented 10 years ago

Got the same problem with "Argument list too long" using following versions: ino - f23ee5cb14edc30ec087d3eab7b301736da42362 Arduino sw: 1.5.6, 1.5.7 both 64b on Linux (Arch) (ino can't parse "nightly" as version string) target device: uno

There's a bunch of files in wifi related directories that I'm sure I don't need currently. :-)

My workaround now is: in ino/commands/build.py in function recursive_inc_lib_flags adding 'SOFTWARE_FRAMEWORK' or 'extras' into exclude parameter. Both work though I'm not sure if it breaks anything else. :-)

While building some code examples including Ethernet.h I couldn't include SPI.h which was not discovered. I ended up with forcing ino (the very samo build.py) to load AVR libraries from hardware/arduino/avr/libraries directory. I tried to make in a board/architecture-sensitive way.

Last issue I got while building an Ethernet.h sketch was the discovery of necessity of building using --cppflags="-DARDUINO_ARCH_AVR" and --cppflags="DARDUINO_AVR_UNO". Both copied from Arduino's IDE compilling progress.

Hope it helps. And sorry for a long post. :-)

jura

$ git pull
Already up-to-date.
$ git rev-parse HEAD
f23ee5cb14edc30ec087d3eab7b301736da42362
$ git diff ino/commands/build.py 
diff --git a/ino/commands/build.py b/ino/commands/build.py
index 65a9f8e..477b17e 100644
--- a/ino/commands/build.py
+++ b/ino/commands/build.py
@@ -132,6 +132,9 @@ class Build(Command):

         self.e.find_arduino_dir('arduino_libraries_dir', ['libraries'],
                                 human_name='Arduino standard libraries')
+        # Read arch specific libraries
+        self.e.find_arduino_dir('arduino_libraries_arch_dir', [os.path.join(board['_coredir'],'libraries')],
+                                human_name='Arduino standard '+board['build']['board']+' libraries')

         toolset = [
             ('make', args.make),
@@ -154,6 +157,8 @@ class Build(Command):
             mcu,
             '-DF_CPU=' + board['build']['f_cpu'],
             '-DARDUINO=' + str(self.e.arduino_lib_version.as_int()),
+            '-D'+(board['build']['core']+'_'+board['build']['board']).upper(), # -DARDUINO_AVR_UNO etc.
+            '-D'+(board['build']['core']+'_ARCH_'+board['build']['board'].split('_')[0]).upper(), # -DARDUINO_ARCH_AVR etc.
             '-I' + self.e['arduino_core_dir'],
         ]) 
         # Add additional flags as specified
@@ -221,7 +226,7 @@ class Build(Command):
         flags = SpaceList()
         for d in libdirs:
             flags.append('-I' + d)
-            flags.extend('-I' + subd for subd in list_subdirs(d, recursive=True, exclude=['examples']))
+            flags.extend('-I' + subd for subd in list_subdirs(d, recursive=True, exclude=['examples','SOFTWARE_FRAMEWORK','--extras']))
         return flags

     def _scan_dependencies(self, dir, lib_dirs, inc_flags):
@@ -246,7 +251,7 @@ class Build(Command):
     def scan_dependencies(self):
         self.e['deps'] = SpaceList()

-        lib_dirs = [self.e.arduino_core_dir] + list_subdirs(self.e.lib_dir) + list_subdirs(self.e.arduino_libraries_dir)
+        lib_dirs = [self.e.arduino_core_dir] + list_subdirs(self.e.lib_dir) + list_subdirs(self.e.arduino_libraries_dir) + list_subdirs(self.e.arduino_libraries_arch_dir)
         inc_flags = self.recursive_inc_lib_flags(lib_dirs)

         # If lib A depends on lib B it have to appear before B in final
alex0112 commented 7 years ago

I found a hack-ish workaround involving symlinking here:

https://arduino.stackexchange.com/questions/37495/why-is-my-boards-txt-file-not-being-found/37496#37496