#Install the ARM cross compiler toolchain on your Linux PC

<abstract>
This article illustrates how to install on a Linux PC the complete toolchain 
to cross compile the Linux Kernel, device drivers and applications 
for the Acme Systems Linux board. 
</abstract>

This procedure has been tested on Debian "Bookworm" 12.

##Install the Cross Compilers, utilities, etc.

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

<div class="terminal">
	sudo apt update
	sudo apt install libc6-armel-cross libc6-dev-armel-cross binutils-arm-linux-gnueabi libncurses5-dev build-essential bison flex libssl-dev bc
</div>

If you are using an [Acqua](/acqua) or [RoadRunner](/roadrunner) board:

<div class="terminal">
	sudo apt install gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf
</div>

If you are using an [Arietta](/arietta), [Aria](/aria) or [FOX G20 board](/FOXG20):

<div class="terminal">
	sudo apt install gcc-arm-linux-gnueabi g++-arm-linux-gnueabi
</div>

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 by typing, if you are using an [Arietta](/arietta), [Aria](/aria) or [FOX G20 board](/FOXG20):

<div class="terminal">
	arm-linux-gnueabi-gcc hello.c -o hello
</div>

or, if you are using an [Acqua](/acqua) or [RoadRunner](/roadrunner) board:

<div class="terminal">
	arm-linux-gnueabihf-gcc hello.c -o hello
</div>
	
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:

<div class="terminal">
	scp hello root@[your_board_ip]:/root
</div>

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

<div class="terminal">
	~# ./hello
	Hello world !
</div>

## 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, if you are using an [Arietta](/arietta), [Aria](/aria) or [FOX G20 board](/FOXG20):

<div class="terminal">
	arm-linux-gnueabi-g++ hello.cc -o hello
</div>

or, if you are using an [Acqua](/acqua) or [RoadRunner](/roadrunner) board:

<div class="terminal">
	arm-linux-gnueabihf-g++ hello.cc -o hello
</div>

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:

<div class="terminal">
	scp hello root@[your_board_ip]:/root
</div>

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

<div class="terminal">
	~# ./hello
	Hello world !
</div>

@include='adv_main'

