0
  • 聊天消息
  • 系統(tǒng)消息
  • 評(píng)論與回復(fù)
登錄后你可以
  • 下載海量資料
  • 學(xué)習(xí)在線課程
  • 觀看技術(shù)視頻
  • 寫(xiě)文章/發(fā)帖/加入社區(qū)
會(huì)員中心
創(chuàng)作中心

完善資料讓更多小伙伴認(rèn)識(shí)你,還能領(lǐng)取20積分哦,立即完善>

3天內(nèi)不再提示

【EASY EAI Nano開(kāi)源套件試用體驗(yàn)】Ubuntu 20.04下的開(kāi)發(fā)環(huán)境搭建和第一個(gè)交叉編譯程序執(zhí)行

開(kāi)發(fā)板試用精選 ? 來(lái)源:開(kāi)發(fā)板試用 ? 作者:電子發(fā)燒友論壇 ? 2022-10-11 15:05 ? 次閱讀

本文來(lái)源電子發(fā)燒友社區(qū),作者:大菠蘿Alpha, 帖子地址:https://bbs.elecfans.com/jishu_2309329_1_1.html


因?yàn)橐恢庇肬buntu 20.04環(huán)境,沒(méi)有使用官方的VMWARE鏡像搭建環(huán)境,所以直接開(kāi)貼來(lái)一篇。

一、開(kāi)發(fā)環(huán)境準(zhǔn)備

(一)操作系統(tǒng)

使用的是Ubuntu 20.04。

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

(二)Cmake

執(zhí)行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.4-3.1ubuntu2_amd64.deb ...
Unpacking libjsoncpp1:amd64 (1.7.4-3.1ubuntu2) ...
Selecting previously unselected package librhash0:amd64.
Preparing to unpack .../librhash0_1.3.9-1_amd64.deb ...
Unpacking librhash0:amd64 (1.3.9-1) ...
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.9-1) ...
Setting up cmake-data (3.16.3-1ubuntu1) ...
Setting up libjsoncpp1:amd64 (1.7.4-3.1ubuntu2) ...
Setting up cmake (3.16.3-1ubuntu1) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.9) ...

二、安裝交叉編譯工具鏈
直接使用官方下載的rv1126_rv1109_compiler_20220715_175105.tar.gz 文件,執(zhí)行sudo tar xvf rv1126_rv1109_compiler_20220715_175105.tar.gz -C /
千萬(wàn)記得加上sudo,不要問(wèn)為什么。

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.3-2019.03-x86_64-arm-linux-gnueabihf/
opt/rv1126_rv1109_sdk/prebuilts/gcc/linux-x86/arm/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/libexec/
opt/rv1126_rv1109_sdk/prebuilts/gcc/linux-x86/arm/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/libexec/gcc/
opt/rv1126_rv1109_sdk/prebuilts/gcc/linux-x86/arm/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/libexec/gcc/arm-linux-gnueabihf/
opt/rv1126_rv1109_sdk/prebuilts/gcc/linux-x86/arm/gcc-arm-8.3-2019.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.3-2019.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.3-2019.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.3-2019.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.3-2019.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.3-2019.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.3-2019.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.3-2019.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.3-2019.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.3-2019.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.3-2019.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.3-2019.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.3-2019.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.3-2019.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.3-2019.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.3-2019.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.3-2019.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.3-2019.03-x86_64-arm-linux-gnueabihf/8.3-2019.03-x86_64-arm-linux-gnueabihf-manifest.txt
opt/rv1126_rv1109_sdk/prebuilts/gcc/linux-x86/arm/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/share/
opt/rv1126_rv1109_sdk/prebuilts/gcc/linux-x86/arm/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/share/locale/

然后坐等安裝完成。
EAI1.png

設(shè)置環(huán)境變量,將剛才安裝的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-

測(cè)試交叉編譯環(huán)境是否安裝成功:

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.3-2019.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.3-2019.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.3-2019.03 (arm-rel-8.36)'
Thread model: posix
gcc version 8.3.0 (GNU Toolchain for the A-profile Architecture 8.3-2019.03 (arm-rel-8.36))

