【EASY EAI Nano开源套件试用体验】Ubuntu 20.04下的开发环境搭建和第一个交叉编译程序执行-开源EDA

本文来源电子发烧友社区,作者:大菠萝Alpha, 帖子地址:https://bbs.elecfans.com/jishu_2309329_1_1.html

因为一直用Ubuntu 20.04环境,没有使用官方的VMWARE镜像搭建环境,所以直接开贴来一篇。 一、开发环境准备

(一)操作系统

使用的是Ubuntu 20.04。

复制root@EliteDesk:/$ uname -a Linux EliteDesk 5.15.048-generic #54~20.04.1-Ubuntu SMP Thu Sep 1 16:17:26 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

(二)Cmake

执行复制sudo apt install cmake命令安装cmake。

复制root@EliteDesk:/$ sudo apt install cmake [sudo] password for root: Reading package lists… Done Building dependency tree Reading state information… Done The following package was automatically installed and is no longer required: libfwupdplugin1 Use sudo apt autoremove to remove it. The following additional packages will be installed: cmake-data libjsoncpp1 librhash0 Suggested packages: cmake-doc ninja-build The following NEW packages will be installed: cmake cmake-data libjsoncpp1 librhash0 0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded. Need to get 5,470 kB of archives. After this operation, 28.3 MB of additional disk space will be used. Do you want to continue? [Y/n] y Get:1 http://mirrors.aliyun.com/ubuntu focal/main amd64 cmake-data all 3.16.3-1ubuntu1 [1,612 kB] Get:2 http://mirrors.aliyun.com/ubuntu focal/main amd64 libjsoncpp1 amd64 1.7.4-3.1ubuntu2 [75.6 kB] Get:3 http://mirrors.aliyun.com/ubuntu focal/main amd64 librhash0 amd64 1.3.9-1 [113 kB] Get:4 http://mirrors.aliyun.com/ubuntu focal/main amd64 cmake amd64 3.16.3-1ubuntu1 [3,669 kB] Fetched 5,470 kB in 4s (1,397 kB/s) Selecting previously unselected package cmake-data. (Reading database … 221845 files and directories currently installed.) Preparing to unpack …/cmake-data_3.16.3-1ubuntu1_all.deb … Unpacking cmake-data (3.16.3-1ubuntu1) … Selecting previously unselected package libjsoncpp1:amd64. Preparing to unpack …/libjsoncpp1_1.7.43.1ubuntu2_amd64.deb … Unpacking libjsoncpp1:amd64 (1.7.43.1ubuntu2) … Selecting previously unselected package librhash0:amd64. Preparing to unpack …/librhash0_1.3.9-1_amd64.deb … Unpacking librhash0:amd64 (1.3.91) … Selecting previously unselected package cmake. Preparing to unpack …/cmake_3.16.3-1ubuntu1_amd64.deb … Unpacking cmake (3.16.3-1ubuntu1) … Setting up librhash0:amd64 (1.3.91) … Setting up cmake-data (3.16.3-1ubuntu1) … Setting up libjsoncpp1:amd64 (1.7.43.1ubuntu2) … Setting up cmake (3.16.3-1ubuntu1) … Processing triggers for man-db (2.9.11) … Processing triggers for libc-bin (2.31-0ubuntu9.9) …

二、安装交叉编译工具链

直接使用官方下载的rv1126_rv1109_compiler_20220715_175105.tar.gz 文件,执行复制sudo tar xvf rv1126_rv1109_compiler_20220715_175105.tar.gz -C /

