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. Make sure 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
Before starting using Bricxcc, 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:


Bricxcc Users
The following instructions may be outdated, and are added for completeness purposed only.
Even thought it is possible to create, compile, transfer and run programs using the tools shown so far. Most people will find more convenient to use an Integrated Development Environment (IDE). The following steps will show how to use it the Bricxcc IDE (test version):

Create a new new file with the code shown above and save it with the name “hello.c”

Compile the program files using [F5]. This will create an executable file with the name hello. Copy the executable file in the EV3 Brick using [F6]. You can now telnet in the EV3 Brick using Putty. After logging in, move to the microSD directory:

cd /media/card/

By default, the Bricxcc version that I tested places the files in ram memory, under the /mnt/ramdisk/prjs directory. Once you log in the EV3 brick, you can copy or move the file to a permanent location in the microSD card. At the moment, changing the default “Remote path” directory under the Edit/Preferences/Compiler/EV3 has no effect. Use.
cp /mnt/rmadisk/prjs/hello .

Finally run the program:

The following screenshot shows all this process.

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

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