设为首页收藏本站
查看: 1984|回复: 5

【米尔瑞萨RZ/G2L开发板-试用体验】安装交叉编译器

[复制链接]

33

主题

15

回帖

855

积分

管理员

积分
855
米尔小助手1 发表于 2023-6-12 18:01:35 | 显示全部楼层 |阅读模式
安装SDK
下载sdk并上传到虚拟机,解压后执行:


在这对话框中输入想要保存的目录:


在下面的对话框中输入Y:


然后稍等安装完毕:
  1. Extracting SDK.......................................................................................................................................................................................................done
  2. Setting it up...done
  3. SDK has been successfully set up and is ready to be used.
  4. Each time you wish to use the SDK in a new shell session, you need to source the environment setup script e.g.
  5. $ . /opt/yg2lx/environment-setup-aarch64-poky-linux
  6. $ . /opt/yg2lx/environment-setup-armv7vet2hf-neon-vfpv4-pokymllib32-linux-gnueabi
复制代码

测试SDK
安装完成后,使用以下命令设置环境变量,测试 SDK 是否完成:
  1. lugl@lugl-virtual-machine:~/MYD/sdk$ source /opt/yg2lx/environment-setup-aarch64-poky-linux

  2. lugl@lugl-virtual-machine:~/MYD/sdk$ $CC -v
  3. Using built-in specs.
  4. COLLECT_GCC=aarch64-poky-linux-gcc
  5. COLLECT_LTO_WRAPPER=/opt/yg2lx/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/8.3.0/lto-wrapper
  6. Target: aarch64-poky-linux
  7. Configured with: ../../../../../../work-shared/gcc-8.3.0-r0/gcc-8-8.3.0/src/configure --build=x86_64-linux --host=x86_64-pokysdk-linux --target=aarch64-poky-linux --prefix=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr --exec_prefix=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr --bindir=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux --sbindir=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux --libexecdir=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux --datadir=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr/share --sysconfdir=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/etc --sharedstatedir=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/com --localstatedir=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/var --libdir=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr/lib/aarch64-poky-linux --includedir=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr/include --oldincludedir=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr/include --infodir=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr/share/info --mandir=/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr/share/man --disable-silent-rules --disable-dependency-tracking --with-libtool-sysroot=/home/hjx/renesas/new2-yocto/build-myir/tmp/work/x86_64-nativesdk-pokysdk-linux/gcc-cross-canadian-aarch64/8.3.0-r0/recipe-sysroot --with-gnu-ld --enable-shared --enable-languages=c,c++ --enable-threads=posix --enable-multilib --enable-default-pie --enable-c99 --enable-long-long --enable-symvers=gnu --enable-libstdcxx-pch --program-prefix=aarch64-poky-linux- --without-local-prefix --disable-install-libiberty --enable-lto --disable-libssp --enable-libitm --disable-bootstrap --disable-libmudflap --with-system-zlib --with-linker-hash-style=gnu --enable-linker-build-id --with-ppl=no --with-cloog=no --enable-checking=release --enable-cheaders=c_global --without-isl --with-gxx-include-dir=/not/exist/usr/include/c++/8.3.0 --with-build-time-tools=/home/hjx/renesas/new2-yocto/build-myir/tmp/work/x86_64-nativesdk-pokysdk-linux/gcc-cross-canadian-aarch64/8.3.0-r0/recipe-sysroot-native/usr/aarch64-poky-linux/bin --with-sysroot=/not/exist --with-build-sysroot=/home/hjx/renesas/new2-yocto/build-myir/tmp/work/x86_64-nativesdk-pokysdk-linux/gcc-cross-canadian-aarch64/8.3.0-r0/recipe-sysroot --enable-poison-system-directories --disable-static --enable-nls --with-glibc-version=2.28 --enable-initfini-array --enable-__cxa_atexit
  8. Thread model: posix
  9. gcc version 8.3.0 (GCC)
复制代码

到此,SDK就安装成功了。
测试
用vim编写一个hello.c:

保存后编译:$CC hello.c -o hello
编译后查看hello文件类型:
  1. lugl@lugl-virtual-machine:~/MYD/sdk$ file hello
  2. hello: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-aarch64.so.1, for GNU/Linux 3.14.0, BuildID[sha1]=5aa9a4ba2a1ff9ca3ef36c5d5508eb448b8f85f1, with debug_info, not stripped
复制代码

上传到开发板,修改权限后执行:


成功的输出了hello world,说明SDK安装成功!

回复

使用道具 举报

1

主题

4

回帖

37

积分

新手上路

积分
37
casy99 发表于 2023-7-8 08:37:34 | 显示全部楼层
官方的SDK在哪下载呀?
回复 支持 反对

使用道具 举报

9

主题

15

回帖

165

积分

注册会员

积分
165
slamdunk 发表于 2023-7-8 10:46:33 | 显示全部楼层
这是安装Toolchain吧,基于Yocto的SDK在哪里下载呢?

我按照MYD-YG2LX_Linux软件开发指南.pdf从github拉的代码只有这么点东西:
  1. myir-renesas-yocto/layers$ tree  -L 2
  2. .
  3. ├── meta-gplv2
  4. ├── meta-myir-yg2lx
  5. │   ├── classes
  6. │   ├── conf
  7. │   ├── COPYING.MIT
  8. │   ├── docs
  9. │   ├── include
  10. │   ├── README.md
  11. │   ├── recipes-bsp
  12. │   ├── recipes-common
  13. │   ├── recipes-demos
  14. │   ├── recipes-images
  15. │   ├── recipes-yg2lx
  16. │   └── scripts
  17. ├── meta-openembedded
  18. ├── meta-qt5
  19. ├── meta-renesas
  20. ├── meta-virtualization
  21. └── poky

  22. 17 directories, 2 files
复制代码
myir-renesas-yocto$ source layers/meta-myir-yg2lx/scripts/myir-environment.sh
bash: /home/cambricon/work/Rcar/myir-renesas-yocto/layers/poky/oe-init-build-env: No such file or directory

myir-environment.sh 脚本会调oe-init-build-env,但是poky里是空的。难道需要自己加poky吗?


回复 支持 反对

使用道具 举报

9

主题

15

回帖

165

积分

注册会员

积分
165
slamdunk 发表于 2023-7-8 11:35:26 | 显示全部楼层
slamdunk 发表于 2023-7-8 10:46
这是安装Toolchain吧,基于Yocto的SDK在哪里下载呢?

我按照MYD-YG2LX_Linux软件开发指南.pdf从github拉的 ...

好吧,还得用打包好的yocto压缩包,github的不完整
回复 支持 反对

使用道具 举报

6

主题

23

回帖

147

积分

注册会员

积分
147
米尔小助手2 发表于 2023-7-19 14:25:14 | 显示全部楼层
casy99 发表于 2023-7-8 08:37
官方的SDK在哪下载呀?

您拿到板子里面操作指南有的呢
回复 支持 反对

使用道具 举报

7

主题

16

回帖

95

积分

注册会员

积分
95
lugl 发表于 2024-3-29 17:07:27 | 显示全部楼层
一看,还是我写的文章呀,楼主没有给我签名呀。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录

本版积分规则

Archiver|手机版|小黑屋|米尔科技论坛   

GMT+8, 2024-12-21 23:01 , Processed in 0.048484 second(s), 23 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表