Arduino 023 installation in Ubuntu avrdude problems[SOLVED].

I have installed version 1.0.1 IDE . It run with no problems.
But since most of my sketches have large sizes , I need to go back to previous Ide to make it fit on the UNO board.
I then have downloaded the Arduino 0023 extracted the tar and made all necessary adjustements as suggested...

Now I try to compile and build an example (AnalogSerialRead) compilation is OK but avrdude give:
) :
/usr/share/arduino/hardware/tools/avrdude : 1:
/usr/share/arduino/hardware/tools/avrdude : syntax error: "(" unexpected

I have tried to substitute avrdude in the ../tools folders with the one in the /usr/bin/ folder: in this case uploading work but give a mistakes with signature of the board: reading the arduino post the suggestion is to use the avrdude downloaded with the IDE!!

But how if doesnt work?

Thank you for any help!
Paolo

There has been many improvements. So please don't use an outdated version like the 1.0.1.
Use either the 1.0.5 or the new 1.5.7 BETA.
The new 1.5.7 BETA uses a newer avr-gcc version and makes the code size smaller.

My suggestion is to remove everything from the repositories, also remove the java rxtx. Check it twice that all arduino related packages are removed from the repositories. Unpack the 1.5.7 BETA in a new folder and run it from that location. Set your projects folder in the settings and you are ready to go.

You might need some work, updating the sketch. But I think in the end, it will be worth it.

Thank you Peter
for your suggestion! In reality the version I have installed is the 1.0.5 that give a compiled code size about 2 k bigger then the 0023. Most of my sketches dont fit in the UNO board!!
Are you sure that going with the new beta version will reduce the code size enought?
Do you think there is no way to install in parallel the older versions in linux?

Thanks
Paolo

pbecchi:
Thank you Peter
for your suggestion! In reality the version I have installed is the 1.0.5 that give a compiled code size about 2 k bigger then the 0023. Most of my sketches dont fit in the UNO board!!
Are you sure that going with the new beta version will reduce the code size enought?
Do you think there is no way to install in parallel the older versions in linux?

Thanks
Paolo

This is odd!! Do you have the optiboot bootloader installed? I know the older ones use more space and therefore = less space for your sketches.

I generally find the 1.5 have bit smaller code.

Regardless of the above i find that in most cases code optimization works best if done by hand. For example, instead of writing

digitalWrite (x, state); you could use as below:

//digitalWrite (6, LOW)
PORTD &= ~_BV(6);                   //Turn pin 6 low
or 
//digitalWrite (6, HIGH)
PORTD |= _BV(6);                   //Turn pin 6 high

I use the attached image as reference. its for the 168, but same for the 328.

You can save a few bites by using direct port access. This is particularly valid when defining several inputs and outputs and also makes your code significantly faster.

Some libraries have better alternatives, that use less space. “tone”, and “lcd” are just some examples.

Use of the float function should also be avoided at all if possible to do the calculations with integers. This will save you in excess of 3K and faster processing.

The list can go on - I would not compromise on using an older IDE for the sake of some space saved. Instead optimizing your code is a must - don’t just try to load it, perhaps there are more efficient ways of doing it now that there were on older versions.

Atmega168Pinout_Arduino.png

You can install everything in parallel, as long as there is nothing from the repositories.
Unpack each Arduino IDE version in a different folder, and each using your own project folder in the settings.

2k bigger size with 1.0.5 ? That is a lot. I would like to see that.
The 1.5.7 BETA might make it 1k smaller. Shorten a few strings, and it will fit.
Some of us here are very good in making code smaller, when you are willing to share some sketches with us, I'm sure we can squeeze a few bytes out of it.

I use a define for ATmega8 sketches, for example DEBUG

// uncomment define during development
// #define DEBUG

#ifdef DEBUG
  Serial.begin(9600);
  Serial.println(Hello World);
#endif

casemod:

//digitalWrite (6, LOW)

PORTD &= ~_BV(6);                   //Turn pin 6 low
or
//digitalWrite (6, HIGH)
PORTD |= _BV(6);                   //Turn pin 6 high

To casemod, the bitSet and bitClear will generate the single assembly instruction, just as your code does.

//digitalWrite (6, LOW)
bitClear (PORTD, 6);                   //Turn pin 6 low
or 
//digitalWrite (6, HIGH)
bitSet (PORTD, 6);                   //Turn pin 6 high

Thanks to everybody

lets concentrate first on installation problem:
Peter do you think that removing IDE 1.0.5 installed with apt-get install arduino I can solve my problem and install either IDE 0023 and the 1.5 beta?

There is any related software download and installation that I have to do before?
There is any instruction on how to do it?
I am very new to linux and know very little about it:

Regarding sketch size I believe that most of the increase depend on all the libraries(SD, Ethernet, etc.) that I have included. Those libraries are much larger in the 1.05 version .
As soon as I succeed to install both version I will make compilation on both IDE and I will be more precise.