千万记得加上sudo,不要问为什么。 复制root@EliteDesk:/$ sudo tar xvf rv1126_rv1109_compiler_20220715_175105.tar.gz -C / [sudo] password for root: opt/rv1126_rv1109_sdk/prebuilts/gcc/linux-x86/arm/gcc-arm-8.32019.03-x86_64-arm-linux-gnueabihf/ opt/rv1126_rv1109_sdk/prebuilts/gcc/linux-x86/arm/gcc-arm-8.32019.03-x86_64-arm-linux-gnueabihf/libexec/ opt/rv1126_rv1109_sdk/prebuilts/gcc/linux-x86/arm/gcc-arm-8.32019.03-x86_64-arm-linux-gnueabihf/libexec/gcc/ opt/rv1126_rv1109_sdk/prebuilts/gcc/linux-x86/arm/gcc-arm-8.32019.03-x86_64-arm-linux-gnueabihf/libexec/gcc/arm-linux-gnueabihf/ opt/rv1126_rv1109_sdk/prebuilts/gcc/linux-x86/arm/gcc-arm-8.32019.03-x86_64-arm-linux-gnueabihf/libexec/gcc/arm-linux-gnueabihf/8.3.0/ opt/rv1126_rv1109_sdk/prebuilts/gcc/linux-x86/arm/gcc-arm-8.32019.03-x86_64-arm-linux-gnueabihf/libexec/gcc/arm-linux-gnueabihf/8.3.0/cc1plus opt/rv1126_rv1109_sdk/prebuilts/gcc/linux-x86/arm/gcc-arm-8.32019.03-x86_64-arm-linux-gnueabihf/libexec/gcc/arm-linux-gnueabihf/8.3.0/collect2 opt/rv1126_rv1109_sdk/prebuilts/gcc/linux-x86/arm/gcc-arm-8.32019.03-x86_64-arm-linux-gnueabihf/libexec/gcc/arm-linux-gnueabihf/8.3.0/liblto_plugin.so.0.0.0 opt/rv1126_rv1109_sdk/prebuilts/gcc/linux-x86/arm/gcc-arm-8.32019.03-x86_64-arm-linux-gnueabihf/libexec/gcc/arm-linux-gnueabihf/8.3.0/install-tools/ opt/rv1126_rv1109_sdk/prebuilts/gcc/linux-x86/arm/gcc-arm-8.32019.03-x86_64-arm-linux-gnueabihf/libexec/gcc/arm-linux-gnueabihf/8.3.0/install-tools/mkinstalldirs opt/rv1126_rv1109_sdk/prebuilts/gcc/linux-x86/arm/gcc-arm-8.32019.03-x86_64-arm-linux-gnueabihf/libexec/gcc/arm-linux-gnueabihf/8.3.0/install-tools/fixincl opt/rv1126_rv1109_sdk/prebuilts/gcc/linux-x86/arm/gcc-arm-8.32019.03-x86_64-arm-linux-gnueabihf/libexec/gcc/arm-linux-gnueabihf/8.3.0/install-tools/mkheaders opt/rv1126_rv1109_sdk/prebuilts/gcc/linux-x86/arm/gcc-arm-8.32019.03-x86_64-arm-linux-gnueabihf/libexec/gcc/arm-linux-gnueabihf/8.3.0/install-tools/fixinc.sh opt/rv1126_rv1109_sdk/prebuilts/gcc/linux-x86/arm/gcc-arm-8.32019.03-x86_64-arm-linux-gnueabihf/libexec/gcc/arm-linux-gnueabihf/8.3.0/f951 opt/rv1126_rv1109_sdk/prebuilts/gcc/linux-x86/arm/gcc-arm-8.32019.03-x86_64-arm-linux-gnueabihf/libexec/gcc/arm-linux-gnueabihf/8.3.0/plugin/ opt/rv1126_rv1109_sdk/prebuilts/gcc/linux-x86/arm/gcc-arm-8.32019.03-x86_64-arm-linux-gnueabihf/libexec/gcc/arm-linux-gnueabihf/8.3.0/plugin/gengtype opt/rv1126_rv1109_sdk/prebuilts/gcc/linux-x86/arm/gcc-arm-8.32019.03-x86_64-arm-linux-gnueabihf/libexec/gcc/arm-linux-gnueabihf/8.3.0/lto-wrapper opt/rv1126_rv1109_sdk/prebuilts/gcc/linux-x86/arm/gcc-arm-8.32019.03-x86_64-arm-linux-gnueabihf/libexec/gcc/arm-linux-gnueabihf/8.3.0/liblto_plugin.so opt/rv1126_rv1109_sdk/prebuilts/gcc/linux-x86/arm/gcc-arm-8.32019.03-x86_64-arm-linux-gnueabihf/libexec/gcc/arm-linux-gnueabihf/8.3.0/liblto_plugin.so.0 opt/rv1126_rv1109_sdk/prebuilts/gcc/linux-x86/arm/gcc-arm-8.32019.03-x86_64-arm-linux-gnueabihf/libexec/gcc/arm-linux-gnueabihf/8.3.0/lto1 opt/rv1126_rv1109_sdk/prebuilts/gcc/linux-x86/arm/gcc-arm-8.32019.03-x86_64-arm-linux-gnueabihf/libexec/gcc/arm-linux-gnueabihf/8.3.0/cc1 opt/rv1126_rv1109_sdk/prebuilts/gcc/linux-x86/arm/gcc-arm-8.32019.03-x86_64-arm-linux-gnueabihf/8.32019.03-x86_64-arm-linux-gnueabihf-manifest.txt opt/rv1126_rv1109_sdk/prebuilts/gcc/linux-x86/arm/gcc-arm-8.32019.03-x86_64-arm-linux-gnueabihf/share/ opt/rv1126_rv1109_sdk/prebuilts/gcc/linux-x86/arm/gcc-arm-8.32019.03-x86_64-arm-linux-gnueabihf/share/locale/

然后坐等安装完成。

【EASY EAI Nano开源套件试用体验】Ubuntu 20.04下的开发环境搭建和第一个交叉编译程序执行-开源EDA

