Hello, World

1 Souce Code and compile it

Creat hello.c file on /tmp folder, then content is as follow:

int main(void) {  
printf("hello, FriendlyARM!\n");  

The source code of “Hello,World” is under “/opt/FriendlyARM/xxxxxx/examples/hello”.  

Then run the follow command to compile it:

#cd /tmp/  
#arm-linux-gcc hello.c  –o  hello 

A “hello” executable will be generated and you can check whether it is for ARM by commanding “file”: 

# file hello
hello: ELF 32 -bit LSB executable, ARM, version 1 (SYSV), dynamically linked   
(uses shared libs), for GNU/Linux 2.6.14, not stripped  

2 Download the "hello" to the board and run it

You can download your executable to the board in any of the following ways:  

  • Copy to a media (such as flash drives) 
  • FTP file transfer (recommended) 
  • File transfer via serial port  

(1) Copy to Flash Drive 

Note: copy your executable to a flash drive, mount it to your board and copy the file to “/bin”  

1. Copy to Flash Drive 
Connect your flash drive to your PC and execute the following commands 

#mount /dev/sda1 /mnt ; mount your drive  
#cp hello /mnt ; copy your file to the drive  
#umount /mnt ; unmount your drive  

2. Copy to Board  
Insert your drive to your board’s USB host it will be automatically mounted under   
“/udisk”. Please execute the following command  

#cd /udisk  
#./hello ;execute “hello” 

Note: if you take out your drive directly you need to go back to the root directory and execute “umount /udisk” for the next mount 

(2) FTP File Transfer   
Note: login your board via FTP, transfer your executable to it and change its file property to executable 
First, execute your commands in PC 

Go to your board and execute the following commands: 

Then run the follow command to run it:

#cd /home/plg/  
#./hello ;execute “hello” 

3. Download the program by Serial port

Please see the chapter Transfer files by serial

  Tel: +86-755-29638421  |    Sales Email: market@armdevs.com |  Support Email: support@armdevs.com | Gtalk: armdevs@gmail.com  
www.armbest.com | Copyright @2013 - CoreWind Technology Co.,Limited
customer service software technical support
Live Chat by Comm100