OK,一切正常。

三、HELLO Easy EAI

來(lái)個(gè)hello小程序吧。

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

這樣就好,之后執(zhí)行arm-linux-gnueabihf-gcc hello.c -o hello,生成ARM的可執(zhí)行程序hello,再通過(guò)adb push hello /userdata到開(kāi)發(fā)板。
EAI2.png

adb shell登錄到開(kāi)發(fā)板,執(zhí)行程序,執(zhí)行之前記得chmod修改下屬性。
EAI3.png

聲明:本文內(nèi)容及配圖由入駐作者撰寫(xiě)或者入駐合作網(wǎng)站授權(quán)轉(zhuǎn)載。文章觀點(diǎn)僅代表作者本人,不代表電子發(fā)燒友網(wǎng)立場(chǎng)。文章及其配圖僅供工程師學(xué)習(xí)之用,如有內(nèi)容侵權(quán)或者其他違規(guī)問(wèn)題,請(qǐng)聯(lián)系本站處理。 舉報(bào)投訴
  • 開(kāi)發(fā)板
    +關(guān)注

    關(guān)注

    25

    文章

    4900

    瀏覽量

    97065
  • Ubuntu
    +關(guān)注

    關(guān)注

    5

    文章

    559

    瀏覽量

    29503
收藏 人收藏

    評(píng)論

    相關(guān)推薦

    【RA-Eco-RA2E1-48PIN-V1.0開(kāi)發(fā)試用開(kāi)發(fā)環(huán)境搭建和程序串口燒寫(xiě)

    非常榮幸獲得RA-Eco-RA2E1-48PIN-V1.0開(kāi)發(fā)板的試用機(jī)會(huì),感謝論壇提供的測(cè)評(píng)機(jī)會(huì)。本人也是第一次用瑞薩的開(kāi)發(fā)板,在使用
    發(fā)表于 11-05 17:39

    嵌入式學(xué)習(xí)-飛凌嵌入式ElfBoard ELF 1板卡-開(kāi)發(fā)環(huán)境搭建交叉編譯

    了hello_ubuntu程序,在此章節(jié),將使用安裝的開(kāi)發(fā)板的交叉編譯編譯
    發(fā)表于 09-30 09:36

    飛凌嵌入式ElfBoard ELF 1板卡-開(kāi)發(fā)環(huán)境搭建交叉編譯

    了hello_ubuntu程序,在此章節(jié),將使用安裝的開(kāi)發(fā)板的交叉編譯編譯
    發(fā)表于 09-29 09:51

    【北京迅為】iTOP-LS2K0500開(kāi)發(fā)板快速使用編譯環(huán)境ubuntu20.04第一章加載迅為提供 Ubuntu20.04

    【北京迅為】iTOP-LS2K0500開(kāi)發(fā)板快速使用編譯環(huán)境ubuntu20.04第一章加載迅為提供 U
    的頭像 發(fā)表于 09-18 16:43 ?380次閱讀
    【北京迅為】iTOP-LS2K0500<b class='flag-5'>開(kāi)發(fā)</b>板快速使用<b class='flag-5'>編譯</b><b class='flag-5'>環(huán)境</b><b class='flag-5'>ubuntu20.04</b><b class='flag-5'>第一</b>章加載迅為提供 <b class='flag-5'>Ubuntu20.04</b>

    【xG24 Matter開(kāi)發(fā)套件試用體驗(yàn)】4-第一個(gè)例程2

    在上篇中沒(méi)能把例程創(chuàng)建成功【xG24 Matter開(kāi)發(fā)套件試用體驗(yàn)】3-第一個(gè)例程 這里繼續(xù)把過(guò)程記錄如下: 1分析問(wèn)題 問(wèn)題可能出在的位置只會(huì)是simplicity studio安
    發(fā)表于 08-02 08:35

    【xG24 Matter開(kāi)發(fā)套件試用體驗(yàn)】開(kāi)發(fā)環(huán)境搭建和開(kāi)發(fā)流程體驗(yàn)

    ,并提供給BSP給應(yīng)用程序開(kāi)發(fā)人員個(gè)快速的開(kāi)端 板載的J-Link調(diào)試器通過(guò)SWD接口連接EFR32MG24芯片,VCOM虛擬串口連接到芯片的USART1
    發(fā)表于 07-19 23:22

    鴻蒙OpenHarmony【搭建Ubuntu環(huán)境

    支持在Windows環(huán)境進(jìn)行編譯,如Hi3861、Hi3516系列開(kāi)發(fā)板。因此,建議使用Ubuntu
    的頭像 發(fā)表于 04-19 16:53 ?1221次閱讀
    鴻蒙OpenHarmony【<b class='flag-5'>搭建</b><b class='flag-5'>Ubuntu</b><b class='flag-5'>環(huán)境</b>】

    【LicheeRV-Nano開(kāi)發(fā)套件試用體驗(yàn)】+智能平板開(kāi)發(fā)

    首先感謝Sipeed矽速科技和電子發(fā)燒友給與的這次機(jī)會(huì),得以試用LicheeRV-Nano開(kāi)發(fā)套件,并與大家共同分享與學(xué)習(xí)。 鑒于試用報(bào)告格式調(diào)整,后面亦按要求展現(xiàn)。 申請(qǐng)理由:
    發(fā)表于 03-06 23:05

    【飛凌OK113i-S開(kāi)發(fā)試用】軟件開(kāi)發(fā)環(huán)境搭建

    Wmvare工具。 二,Vmware虛擬機(jī)里加載已有 ubuntu 開(kāi)發(fā)環(huán)境 飛凌搭建好的虛擬機(jī)環(huán)境,環(huán)
    發(fā)表于 12-25 12:06

    如何用RK3588編寫(xiě)應(yīng)用程序

    的參考資料里面,也講述了如何使用Qt Creator搭建嵌入式Linux + Qt 的開(kāi)發(fā)環(huán)境, 編寫(xiě)測(cè)試應(yīng)用程序 我們可以嘗試編譯
    發(fā)表于 12-19 13:24

    【愛(ài)芯派 Pro 開(kāi)發(fā)試用體驗(yàn)】2.運(yùn)行示例程序次失敗的編譯

    的主題就是搭建編譯環(huán)境、次失敗的編譯、運(yùn)行板上的示例程序,以及解決方案和后續(xù)計(jì)劃。
    發(fā)表于 12-14 22:28

    【飛騰派4G版免費(fèi)試用】1.實(shí)戰(zhàn)交叉編譯環(huán)境搭建和手把手uboot編譯

    就來(lái)給大家說(shuō)說(shuō)如何進(jìn)行交叉編譯環(huán)境搭建吧! 首先,我們先來(lái)聊聊什么是飛騰派交叉編譯
    發(fā)表于 12-06 16:58

    【涂鴉T2-U開(kāi)發(fā)試用體驗(yàn)】1、T2-U開(kāi)發(fā)環(huán)境搭建及調(diào)試

    :T2-U開(kāi)發(fā)環(huán)境只能在ubuntu搭建,windows用tuya ide無(wú)法下載t2-u的
    發(fā)表于 11-25 23:38

    【ELF 1開(kāi)發(fā)試用】3. Ubuntu 開(kāi)發(fā)環(huán)境搭建——編譯

    【ELF 1開(kāi)發(fā)試用】3. Ubuntu 開(kāi)發(fā)環(huán)境搭建
    發(fā)表于 11-23 23:35

    ubuntu20.04安裝教程

    Ubuntu 20.04 的安裝步驟如下: 制作啟動(dòng)U盤(pán)。首先下載Ubuntu 20.04的鏡像文件和UltraISO(鏡像制作工具)。然后使用UltraISO打開(kāi)下載的鏡像文件,插入
    的頭像 發(fā)表于 11-13 16:59 ?2000次閱讀