Hello World!

In order to run native C or C++ programs, is is necessary to have a MicroSD card (e.g. 2GB). This section shows how to compile and run the following “Hello World” program:

#include <stdio.h>
int main()
printf("Hello World!\n");
return 0;

I have provided instructions for Linux and Mac and Windows users.

Linux and Mac Users
Use your favorite editor to create a “hello.c” program with the code shown above. On a Linux terminal, compile the program using the following command line:
arm-none-linux-gnueabi-gcc hello.c -o hello

Before testing the program it is necessary to establish a network connection. Users using the standard LEGO firmware, make sure to run the program dropbear (ssh-server) is running in the EV3 brick. In the Linux terminal use the scp command in Linux to copy the executable program “hello” in the EV3 brick. This can only be done in the directory corresponding to the MicroSD card:

scp hello root@

Once the program has been copied in the card, use the telnet application to login the EV3 brick. For example:

Alternatively, since dropbear is already running, you could use ssh to log in. For example:
ssh root@

You should now be logged in the EV3 brick. Move to the directory containing the hello program inside the MicroSD card using:
cd /media/card/

Finally run the program:

This should show a “Hello World!” message on the screen:

Windows Users
I recommend verifying that the cross-compiler and the Linux tools are properly installed. Use a text editor (i.e. Notepad) to create a “hello.c” program containing the code shown above and save it in a work directory (i.e. Desktop). Open a Command window:
Move to the directory containing the “hello.c” file:
cd Desktop

Compile the code:
arm-none-linux-gnueabi-gcc hello.c -o hello

Make sure that the ssh server (dropbear) is running and use PSCP to transfer the hello program to the EV3 brick. For example:
pscp -scp hello root@

Telnet or ssh into the EV3 brick using PuTTy, and move to the microSD directory:
cd /media/card/

Finally run the program:


Linux and Windows users can copy the binary program “hello” in the MicroSD card using a MicroSD adapter or reader. Removing the SD card could be challengig. is not simple, but can be helped as shown here.

Prev << Setup WiFi
Next >> Interact with the Hardware