设置环境变量,将刚才安装的SDK包含:

复制root@EliteDesk:/media/rv1126$ export PATH=/opt/rv1126_rv1109_sdk/buildroot/output/rockchip_face_board/host/bin:$PATH root@EliteDesk:/media/rv1126$ export ARCH=arm root@EliteDesk:/media/rv1126$ export CROSS_COMPILE=arm-linux-gnueabihf-

测试交叉编译环境是否安装成功:

复制root@EliteDesk:/media/rv1126$ qmake -v QMake version 3.1 Using Qt version 5.15.2 in /opt/rv1126_rv1109_sdk/buildroot/output/rockchip_face_board/host/arm-buildroot-linux-gnueabihf/sysroot/usr/lib root@EliteDesk:/media/rv1126$ arm-linux-gnueabihf-gcc -v Using built-in specs. COLLECT_GCC=/opt/rv1126_rv1109_sdk/buildroot/../prebuilts/gcc/linux-x86/arm/gcc-arm-8.32019.03-x86_64-arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc COLLECT_LTO_WRAPPER=/opt/rv1126_rv1109_sdk/prebuilts/gcc/linux-x86/arm/gcc-arm-8.32019.03-x86_64-arm-linux-gnueabihf/bin/../libexec/gcc/arm-linux-gnueabihf/8.3.0/lto-wrapper Target: arm-linux-gnueabihf Configured with: /tmp/dgboter/bbs/rhev-vm8–rhe6x86_64/buildbot/rhe6x86_64–arm-linux-gnueabihf/build/src/gcc/configure –target=arm-linux-gnueabihf –prefix= –with-sysroot=/arm-linux-gnueabihf/libc –with-build-sysroot=/tmp/dgboter/bbs/rhev-vm8–rhe6x86_64/buildbot/rhe6x86_64–arm-linux-gnueabihf/build/build-arm-linux-gnueabihf/install//arm-linux-gnueabihf/libc –with-bugurl=https://bugs.linaro.org/ –enable-gnu-indirect-function –enable-shared –disable-libssp –disable-libmudflap –enable-checking=release –enable-languages=c,c++,fortran –with-gmp=/tmp/dgboter/bbs/rhev-vm8–rhe6x86_64/buildbot/rhe6x86_64–arm-linux-gnueabihf/build/build-arm-linux-gnueabihf/host-tools –with-mpfr=/tmp/dgboter/bbs/rhev-vm8–rhe6x86_64/buildbot/rhe6x86_64–arm-linux-gnueabihf/build/build-arm-linux-gnueabihf/host-tools –with-mpc=/tmp/dgboter/bbs/rhev-vm8–rhe6x86_64/buildbot/rhe6x86_64–arm-linux-gnueabihf/build/build-arm-linux-gnueabihf/host-tools –with-isl=/tmp/dgboter/bbs/rhev-vm8–rhe6x86_64/buildbot/rhe6x86_64–arm-linux-gnueabihf/build/build-arm-linux-gnueabihf/host-tools –with-arch=armv7-a –with-fpu=neon –with-float=hard –with-arch=armv7-a –with-pkgversion=GNU Toolchain for the A-profile Architecture 8.32019.03 (arm-rel-8.36) Thread model: posix gcc version 8.3.0 (GNU Toolchain for the A-profile Architecture 8.32019.03 (arm-rel-8.36))

OK,一切正常。

三、HELLO Easy EAI

来个hello小程序吧。

复制#include #include int main(void) { int i; for(i = 0; i < 5; i++) { printf(“hello Easy EAI!%d n”, i); } return 0; }

这样就好,之后执行复制arm-linux-gnueabihf-gcc hello.c -o hello,生成ARM的可执行程序hello,再通过复制adb push hello /userdata到开发板。

【EASY EAI Nano开源套件试用体验】Ubuntu 20.04下的开发环境搭建和第一个交叉编译程序执行-开源EDA

复制adb shell登录到开发板,执行程序,执行之前记得chmod修改下属性。

【EASY EAI Nano开源套件试用体验】Ubuntu 20.04下的开发环境搭建和第一个交叉编译程序执行-开源EDA

免责声明:文章内容来自互联网,本站不对其真实性负责,也不承担任何法律责任,如有侵权等情况,请与本站联系删除。
转载请注明出处:【EASY EAI Nano开源套件试用体验】Ubuntu 20.04下的开发环境搭建和第一个交叉编译程序执行-开源EDA https://www.yhzz.com.cn/a/6918.html

上一篇 2023-04-17 11:02:00
下一篇 2023-04-17 11:08:42

相关推荐

联系云恒

在线留言: 我要留言
客服热线:400-600-0310
工作时间:周一至周六,08:30-17:30,节假日休息。