5 Replies Latest reply on May 9, 2014 2:59 PM by Liam

    OpenCV, Arduino IDE and Linux LSB




      I have some Galileos which I am planning to use with a group of kids for some software/hardware exploring.

      Some of the kids are familiar with Raspberry Pi (and so basic Linux/Python) and some with Arduino.


      I would like to have the Arduino kids use the standard IDE and run sketches. We want to do some image (opencv) stuff, capture webcam pictures, that sort of thing.


      So getting the basics up and running (networking, wifi, arduino ide) with the distributed 0.7.5 pre-built images is very easy.

      However OpenCV doesn't work with that image: apparently it does in the LSB image according to Sergey's blog.


      While building the LSB image and cross-compiler chain  (still chugging away there on an amazon ec2 instance), I came across various mentions in the forums hinting that a board booted with the LSB image won't have a USB COM port: is that right? In that case the Arduino IDE won't directly talk to it.


      Is there a way to compile and run Arduino sketches on an LSB image?

        • 1. Re: OpenCV, Arduino IDE and Linux LSB

          Hi Liam,


          I have found a couple of discussions where some users provided very useful information about running sketches from Linux and some recommendations to use OpenCV projects with the Galileo, please verify the following information:


          Linux and OpenCV with the Galileo, running sketches from Linux

          Questions about Linux and OpenCV on galileo board


          A webcam project with the Galileo and OpenCV information.

          Re: OpenCV projects ?



          • 2. Re: OpenCV, Arduino IDE and Linux LSB

            Hey LDiego


            thanks for the answer.


            So let me elaborate a bit about my issue.


            The standard (SD card) 0.7.5 image distributed by Intel boots and let's me setup wireless and so on, and it talks to the Arduino IDE also distributed by Intel. However there is a problem with it: opencv, which is part of that LInux image, does not work. If you try to import the opencv library into Python, it crashes.


            So I thought this would not be a big deal: since Sergy's blog says that OpenCV works if you rebuild the Linux Standard Base (LSB) image using the yocto toolchain.


            I did this, and this rebuilt image works and boots, and I can now do "import cv" in a python script and this works, which I am taking as a good sign.


            I know that this LSB image uses eglibc, and I further found out thanks to this post: [Tutorial] Setting up Arduino IDE for linux images based on eglibc and using the yocto build system to rebuild the cross-compiler toolchain for x64 how to setup an Arduino IDE which will build sketches using eglibc. So far to nice.


            However it turns out, for reasons which I have not discovered yet and cannot find in the forums, that the USB port is not working on the LSB image. (no /dev/ttyGS0), therefore I do not know if it is possible to run sketches compiled with the Arduino IDE on the Galileo


            I suppose I could file the .elf file in /tmp/buildyXXXXX.tmp/sketchname.elf, transfer that to the Galileo, and run that ... I guess that might work. But it is late now, and I don't have the energy to try it now.


            Am I on the right lines here?

            • 3. Re: OpenCV, Arduino IDE and Linux LSB

              Hello Liam,


              I believe you are in the right track, I have seen other users loading the sketches into the shell.  I will try to get more information about the USB port behavior in the meantime please verify this discussion, https://communities.intel.com/message/223241#223241 , it will give you useful recommendations if you want to run the sketches in Linux,  If I find more information I will post it in this discussion.




              • 4. Re: OpenCV, Arduino IDE and Linux LSB

                OK, I can kind of make this work, but only by manually copying sketches to /sketch/sketch.elf and rebooting the board.


                I am having some trouble communicating with clloader ... will post a different question about this, since following Sergey's blog to the letter and making his "SDK" image indeed removes a bunch of useful stuff from the image (like the GS0 serial port, or cllloader for instance ...)


                clanton-full is *almost* working. Apart from the clloader issues. I will post a question on that separately.

                • 5. Re: OpenCV, Arduino IDE and Linux LSB

                  For completeness:


                  This thread: clloader in a Linux Base Image (clanton-full) build not working? contains a description from Matthias on how to build a working cross compiler toolchain for Windows, for an eglibc image.


                  It works, although there are some glitches in the build environment (see the above thread).


                  But it works ...