summaryrefslogtreecommitdiff
path: root/src/HW/makerbot/arduino-on-gentoo/document.en.rest.txt
blob: f5ced2fcd8f6dad44ae17bab8e9e2353b025e6a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
=================================================
 Building the Arduino / Sanguino on Gentoo amd64
=================================================
:CreationDate: 2009-09-01 17:27:01
:Id: HW/makerbot/arduino-on-gentoo
:tags: - hardware
       - software
       - 3dPrint
 
Ok, so I had this nice CupCake_ kit. It comes with pre-built
electronics, and pre-installed firmware. But I like being able to do
upgrades, especially since the whole thing is still maturing.
 
So, the `MakerBot instructions`_ say "get the Arduino_ env, apply the
Sanguino_ patch, and you're done". Easy, right?
 
I start by downloading the sources for the Arduino_ software. You see,
I run a 64-bit machine, and the pre-built Linux binaries are 32
bits. Not good enough.
 
Of course, I have to build the cross-compiling tool-chain… easy
enough: crossdev_ has a special target for it::
 
  # crossdev -t avr
 
Only it does not work: ``avr-libc-headers`` requires the compiler to
be already build. I don't go fixing it the proper way, I just follow
the `hint found in a mailing list post`_, and do (after the failed
``crossdev`` run)::
 
  # USE='-nls -fortran -gtk -openmp -mudflap' emerge -v cross-avr/gcc
  # crossdev -t avr
 
and I have a (hopefully) working cross-compiler.
 
Then, following the `Arduino instructions`_, I say::
 
  ~/arduino-src/build/linux$ ./make.sh
 
and it goes::
 
 The Java bundle that is included with Processing supports only i686 by default.
 To build the code, you will need to install the Java 1.5.0_15 JDK (not a JRE,
 and not any other version), and create a symlink to the directory where it is
 installed. Create the symlink in the "work" directory, and named it "java":
 ln -s /path/to/jdk1.5.0_15 /home/dakkar/arduino-src/build/linux/work/java"
 
Ok, I'll do it. By having mis-read the notice, I actually symlink the
``icedtea6`` JDK. It didn't seem to mind.
 
Now it builds, but it won't run: there are 32-bit libraries! Who built
them??
 
Looking at Portage (yes, I run Gentoo) I see that there is an ebuild
for an (older) Arduino version, and it declares dependency on exactly
the library that is giving me problems. So::
 
  emerge -av dev-java/rxtx uisp
 
and I have the right library. Of course the Arduino program won't use
it (it's not in the default ``CLASSPATH``), so I symlink it over the
bundled version::
 
  rm work/lib/RXTXcomm.jar work/lib/librxtxSerial.so
  ln -s /usr/share/rxtx-2/lib/RXTXcomm.jar  work/lib/
  ln -s /usr/lib/rxtx-2/librxtxSerial.so work/lib/
 
It runs!
 
.. warning:: In the official Portage tree, RXTX is at version 2.1.7.2,
   which does not seem to work. We need version 2.2; you can get it
   from `my overlay </cgit/gentoo-overlay/>`_.
 
Of course, no Sanguino_ support, and the CupCake_ main board is a
Sanguino_.
 
The `Sanguino instructions`_ say to add a couple of directories,
overwrite a few files, add some lines to a file, and it should be
enough. Well, not so fast. It didn't work for me.
 
After a bit of ``find``, I see that the ``boards.txt`` file (the one
that needs to have data added to) has been copied from it "source"
location (``/home/dakkar/arduino-src/hardware/boards.txt``) to the
"work" location
(``/home/dakkar/arduino-src/build/linux/work/hardware/boards.txt``). Ok,
I should have read *all* the instructions: it said to rebuild the
Arduino environment every time a change is made.
 
By this point I'm sick and tired of re-doing all the work-arounds, so
I just change the ``make.sh`` script::
 
 ===================================================================
 --- make.sh (revision 756)
 +++ make.sh (working copy)
 @@ -34,25 +34,7 @@
 
    install -m 755 dist/arduino work/arduino
  
 -  ARCH=`uname -m`
 -  if [ $ARCH = "i686" ]
 -  then
 -    echo Extracting JRE...
 -    tar --extract --file=jre.tgz --ungzip --directory=work
 -  else 
 -#    echo This is not my beautiful house.
 -#    if [ $ARCH = "x86_64" ]
 -#    then 
 -#      echo You gots the 64.
 -#    fi
 -    echo "
 -The Java bundle that is included with Processing supports only i686 by default.
 -To build the code, you will need to install the Java 1.5.0_15 JDK (not a JRE,
 -and not any other version), and create a symlink to the directory where it is
 -installed. Create the symlink in the \"work\" directory, and named it \"java\":
 -ln -s /path/to/jdk1.5.0_15 `pwd`/work/java"
 -    exit
 -  fi
 +  ln -s "$(java-config -O)" work/java
  fi
  
  cd ../..
 @@ -91,6 +73,11 @@
  rm -rf ../build/linux/work/classes
  mkdir ../build/linux/work/classes
  
 +rm ../build/linux/work/lib/RXTXcomm.jar
 +rm ../build/linux/work/lib/librxtxSerial.so
 +ln -s /usr/share/rxtx-2/lib/RXTXcomm.jar ../build/linux/work/lib/
 +ln -s /usr/lib/rxtx-2/librxtxSerial.so ../build/linux/work/lib/
 +
  ../build/linux/work/java/bin/java \
      -cp ../build/linux/work/java/lib/tools.jar \
      com.sun.tools.javac.Main \
 
Now::
 
  rm -rf work/
  ./make.sh
  ./run.sh
 
and I have the environment working! Actually working: I used the
results of these instructions to upgrade the firmware of both boards
on the CupCake_, and it worked perfectly.
 
 
.. _CupCake: http://wiki.makerbot.com/cupcake
.. _`MakerBot instructions`: http://wiki.makerbot.com/cupcake-motherboard-firmware-update
.. _crossdev: http://en.gentoo-wiki.com/wiki/Crossdev
.. _`hint found in a mailing list post`: http://www.mail-archive.com/avr-libc-dev@nongnu.org/msg03019.html
.. _Arduino: http://arduino.cc/
.. _`Arduino instructions`: http://code.google.com/p/arduino/wiki/BuildingArduino
.. _Sanguino: http://sanguino.cc/
.. _`Sanguino instructions`: http://sanguino.cc/softwareforlinux