Write your first C program

Step 1: Find a suitable text editor that suits you eg: Atom, Sublime text, vim, notepad ++, etc..

Step2: Write a small C code on your HOST PC and save it with a .c extension(eg: first.c). You can try our example code given below:

#include <stdio.h>
int main()
{
	printf("Hello board!!");
	return 0;
}

Step 3: Open your terminal (ctrl + alt + T), navigate to the Toolchain folder and enable the toolchain by running the env.sh file.

Step 4: Make sure the the toolchain is running on your PC by typing "arm" and hitting the <TAB> key twice.

Screenshot() to be added

NOTE: Do not close your terminal as it will disable the toolchain that is running. For any further execution of C program, use the current terminal itself and make sure your toolchain is enabled before executing the program.

Step 5: Navigate back to your C folder and compile the C code using the toolchain enabled terminal. arm-linux-gnueabi-gcc first.c -o first

Step 6: Open a Terminal on the board, Transfer the compiled binary "first" to the board either by TFTP or by SD Card. (Click here to follow the process to transfer files from Host to Board)

Step 7: Give the necessary permissions chmod +x first

Step 8: Run the binary using ./first

Last updated