Due + Linux?

Info:

  • Due (made in Italy) purchased from Amazon in USA
  • My System: Fedora 18 64-bit. Apart from the pain-in-the-back nepomuk I don't have any other problem in it.
    And it is up to date.
  • /dev/ttyACM0 gets created as soon as the Due is connected (Pgm Port). Doesn't require IDE to run.
  • Installed IDE 1.5.2 in user mode a few weeks back (Don't think I used yum or Apper S/W Mgmt).
  • Ran into the /run/lock problem. Fixed it with chmod 0777 for now.
  • After this, the IDE always used to grey out the "Tools --> Serial Port" option.

I took following actions trying to fix that...

  • Changed ~/.arduino/preferences.txt to set "serial.port=/dev/ttyACM0" (Line-24)
    Probably is not necessary based on what happened next.

  • Install everything about "ftdi"...

[uden@i4Gpc .arduino]$ rpm -qa | grep ftdi
libftdi-python-0.20-2.fc18.x86_64
libftdi-c++-devel-0.20-2.fc18.x86_64
libftdi-c++-0.20-2.fc18.x86_64
libftdi-devel-0.20-2.fc18.x86_64
libftdi-0.20-2.fc18.x86_64 <--- probably the most important one.
[uden@i4Gpc .arduino]$

  • Add current user uden to uucp group:
    su
    gpasswd -a uden uucp
    Then log out and log back in.

  • Still The IDE doesn't show Serial Port options.

  • Checked this thread about an hour back and someone suggested running in privileged mode.

  • So, I just ran the IDE from terminal with root privilege.

  • The "Tools --> Serial Port" now showed /dev/ttyACM0 as well as another ... ttyUsb0?
    I chose the /dev/ttyACM0.

  • Copied the String Length sketch from examples and tried to compile it.
    Error:
    Cannot run program
    ...software/arduino-1.5.2/hardware/tools/g++_arm_none_eabi/bin/arm-none-eabi-g++

So, my question...

  1. Must it have to be so complex just to get a Hello World type program run the first time?
  2. Obviously running under root is not the right way. What can be done about it?

Thanks.

I have same problem.

No, you do not. Next time please create a new topic. I promise, we are not running out of space for new topics.

You are right. There is no dearth of space here... :slight_smile:

There were 2 problems in my post in order to get started with Due on Fedora-18 64-bit :-

  1. IDE 1.5.2 is unable to find a serial port
  2. IDE 1.5.2 is unable to locate the arm-none-eabi-g++ for compilation.

I found the solution to Problem-1. Here it is...

  • The FTDI related libs are NOT required for Due. It does not use FTDI chip although the AtMega16U2 and FTDI cost about the same!

  • The ~/.arduino/preferences.txt probably should remain the same... it reflects the last IDE setup.

  • Connect to Pgm Port (with or without the IDE started)

  • Linux immediately creates /dev/ttyACM0 :-
    [root@i4Gpc arduino-1.5.2]# dmesg -c
    [root@i4Gpc arduino-1.5.2]# dmesg
    [15153.298013] usb 3-1: new full-speed USB device number 8 using uhci_hcd
    [15153.482271] usb 3-1: New USB device found, idVendor=2341, idProduct=003d
    [15153.482275] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=220
    [15153.482277] usb 3-1: Product: Arduino Due Prog. Port
    [15153.482279] usb 3-1: Manufacturer: Arduino (www.arduino.cc)
    [15153.482281] usb 3-1: SerialNumber: --some number---------
    [15153.485309] cdc_acm 3-1:1.0: ttyACM0: USB ACM device
    [root@i4Gpc arduino-1.5.2]#

  • Type "ls -al /dev/ttyACM0"
    crw-rw----. 1 root dialout 166, 0 Jul 27 10:33 /dev/ttyACM0
    This shows the /dev/ttyACM0 is in "dialout" group.

  • So, add yourself to dialout group:
    su
    gpasswd -a uden dialout
    exit <-- to exit from 'su' mode.
    Then logout and log back in. Note the user id is "uden" here.

  • Make sure "/run/lock" is writable from the user-id (uden) :-
    su
    chmod 0777 /run/lock
    exit

  • Edit the arduino-1.5.2/arduino script... last line where the jvm is invoked :-
    java -Dgnu.io.rxtx.SerialPorts=/dev/ttyACM0 -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel processing.app.Base "$@"

The bold part was added.

This enabled me to get past Problem-1.

I am running out of options on the 2nd problem.

Problem: As soon as I try to compile in IDE (no matter how), it shows the orange status bar with write lettering:
"Cannot run program ...software/arduino-1.5.2/hardware/tools/g++_arm_none_eabi/bin/arm-none-eabi-g++
error=2, No such file or directory"

Tried to execute the g++ directly. Then directory listing and then hexdump of 1st 96 bytes of g++ :-

[uden@i4Gpc bin]$ 
[uden@i4Gpc bin]$ pwd
/home/uden/wProj/software/arduino-1.5.2/hardware/tools/g++_arm_none_eabi/bin
[uden@i4Gpc bin]$ 
[uden@i4Gpc bin]$ ./arm-none-eabi-g++
bash: ./arm-none-eabi-g++: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory
[uden@i4Gpc bin]$ 
[uden@i4Gpc bin]$
[uden@i4Gpc bin]$ l
total 16812
drwxr-xr-x. 2 uden uden    4096 Sep  6  2010 .
drwxr-xr-x. 6 uden uden    4096 Sep  6  2010 ..
-rwxr-xr-x. 1 uden uden  547548 Apr 17  2010 arm-none-eabi-addr2line
-rwxr-xr-x. 2 uden uden  572276 Apr 17  2010 arm-none-eabi-ar
-rwxr-xr-x. 2 uden uden  990396 Apr 17  2010 arm-none-eabi-as
-rwxr-xr-x. 2 uden uden  208112 Apr 17  2010 arm-none-eabi-c++
-rwxr-xr-x. 1 uden uden  547324 Apr 17  2010 arm-none-eabi-c++filt
-rwxr-xr-x. 1 uden uden  207056 Apr 17  2010 arm-none-eabi-cpp
-rwxr-xr-x. 2 uden uden  208112 Apr 17  2010 arm-none-eabi-g++
-rwxr-xr-x. 2 uden uden  205488 Apr 17  2010 arm-none-eabi-gcc
-rwxr-xr-x. 2 uden uden  205488 Apr 17  2010 arm-none-eabi-gcc-4.4.1
-rwxr-xr-x. 1 uden uden   26760 Apr 17  2010 arm-none-eabi-gcov
-rwxr-xr-x. 1 uden uden 3241976 Apr 17  2010 arm-none-eabi-gdb
-rwxr-xr-x. 1 uden uden 3241976 Apr 17  2010 arm-none-eabi-gdbtui
-rwxr-xr-x. 1 uden uden  607136 Apr 17  2010 arm-none-eabi-gprof
-rwxr-xr-x. 2 uden uden  818784 Apr 17  2010 arm-none-eabi-ld
-rwxr-xr-x. 2 uden uden  555612 Apr 17  2010 arm-none-eabi-nm
-rwxr-xr-x. 2 uden uden  703284 Apr 17  2010 arm-none-eabi-objcopy
-rwxr-xr-x. 2 uden uden  836092 Apr 17  2010 arm-none-eabi-objdump
-rwxr-xr-x. 2 uden uden  572308 Apr 17  2010 arm-none-eabi-ranlib
-rwxr-xr-x. 1 uden uden  308040 Apr 17  2010 arm-none-eabi-readelf
-rwxr-xr-x. 1 uden uden  763280 Apr 17  2010 arm-none-eabi-run
-rwxr-xr-x. 1 uden uden  547584 Apr 17  2010 arm-none-eabi-size
-rwxr-xr-x. 1 uden uden  547516 Apr 17  2010 arm-none-eabi-strings
-rwxr-xr-x. 2 uden uden  703284 Apr 17  2010 arm-none-eabi-strip
[uden@i4Gpc bin]$ 
[uden@i4Gpc bin]$ hexdump arm-none-eabi-g++ | less

...  Version: 28 Dec 2012 -- 11:01am
    0000: 7F 45 4C 46. 01 01 01 00. 00 00 00 00. 00 00 00 00  .ELF............
    0010: 02 00 03 00. 01 00 00 00. B0 93 04 08. 34 00 00 00  ............4...
    0020: B8 28 03 00. 00 00 00 00. 34 00 20 00. 08 00 28 00  .(......4. ...(.
    0030: 1B 00 1A 00. 06 00 00 00. 34 00 00 00. 34 80 04 08  ........4...4...
    0040: 34 80 04 08. 00 01 00 00. 00 01 00 00. 05 00 00 00  4...............
    0050: 04 00 00 00. 03 00 00 00. 34 01 00 00. 34 81 04 08  ........4...4...

I am no Java expert and have no clue from what depth of IDE this error-2 is coming from. Could someone help? By the way, I double checked my download of arduino-1.5.2-linux64.tgz before installing.

Thanks.

I dug up some more info about compilation error. It is a tool chain problem in short. I thought the idea of using the Arduino IDE is to avoid this problem in the first place... but I've been proven wrong before. :stuck_out_tongue:

  • Enabled verbose mode in IDE and replicated the command from command line:
[uden@i4Gpc arduino-1.5.2]$ 
[uden@i4Gpc arduino-1.5.2]$ /home/uden/wProj/software/arduino-1.5.2/hardware/tools/
g++_arm_none_eabi/bin/arm-none-eabi-g++ -c -g -Os -w -ffunction-sections -fdata-sections -nostdlib
--param max-inline-insns-single=500 -fno-rtti -fno-exceptions -Dprintf=iprintf -mcpu=cortex-m3
-DF_CPU=84000000L -DARDUINO=152 -D__SAM3X8E__ -mthumb -DUSB_PID=0x003e -DUSB_VID=0x2341 -DUSBCON
-I/home/uden/wProj/software/arduino-1.5.2/hardware/arduino/sam/system/libsam
-I/home/uden/wProj/software/arduino-1.5.2/hardware/arduino/sam/system/CMSIS/CMSIS/Include/
-I/home/uden/wProj/software/arduino-1.5.2/hardware/arduino/sam/system/CMSIS/Device/ATMEL/
-I/home/uden/wProj/software/arduino-1.5.2/hardware/arduino/sam/cores/arduino
-I/home/uden/wProj/software/arduino-1.5.2/hardware/arduino/sam/variants/arduino_due_x
/tmp/build2270187748140068450.tmp/sketch_jul27a.cpp
-o /tmp/build2270187748140068450.tmp/sketch_jul27a.cpp.o
bash: /home/uden/wProj/software/arduino-1.5.2/hardware/tools/g++_arm_none_eabi/bin/arm-none-eabi-g++:
/lib/ld-linux.so.2: bad ELF interpreter: No such file or directory
[uden@i4Gpc arduino-1.5.2]$ 
[uden@i4Gpc arduino-1.5.2]$
  • The IDE is looking for 32-bit 'ld' program in my 64-bit Fedora-18! I did "yum install glibc.i686" to get it.
[uden@i4Gpc /]$ rpm -qa | grep glibc
glibc-2.16-33.fc18.x86_64
glibc-headers-2.16-33.fc18.x86_64
glibc-common-2.16-33.fc18.x86_64
glibc-devel-2.16-33.fc18.x86_64
glibc-2.16-33.fc18.i686                        <--------------  Newly installed.
[uden@i4Gpc /]$
  • Next, tried that string length sketch again. The "Verify/Compile" now goes through! It says "Binary sketch size: 14,712 bytes (of a 524,288 byte maximum) - 2% used"

  • Next, tried File--> Upload. Looks like it compiled again, set the baud rate to 1200 (to reset target) and then quickly ended up with error. The "L" LED that had been blinking yellow till now, has turned solid yellow.

Forcing reset using 1200bps open/close on port /dev/ttyACM0
/home/uden/wProj/software/arduino-1.5.2/hardware/tools/bossac --port=ttyACM0
-U false -e -w -v -b /tmp/build5876139302163828486.tmp/sketch_jul27a.cpp.bin -R 
/home/uden/wProj/software/arduino-1.5.2/hardware/tools/bossac: error while loading shared
libraries: libstdc++.so.6: cannot open shared object file: No such file or directory
  • Look for that 32-bit libstdc++.so in /usr/lib. It's there, create sym link to it.
[root@i4Gpc /]# 
[root@i4Gpc /]# cd usr/lib
[root@i4Gpc lib]# 
[root@i4Gpc lib]# find . -name libstdc++.so*
./gcc/x86_64-redhat-linux/4.7.2/libstdc++.so
./gcc/x86_64-redhat-linux/4.7.2/32/libstdc++.so
[root@i4Gpc lib]# 
[root@i4Gpc lib]# ln -s ./gcc/x86_64-redhat-linux/4.7.2/32/libstdc++.so libstdc++.so.6
[root@i4Gpc lib]# 
[root@i4Gpc lib]# l
total 3992
dr-xr-xr-x. 41 root root    4096 Jul 27 18:25 .
lrwxrwxrwx.  1 root root      47 Jul 27 18:25 libstdc++.so.6 -> ./gcc/x86_64-redhat-linux/4.7.2/32/libstdc++.so
drwxr-xr-x.  2 root root   12288 Jul 27 18:00 gconv
drwxr-xr-x.  2 root root    4096 Jul 27 18:00 audit
...
...
[root@i4Gpc lib]#
  • Try File-->Upload. But this fails again with the same error. Maybe I chose the wrong library in sym link.

So, anyone willing to shed some light on this?
Or am I the first person trying to run it on Fedora-18 64-bit? :relaxed:

Finally, after 24-hours of struggling with it, I was able to run the string length sketch on the DUE :slight_smile:

The library that was missing in my PC was "libstdc++.i686". This is again a 32-bit lib. Once I installed it, the IDE and Due worked as they should.

So, here is my final installation advise (that I was looking for last 24-hours):-

Arduino 1.5.2 Install Instructions on Fedora-18, 64-bit to run just the Due board (As of Jul 2013)

  1. Unzip the archive; preserve folder structure. The excutible is arduino-1.5.2/arduino.
    You can execute it from any folder. I tested it and it works.

  2. Before running the excutible make sure of following. Assume you are user 'uden'.

  • Make sure /run/lock is writable from your user id. /run/lock is created on boot by
    /usr/lib/tmpfiles.d/legacy.conf (both on systemd and initscripts).
    So if you want to keep the permissions you set, simply copy the file
    /usr/lib/tmpfiles.d/legacy.conf to /etc/tmpfiles.d/ and edit it there (set 0777 permissions).
    (This verbage is from a web page of Arduino installation -- can't recall which one).

  • Note what /dev/ttyXYZ gets created when you connect the card by its pgm port. Then use
    "ls -al /dev/ttyXYZ" to know the group name. Add 'uden' to that group!
    Adding 'uden' to 'dialout' group: gpasswd -a uden dialout

  • After you add yourself to any group, you have to log out and log back in.

  • Might change the original java invocation (last line in the executible arduino-1.5.2/arduino).
    You MAY need to pass the '/dev/ttyXYZ' information to java in the last line in the executible
    arduino-1.5.2/arduino. If you don't you can get an extra option in Serial Ports: /dev/ttyS0.
    I passed the '/dev/ttyXYZ' info to java and got just the 'dev/ttyACM0' option in Serial Ports.
    I tested the IDE both ways: modifying the java invocation and without it. Both worked fine.

  • The RXTX in 1.5.2 IDE is RXTX-2.1-7 which is the latest. So, it should not be a problem.

  • If running Due board, then you don't need any FTDI library. Else you may have to. And most
    probably it will be the 64-bit version because you are on 64-bit platform.

  • On 64-bit platforms, the IDE compilation process will still look for 32-bit libs! It is
    because you are building for a target that has 32-bit architecture. So, you need to add
    two GCC libs:-
    yum install glibc.i686
    yum install libstdc++.i686

  1. At this stage you should be able to compile and upload to the Due board.