3 Replies Latest reply on Oct 25, 2013 2:31 AM by nuke

    ArduinoC to Binary Backend - is there an intermediate stage?

    chesk

      Hi,

       

      Couldn't find the answer to this question.

       

      What happens between the Arduino C (whatever you want to call that language) and the eventual binary that gets created and executed (or interpreted)? Is there intermediate output (C, asm, etc?) Is there anything that dumps the commands so they can be executed through the command line? And so on.

       

      Thanks!

        • 1. Re: ArduinoC to Binary Backend - is there an intermediate stage?
          nuke

          The C++ sketch code you enter into the IDE is saved to a temp area on your computer, combined with the source code that forms the Arduino library, which supplies the main() function and all of the abstractions of the hardware. The combined source is then compiled by a gcc cross-compiler installed on your host computer with the IDE. The binary code is stripped of unused calls to save space, linked with the libraries and prepared as an ELF binary to run as a linux user-space application once transferred to the Galileo board. The lsz tool sends the binary compiled application to the board and a sketch-runner script manages loading and running it.

           

          You can bring up a linux command prompt on the board by connecting a serial terminal to the UART jack on the board. It is also possible to connect by ethernet as well.

          1 of 1 people found this helpful
          • 2. Re: ArduinoC to Binary Backend - is there an intermediate stage?
            chesk

            Hi,

             

            Thanks for your response.

             

            It was almost what I want to know. I now understand more about the intermediate stages. Unfortunately, I think you misunderstood my question about the terminal. I certainly know how to use the galileo terminal; my question was whether I can compile the code from a terminal without using the IDE. The simplest way is if the IDE exposes the commands it runs to compile and link. If it uses gcc, then it's accessible, the question remains if I can find the commands the IDE calls.

             

            Thanks!

            • 3. Re: ArduinoC to Binary Backend - is there an intermediate stage?
              nuke

              There is no compiler in the Linux system on the board.

               

              However, the cross-compilers that the IDE uses are installed on your host computer. You can find them and call them directly from a terminal. They wind up in different places on Linux, Mac OSX and Windows, but you can get to them.