1

I'm looking for materials or links about cross-compiling, like eabi, etc. I'm new to Linux-based cross-compiling, and I want to develop my knowledge.

4

From Install the ARM cross compiler toolchain on Ubuntu:

How to install on Ubuntu the complete toolchain to cross compile the Linux Kernel, the Linux device drivers, the Linux applications and the boot loader like as AT91Bootstrap and its derivatives like AcmeBoot and AriaBoot.

This procedure has been tested on Linux Ubuntu 16.04.

Install the Cross Compilers, utilities, etc.

Install the GCC, G++ cross compilers and support programs by typing:

sudo apt-get install libc6-armel-cross libc6-dev-armel-cross
sudo apt-get install binutils-arm-linux-gnueabi
sudo apt-get install libncurses5-dev

If you are using an Arietta, Aria or FOX G20 board:

sudo apt-get install gcc-arm-linux-gnueabi
sudo apt-get install g++-arm-linux-gnueabi

If you are using an Acqua or RoadRunner board:

sudo apt-get install gcc-arm-linux-gnueabihf
sudo apt-get install g++-arm-linux-gnueabihf

Now you are ready to cross compile on your PC all the source available for the Acme Boards based on Microchip MPUs.

Try the cross C compiler

Let's try to cross compile a Hello World example in C and running it on an Acme board.

This is the example:

#include "stdio.h"

int main(void) {
  printf("Hello world!\n");
  return 0;
}

Compile it typing:

arm-linux-gnueabi-gcc hello.c -o hello

As you can see we are using the ARM version of gcc just installed on your PC. It will generate an executable file for your Linux board.

Copy the executable file on the board via ssh:

scp hello root@[your_board_ip]:/root

Then open a command session on your board and run the example:

./hello
Hello world!

Try the cross C++ compiler

Let's try to cross compile a Hello World example in C++ and running it on an Acme board.

This is the example:

#include "iostream"

using namespace std;

int main(int argc, char *argv[]) {
    cout << "Hello world!" << endl;
    return 0;
}

Compile it typing:

arm-linux-gnueabi-g++ hello.cc -o hello

As you can see we are using the ARM version of gcc just installed on your PC. It will generate an executable file for your Linux board.

Copy the executable file on the board via ssh:

scp hello root@[your_board_ip]:/root

Then open a command session on your board and run the example:

./hello
Hello world!

All of the packages in this tutorial are also in the default Ubuntu 14.04 repositories.

Links specific to nRF51, LM35 and Arduino

  • could you please provideme some more specific l – subbu Aug 18 '17 at 12:06
  • like interfacing a sensor with the microcontroller please – subbu Aug 18 '17 at 12:07
  • What are the sensor and microcontroller models, so that I can check the platform being targetted (e.g. ARM)? – karel Aug 18 '17 at 12:08
  • 1
    yes microcontroller like nrf51 and sensor lm35 – subbu Aug 18 '17 at 12:15
  • nrf51 is a ARm cortex M0 with BLE – subbu Aug 18 '17 at 12:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.