Ciao
Paolo

Install Synaptic
In Synaptic, search for arduino and rxtx, remove everything.

Create a folder in your home folder, like "myPrograms" or "Prog".
Download all the versions of Arduino (well, maybe not all of them) and unpack them in the myPrograms folder. Each should get its own sub-folder.
Go with a terminal into the folder of one of those and run: ./arduino
If it works, you can create a shortcut to the 'arduino' file.

In the Arduino IDE, in the settings, set your project folder to your Arduino project folder. So every version will use the same projects folder.

I can't run version 0023 on my computer, maybe I should install the java rxtx for that. Or maybe I try in Windows.

Hello Peter
I have followed your suggestions downloaded IDE 1.5.7 unpacked and run ./arduino.
This what I get (I use an ARMv7 processor!)
tf101@tf101:~/arduino/arduino-1.5.7$ ./arduino
java.lang.UnsatisfiedLinkError: /home/tf101/arduino/arduino-1.5.7/lib/libastylej.so: /home/tf101/arduino/arduino-1.5.7/lib/libastylej.so: cannot open shared object file: No such file or directory (Possible cause: can’t load IA 32-bit .so on a ARM-bit platform)
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1965)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1890)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1851)
at java.lang.Runtime.load0(Runtime.java:795)
at java.lang.System.load(System.java:1062)
at cc.arduino.packages.formatter.AStyleInterface.(AStyleInterface.java:13)
at cc.arduino.packages.formatter.AStyle.(AStyle.java:22)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at java.lang.Class.newInstance(Class.java:374)
at processing.app.Editor.createToolMenuItem(Editor.java:885)
at processing.app.Editor.addInternalTools(Editor.java:908)
at processing.app.Editor.buildToolsMenu(Editor.java:681)
at processing.app.Editor.buildMenuBar(Editor.java:486)
at processing.app.Editor.(Editor.java:212)
at processing.app.Base.handleOpen(Base.java:935)
at processing.app.Base.handleOpen(Base.java:900)
at processing.app.Base.handleNew(Base.java:803)
at processing.app.Base.(Base.java:459)
at processing.app.Base.main(Base.java:225)
/home/tf101/arduino/arduino-1.5.7/lib/libastylej.so: /home/tf101/arduino/arduino-1.5.7/lib/libastylej.so: cannot open shared object file: No such file or directory (Possible cause: can’t load IA 32-bit .so on a ARM-bit platform)
Cannot load native library /home/tf101/arduino/arduino-1.5.7/lib/libastylej.so
The program has terminated!
tf101@tf101:~/arduino/arduino-1.5.7$
I am lost… can you help me?

Paolo

Peter
I also downloaded and unpacked Arduino022 :
This time tell me that LibrxtxSerial.so is not available: it is part of the java package I have canceled?
Shall I get it again?
I am used to windows XP ,........much easier life!!

Thanks for your help

Paolo

Which linux and which version are you using ? Can you update it ?
The Java you have is not compatible with the new Arduino 1.5.7.

For the older Arduino IDE, you need the java rxtx serial, so you have to install that again.

Do you still have that computer with Windows XP ? You could disable the internet access and use it offline, or install a lightweight but new Linux on it, for example Lubuntu 14.04.

Hey Peter,
my Lubuntu 14.04 is installed on an Armv7 platform: an Asus EEE Pad transformer tf101.
Linux work very well and also Arduino IDE 1.0.5 (the one that I have ininstalled) was very fast and efficient.
In comparaison to windows XP on an old DEll Vostro I was using before, this should be a much more effective solution for my Arduino work (if I succeed on the installation): the battery last ours(almost one day) and I can move and do programming everywhere. The laptop is old full of software and very …very slow.
I will download again java rxtx serial and i will try with IDE 022!
Regarding IDE 1.5.7 I have found in this post an indication on what should be done to install on an armv7 platform: http://forum.arduino.cc/index.php?topic=190163.0
I have to exchange librxtxserial with the one I will download (this make sense)
I do a modification to build.xml adding this line:

It’s worthwhile to try… we will see.
I will keep you informed on results.
Ciao
Paolo

To be honest, I don't understand that link very well :roll_eyes:

