2 Replies Latest reply on Aug 6, 2020 3:45 PM by aswinvenu

    Cross build environment for Raspberry PI (or any Linux SBC) on Windows.

    umeshdeshmukh2024

      I am used to microcontroller code development process. Recently to up my game I am trying to learn programming for raspberry pi.

      Building code on Raspberry Pi is very slow.The problems or questions I am facing are given below.

       

      1. Why is there are different tool chains for baremetal(arm-none-eabi) and linux target (arm-none-linux-gnueabihf)?

      2. How to do cross build for linux device drivers?

      3. If you want to cross build using some libraries for example openCV, how to do it?

        • Re: Cross build environment for Raspberry PI (or any Linux SBC) on Windows.
          John Beetem

          An Embedded Application Binary Interface (EABI) defines the register conventions used for calling library functions and any underlying operating system.  These are things like which registers are used for passing arguments and which registers must not be modified by a function (i.e, which registers must be saved and restored).  ARM itself is very flexible and if you are writing all your own code you can use any conventions you like.  However, if you are calling GNU/Linux library functions like printf(), read(), and write(), you must compile your code to use the same EABI as the libraries you link into your executable.

           

          The "hf" in gnueabihf means that your ARM processor supports hardware floating-point operations so you can use libraries that have hardware floating-point instructions.  You would not want to link such a library to a low-end ARM Cortex M0, for example.

          2 of 2 people found this helpful
          • Re: Cross build environment for Raspberry PI (or any Linux SBC) on Windows.
            aswinvenu

            Hi Umesh,

            Let me answer your question in the same order you asked.

             

            1. Why is there are different tool chains for baremetal(arm-none-eabi) and linux target (arm-none-linux-gnueabihf)?

                      This depends on the architecture of the microprocessor/controller. If you have a relatively simple single core system (like ARM Cortex M series R series ) use arm-none-eabi. If you have a application processor like ARM Cortex A series you need to use arm-none-linux-gnueabihf. This is because most of the application processor run with a kernel and operating system. Breaking down the nomenclature GNU Embedded Application Binary Interface. GNU ABIs are standards. You can read about it online.

            Both these are used when you are not planning to run a linux operating system on the processor.

            To note here there are other versions of gnueabi gcc available called arm-none-linux-gnueabi (old versions of raspberry pis used to have this standard). The difference is HF (Hard Float) version has floating point support on the processor. On gnueabi version floating point support has to be added using software (using the same 32 bit length registers).

             

            2. How to do cross build for linux device drivers?

                I personally haven't cross build linux kernel on Windows PC. But when you corss build the Linux kernel driver you need to use arm-linux-gnueabihf- toolchain. Also you need to select the right target platform.

            The make command will look something like this : make ARCH=arm CROSS_COMPILE=<TOOLCHAIN_DIR>/bin/arm-linux-gnueabihf- oldconfig

             

            3. If you want to cross build using some libraries for example openCV, how to do it?

               Okay here openCV is an application code. So you use the same gcc-arm-linux-gnueabihf for cross compiling it. Try to use a virtual machine and run any Linux operating system on that. Then use that for all you crosscompiling experiments. Setting up windows env will sometimes give you headaches.

             

            I think I answered your questions.

             

            Regards,

            Aswin

            1 of 1 people found this helpful