6 Replies Latest reply on Jan 26, 2014 5:24 PM by rmm200

    getting started: programming options


      What are the options for compiling code? e.g. a simple helloworld.c application, does that have to be built using the Arduino IDE, or is there a cc/gcc cross-compile option? (Note I'm using the Linux SD boot image).

        • 1. Re: getting started: programming options

          Hi Heliguy,


          I think you would have to use the Board Support Package. Take a look at section 6 on the Intel Quark BSP Build Guide.





          • 2. Re: getting started: programming options
            Clayton Hofrock

            I am not sure what you are asking, but I will try to answer.


            The Arduino IDE compiles sketches (Arduinos name for their programs). While Arduino is a C based language, it has several things which are unique to Arduino. So, I don't think you could take a helloworld.c file and compile it in the Arduino IDE.


            There are helloworld type sketches where you can print a simple text message via the serial console. If you connect up an LCD (Liquid Crystal Display)  you can also print text to the LCD Arduino - LiquidCrystal . Or if you want to connect a TFT you could paint a more graphical Hello World message Arduino - GTFT


            If you are asking about a first program to run, I would suggest the Blink example (in the Arduino IDE File -> Examples -> 01. Basic -> Blink) This does not print anything, but instead it turns an LED on and off. Specifically an LED connected to digital pin 13, which on the Galileo already exists on the board. The Arduino is mostly used for controlling things, and turning something on and off is a great place to start.


            If you want to run an actual program in Linux, you can do that too. You will want to connect up a Linux console. There are various methods for doing that, and they are described here: Re: Connecting to Galileo via Linux Console . Once you have access to the console, you can do anything (just about) that you would do with any other Linux machine including compiling code. Although, since vi is the only text editor, developing code on the Galileo might be difficult.

            • 3. Re: getting started: programming options

              There is no compiler in the SD image Intel provides. You would need to build your own image from the BSP files. Include an editor you like. See Sergey's blog.

              1 of 1 people found this helpful
              • 4. Re: getting started: programming options

                I tried building a simple helloworld program using Ubuntu:


                #include "stdio.h"

                main(){printf("hello world\n");}


                using command line:


                gcc -march=i386 -m32 -o hello hello.c


                when I copy this over, it says:


                root@clanton:~# ./hello

                -sh: ./hello: No such file or directory


                At least this is different if I don't use the march=i386 and m32 flags where it complains its an incompatible executable.


                Is there something extra I need to get to work, or is the only way to build everything in the BSP?




                • 5. Re: getting started: programming options

                  Hi Nick,


                  Generally you'd be better off generating the cross-compilation toolchain rather than using your host's GCC for anything more serious than "hello world" type of an application - because of all the correct compilation and linking settings and libraries it would use. Intel_JEspinoza gave a good pointer earlier in this thread. The generation is quite simple (but long, that's true) and feel free to start another thread if you face problems - I've went through that one and may be able to help.


                  However in this particular case it looks simply like the shell doesn't see it as a executable, i.e. nothing related to the compilation itself. Try running "chmod a+x hello && ./hello" - is the result any different?


                  UPDATE: I think that's caused by the GCC from your host system, which generates wrong binary. That "doesn't exist" error seems to be thrown by Linux dynamic loader, I've faced the same situation today, just in the reverse direction - the "ldd" utility throws this error on the "big brother" Linux when run on the binary cross-compiled for Galileo. So the best way of action for you is probably just to build the cross toolchain and use it for everythin, including "hello world"

                  • 6. Re: getting started: programming options

                    Let me just add - the Galileo is a very capable platform. I have built very large packages, including Ruby 2.0.0, and they compile at least as fast as my Ubuntu virtual machine does.

                    Compiling things like c++ homework problems is pretty much instantaneous. And they all load and run correctly!

                    That "chmod a+x" is often required if the linker does not set executable.

                    1 of 1 people found this helpful