In Ubuntu 14.04 I installed the meta package for Java with Synaptic. I forgot the name (I'm in Windows 7 now). That installs not the official Oracle Java but a less demanding version. And installing that meta package was enough to make Arduino 1.5.7 run.

I assume that the Java files are compiled for ARMv7 and should work just as well. Perhaps there is a glitch for the old Arduino versions. You might take a jump into the deep, and drop the older versions and try to make things work with the 1.5.7 version. You have to do that in the end anyway.

The older version IDE 022 doesnt work ....I have again the same error
Binary sketch size: 960 bytes (of a 32256 byte maximum)
/home/tf101/arduino/arduino-0022/hardware/tools/avrdude: 1: /home/tf101/arduino/arduino-0022/hardware/tools/avrdude: Syntax error: "(" unexpected

If I copy avrdude from /usr/bin to /arduino/arduino-0022/hardware/tools then avrdude go on but stop at the point of board signature check.

I am again at the starting point!!

Regarding IDE 1.0.5 it work if I install it from repository! Should I install that first and try unpacking 1.5.7 after?

I believe that most of the difficulties come from the different platform Armv7!!

Paolo

The unpacked Arduino 1.5.7 might have a conflict with the installed version from the repositories. That's why I suggest to remove the version from the repositories and run everything from unpacked folders, even the version 1.0.5 itself.

I have downloaded IDE 1.5.4 and sucessfully installed changing librxtxserial.so in the lib directory.
I have tryed an example but compilation give me "COPY ERROR" with this message:
/home/tf101/arduino/arduino-1.5.4/hardware/tools/g++_arm_none_eabi/bin/arm-none-eabi-g++: 1: /home/tf101/arduino/arduino-1.5.4/hardware/tools/g++_arm_none_eabi/bin/arm-none-eabi-g++: Syntax error: word unexpected (expecting ")")
/home/tf101/arduino/arduino-1.5.4/hardware/tools/g++_arm_none_eabi/bin/arm-none-eabi-g++ returned 2

I am lost again!!

On the IDE022 subject:
I think that the only problem I have is the avrdude executable that is downloaded in the hardware/tools directory.
I have checked with file command that give me:
tf101@tf101:~/arduino/arduino-0022/hardware/tools$ file avrdude
avrdude: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.2.0, not stripped
tf101@tf101:~/arduino/arduino-0022/hardware/tools$

It this telling me that is only compatible with x86 machines?
There is chance of finding the Arm version?

Thanks for any help!!

Paolo

Can anybodielse try to dowload avrdude from old releases prior IDE023 and see if it works on other linux machines?

I first partial solution to the ARDUINO023 or prior avrdude incompatibility with arm processors.
The solution is to use an avrdude binary compiled on arm as available from repository ( eg. the one on the Arduino 1.0.5 toolchain.
Once the good avrdude is installed you have to delete or rename the file avrdude in ..../hardware/tools and replace it with following script:

#!/bin/sh
set -x
avrdude -F $1 $2 $3 $4 $5 $6 $7 $8 $9 $10 $11 $12

The IDE call the script that call avrdude adding the flag -F.
It give you the message of wrong target processor but force the uploading: it may be dangerous if you use different boards, but I have found no other solution.
If somebody can find a better solution .......

Regarding IDE 1.5.x the problem , i guess, is the new c++ compiler :I am afraid again it is not executable in a Armv7 environnement:it is possible to use a g++ arm none eabi from a repository?
CAN ANYONE HELP ME ON THIS?

THANK YOU

Paolo

OK
I succeed on having both Arduino IDE022 and IDE 1.5.4 installed and working in my Armv7 tablet.
I will close this post adding ALMOST solved to the title: both solution are not very elegant and need some testing!!
If somebody want to know any detail....I can spend more time on what I have done.

I will open a new post regarding the size of the code compiling in 1.5.4 and 022.
ThanK you all

Paolo

I grabbed a sketch to test the size. Version 0022 doesn't have the F() macro. So it is not a fair comparison.

Arduino 0022 (running in wine) : 24864 bytes
Arduino 1.0.5 : 26.358 bytes
Arduino 1.5.7 BETA : 25.728 bytes
Arduino 1.5.7 BETA with -flto option : 23.308 bytes
Arduino 1.5.7 BETA with -flto -funsafe-math-optimizations options : 22.920 bytes

That confirms what I was thinking.

The -flto option can be enabled in platform.txt

# These can be overridden in platform.local.txt
compiler.c.extra_flags=-Wextra -flto
compiler.c.elf.extra_flags=-w -flto
compiler.S.extra_flags=
compiler.cpp.extra_flags=-Wextra -flto
compiler.ar.extra_flags=
compiler.objcopy.eep.extra_flags=
compiler.elf2hex.extra_flags=

I did a few more tests with -flto. A large sketch with Ethernet on the Mega was 10% smaller, but a very small sketch for a standalone ATmega8 was 25% smaller. It is almost as if my ATmega8 became a ATmega10 (25% bigger).

Hey Peter

Do you think we should open a new post to discuss about size?
Can I test the -flti flag on arduino 1.5.4 IDE?

Unfortunately I have installed 1.5.4 :it take some time to find equivalent files of the avr-gpp and gpp.arm.none.aepi from repositories .
IDE 1.5.7 has a different files structure ..... it will be difficult to install it!

Ciao
Paolo