注意

这是最新开发分支的文档,可能包含尚未在发布版本中提供的功能。如果您在寻找特定版本的文档,请使用左侧的下拉菜单选择。

k230_linux_sdk开发helloworld

k230_linux_sdk开发helloworld#

编译第一个程序hello world#

创建内容如下的hello.c文件

//hello.c 文件内容
#include <stdio.h>
int main()
{
    printf("Hello, World!\n");
    return 0;
}

编译程序

/opt/toolchain/Xuantie-900-gcc-linux-6.6.0-glibc-x86_64-V3.0.2/bin/riscv64-unknown-linux-gnu-gcc hello.c  -o hello

把hello文件复制到开发板上,并执行,可以看到打印正确

[root@canaan ~ ]#./hello
Hello, World!
[root@canaan ~ ]#

可以通过 rz或 scp或 adb shell或 mtp 复制elf文件到开发板上

评论列表
条评论
登录