简单的hello应用实例

简单的hello应用实例

说明一个简单的hello world程序在BlackFin 系列的开发板上运行。

代码“hello.c”

#include <stdio.h>

Int main()

{

Printf("hello, world\n");

Return 0;

}

编译应用程序:

BlackFin gcc的工具链有三个类别:

1.bfin-elf-*

2.bfin-linux-uclibc-*

3.bfin-uclinux-*

bfin-uclinux-gcc and bfin-linux-uclibc-gcc are used to compile programs that run on the Linux operating system. They automatically link the application with the the Linux run time libraries, which in turn call the Linux operating system when required (for example, to print a string to the console).

The bfin-elf-gcc compiler is used to compile the Linux kernel and standalone programs as it uses a different set of libraries.

bfin-uclinux-gcc -Wl,-elf2flt hello.c -o hello

bfin-linux-uclibc-gcc hello.c -o hello

bfin-linux-uclibc-strip hello

下载到卡法板上:

1.包含在uclinux-dist image 里

On the host:

host:~/checkouts/uClinux-dist> cp ~/test/hello ./romfs/bin/hello

host:~/checkouts/uClinux-dist> make image

网络下载:

------------------------------------------------------------------------------

使用tftp:

在主机上:host> cp hello /tftpboot/hello

在开发板上:root> tftp -g -r hello 192.168.0.1

在开发板上更改文件权限:root:/tmp> chmod 777 hello

可以在window下建立tftp服务器。

==================================================

使用rcp:

From the host, remote copy the file to the board:

host:> rcp ./hello root@192.168.0.1:/hello

使用串口:

If lrz (receive z-modem) is built into uClinux-dist, you can use this to transfer files from the PC to the board.

After 'hello' has been transferred, modify the permissions:

root:/tmp> chmod 777 hello

(0)

相关推荐