Navigation

    全志在线开发者论坛

    • Register
    • Login
    • Search
    • Categories
    • Tags
    • 在线文档
    • 社区主页

    交叉编译一个打印Hello World的小应用

    V853系列-AI视觉
    1
    1
    137
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Y
      giao LV 5 last edited by yanmingjian

      使用电脑(上位机)交叉编译一个打印 Hello World 的小应用,并将其上传到开发板(下位机)上运行起来,打印出 hello world。

      参考文章地址:https://v853.docs.aw-ol.com/study/study_6helloword/

      在用ADB向开发板push文件的时候遇到了和这位兄弟同样的问题,感谢一下这位兄弟👍 https://bbs.aw-ol.com/topic/2051/

      在交叉编译上遇见了路径略有不同,特做记载:

      1、创建main.c的过程是一样的,建一个文件夹,在文件夹里创建一个main.c文件。

      #include <stdio.h>
      int main(int argc, char const *argv[])
      {
          printf("Hello World\n");
          return 0;
      }
      

      2、叉编译前,你要知道

      交叉编译所使用的交叉编译工具链名叫toolchain-sunxi-musl-gcc-830存放路径

      ~/tina-v853-open/prebuilt/rootfsbuilt/arm/toolchain-sunxi-musl-gcc-830/
      

      3、编译使用的 gcc 编译器路径:

      ~/tina-v853-open/prebuilt/rootfsbuilt/arm/toolchain-sunxi-musl-gcc-830/toolchain/bin/arm-openwrt-linux-gcc
      

      4、光有编译器还不够,还需要提供编译时需要用到的那些库文件,头文件。这些文件存放路径:

      ~/tina-v853-open/prebuilt/rootfsbuilt/arm/toolchain-sunxi-musl-gcc-830/toolchain/arm-openwrt-linux-muslgnueabi
      

      5、开始交叉编译

      首先,指定存放交叉编译需要使用的库文件头文件的文件夹

      export STAGING_DIR=~/tina-v853-open/prebuilt/rootfsbuilt/arm/toolchain-sunxi-musl-gcc-830/toolchain/arm-openwrt-linux-muslgnueabi
      

      6、然后就可以使用交叉编译工具链来编译了,可以看到编译出的 helloworld 可执行文件已经生成了。

      ~/tina-v853-open/prebuilt/rootfsbuilt/arm/toolchain-sunxi-musl-gcc-830/toolchain/bin/arm-openwrt-linux-gcc -o helloworld main.c
      

      pYYBAGMSExKAKI1hAAEZ0f2aVH0527.jpg

      1 Reply Last reply Reply Quote Share 0
      • 1 / 1
      • First post
        Last post

      Copyright © 2022 深圳全志在线有限公司 粤ICP备2021084185号 粤公网安备44030502007680号

      行为准则 | 用户协议 | 隐私权政策