4 Replies Latest reply on Jun 17, 2016 3:05 PM by Intel Corporation

    Cross Compiling for Galileo Gen 2

    Bart_H

      Hi all,

       

      So I downloaded the BSP 1.2.1 and compiled the default image (Eglibc).
      The image boots up and I can SSH to it without issue, etc.

       

      The problem is that I can't seem to cross compile for it (or I'm doing it wrong).

      I created the cross-compile toolchain in the build directory using: bitbake meta-ide-support

      Then in a new terminal, I ran the environment setup file using: source ./environment-setup-i586-poky-linux

      At this point, I ran a test compile: g++ Test.cpp -o Testprog
      I also compiled this program for the local environment and it works, so the program isn't the issue.

       

      When I send the resulting Testprog to the Galileo via ssh, it won't run, giving the message "cannot execute binary file: Exec format error".
      This is obviously because it isn't compiled for the correct architecture, but what am I doing wrong?

       

      I don't fully understand the instructions on how to use the cross compile toolchain and none of the links I've read have made it much clearer.
      Could someone give me a rough step by step how you'd compile the test program?

       

      Many thanks in advance,

      Bart

        • 1. Re: Cross Compiling for Galileo Gen 2
          FGT

          Hi Bart_H,

           

          Bart_H wrote:

           

          Hi all,

           

          So I downloaded the BSP 1.2.1 and compiled the default image (Eglibc).
          The image boots up and I can SSH to it without issue, etc.

           

          The problem is that I can't seem to cross compile for it (or I'm doing it wrong).

          I created the cross-compile toolchain in the build directory using: bitbake meta-ide-support

          Then in a new terminal, I ran the environment setup file using: source ./environment-setup-i586-poky-linux

          At this point, I ran a test compile: g++ Test.cpp -o Testprog
          I also compiled this program for the local environment and it works, so the program isn't the issue.

           

          When I send the resulting Testprog to the Galileo via ssh, it won't run, giving the message "cannot execute binary file: Exec format error".
          This is obviously because it isn't compiled for the correct architecture, but what am I doing wrong?

           

          I don't fully understand the instructions on how to use the cross compile toolchain and none of the links I've read have made it much clearer.
          Could someone give me a rough step by step how you'd compile the test program?

           

          Many thanks in advance,

          Bart

          BSP-bitbake are meant for making a new yocto image, not for developing applications on it, AFAIK. You would like to use it if you need some driver not included in the default yocto image, or you want some specific behavior in yocto, which is not possible to have in the default image, for example. It is not meant for cross-compiling applications you need to run on yocto, i.e. Galileo proceeses/applications. I don't know about Test.cpp but in either case, you should chose some development environment (IDE or just the yocto console) and develop under your selected way of developing applications. I don't know what Test.cpp has, but if you expect to run that program under Galileo, then copy it to Galileo and directly compile in Galileo.

           

          BTW: I think cross-compiling for Galileo is not a good idea (maybe someone knows better, of course) unless under some IDE just like the Arduino one (or Eclipse, I think, but I do not develop under that Eclipse, so I'm not sure if it really cross-compile).

           

          HTH,

           

          Fernando.

          • 2. Re: Cross Compiling for Galileo Gen 2
            Bart_H

            Hi,

             

            Thanks for the reply FGT.


            I definitely need to cross compile for Galileo, so other options aren't possible.


            The BSP definitely does both (create yocto images and set up the cross compile toolchain)

            This is desribed in section 7 of the BSP user guide: http://www.intel.com/content/dam/www/public/us/en/documents/release-notes/quark-x1000-bsp-build-sw-rel-user-guide.pdf

             

            I have built the environment using bitbake, I just don't understand how it is then used.

             

            Rgrds

            Bart

            1 of 1 people found this helpful
            • 3. Re: Cross Compiling for Galileo Gen 2
              Intel Corporation
              This message was posted on behalf of Intel Corporation

              Hi Bart_H,

              We are still working on your case. As soon as we finish our testing we will provide our results here.

              Regards,
              -Pablo

              • 4. Re: Cross Compiling for Galileo Gen 2
                Intel Corporation
                This message was posted on behalf of Intel Corporation

                Hi Bart,

                Thank you for your patience.
                Could you please confirm that you’re using these steps to build the image?

                1. Download BSP
                2. 7z e Board_Support_Package_Sources_for_Intel_Quark_V1.2.1.7z
                3. tar -xvf meta-quark*.tar.gz
                4. cd meta-quark*
                5. ./setup.sh
                6. source ./oe-init-build-env yocto_build
                7. bitbake meta-ide-support
                8. bitbake image-full -c populate_sdk
                9. iot-devkit-glibc-x86_64-image-full-i586-toolchain-1.7.2.sh
                10. source /opt/iot-devkit/1.7.2/environment-setup-i586-poky-linux

                 

                The issue could also be that when using g++ you’re using the PC’s version and tools instead of using the environment tools. Try using this format:

                ${CXX} myfile.c -o myfile



                Regards,
                -Pablo