查看: 1174|回复: 0

SAMA5D3 Embedded Study 初阶段

[复制链接]
  • TA的每日心情
    开心
    2022-4-12 14:51
  • 签到天数: 163 天

    连续签到: 1 天

    [LV.7]常住居民III

    发表于 2015-5-14 15:35:57 | 显示全部楼层 |阅读模式
    分享到:
    SAMA5D3嵌入式学习初阶段
    在学习SAMA5D3 XPLAINED开发板过程中,查找到“阿青1987”的博客园有许多关于SAMA5D3_Xpalined开发板文章,链接地址如下:https://www.cnblogs.com/aqing1987/p/4290548.html#3180430;还有百度文库“血火火”的一篇“Atmel开发板sama5d3x开发环境搭建”文章,链接地址如下:https://wenku.baidu.com/view/620f43f7d0d233d4b04e691f.html;根据查找资料再参考linux4sam网站的getting started、AT91BOOTSTRAP、U-BOOT、LINUX-KERNEL、BUILD-BOOT等内容,搭建开发板编译环境。学习过程中不断摸索,走了很多弯路,就如“摸着石头过河”,有很多困惑,没有深入学习,也在担心自己有没有走错路。
    开始正文:
    第一步 配置交叉编译工具:
    1.下载“阿青1987”推荐的arm-none-eabi交叉编译工具,连接地址如下:
    https://sourcery.mentor.com/GNUToolchain/package8734/public/arm-none-eabi/arm-2011.03-42-arm-none-eabi-i686-pc-linux-gnu.tar.bz2
    2.下载解压后,使用命令tar xvf将解压文件放至于/opt/arm-cross
    3.添加环境变量, nano ~/.bashrc,如使用普通用户’~’表示根目录/home/用户名,如使用管理员方式’~’表示根目录/root;
    在应用过程中,使用的是另一种方式,以管理员身份输入命令(否则提示文件为只读模式):vi /etc/profile,在最后一行添加:export PATH=$PATH :/opt/arm-cross/arm-2011.03/bin;再执行source /etc/profile
    使用nano编译文件比较方便,如同记事本,ctrl+o为保存,ctrl+x退出
    使用vi编译文件,通常为命令模式,x删除光标所在字符,dd删除正行,:wq保存退出,:q!强制退出;i进入插入模式,如果插入字符错误,请按esc键退出插入模式进入命令模式删除字符
    4.可以查看/opt/arm-cross下编译工具
    # ls /opt/arm-cross
    arm-2011.03  arm-2011.03-42-arm-none-eabi-i686-pc-linux-gnu.tar.bz2
    # ls /opt/arm-cross/arm-2011.03/bin
    arm-none-eabi-addr2line  arm-none-eabi-gcc-4.5.2  arm-none-eabi-ranlib
    arm-none-eabi-ar  arm-none-eabi-gcov  arm-none-eabi-readelf
    arm-none-eabi-as  arm-none-eabi-gdb  arm-none-eabi-run
    arm-none-eabi-c++  arm-none-eabi-gdbtui  arm-none-eabi-size
    arm-none-eabi-c++filt  arm-none-eabi-gprof  arm-none-eabi-sprite
    arm-none-eabi-cpp  arm-none-eabi-ld  arm-none-eabi-strings
    arm-none-eabi-elfedit  arm-none-eabi-nm  arm-none-eabi-strip
    arm-none-eabi-g++  arm-none-eabi-objcopy
    arm-none-eabi-gcc  arm-none-eabi-objdump
    第二步 下载at91bootstrap并编译:
    1.下载安装过程请参考linux4sam网站,我下载目录在/home/allen/ATMEL
    2.部分指令如下:
    # cd /home/allen/ATMEL/at91bootstrap/
    # make mrproper
    CLEAN  obj and misc files!
    CLEAN  configuration files!
    CLEAN  binary files!
    # make sama5d3_xplainednf_uboot_defconfig
    #
    # configuration written to .config
    #
    #
    # make dependencies written to .auto.deps
    # See top of this file before playing with this auto-preprequisites!
    #
    上述为编译时系统输出信息
    # make CROSS_COMPILE=arm-none-eabi-
    等待编译完成输出如下信息
    ……
    Size of sama5d3_xplained-nandflashboot-uboot-3.7.2-rc2.bin is 20084 bytes
    [Succeeded] It's OK to fit into SRAM area
    [Attention] The space left for stack is 45452 bytes
    查看binanries文件目录内容,可以看到.bin文件
    # ls binaries/
    at91bootstrap.bin
    sama5d3_xplained-nandflashboot-uboot-3.7.2-rc2.bin
    sama5d3_xplained-nandflashboot-uboot-3.7.2-rc2.elf
    sama5d3_xplained-nandflashboot-uboot-3.7.2-rc2.map

    At91bootstrap编译完成图片
    第三步 下载u-boot-at91并编译:
    1.下载安装过程请参考linux4sam网站,我下载目录在/home/allen/ATMEL
    2.部分指令如下:
    # cd /home/allen/ATMEL/u-boot-at91/
    # make distclean
    CLEAN  examples/standalone
    CLEAN  tools
    CLEAN  tools/lib tools/common
    CLEAN  spl/arch spl/board spl/common spl/drivers spl/fs spl/lib spl/u-boot-spl spl/u-boot-spl.bin spl/u-boot-spl.lds spl/u-boot-spl.map
    CLEAN  boot.bin u-boot u-boot.bin u-boot.img u-boot.lds u-boot.map u-boot.srec System.map
    CLEAN  scripts/basic
    CLEAN  scripts/kconfig
    CLEAN  include/config include/generated spl
    CLEAN  .config include/autoconf.mk include/autoconf.mk.dep include/config.h
    distclean系统输出如上信息
    # make sama5d3_xplained_nandflash_config
    HOSTCC  scripts/basic/fixdep
    HOSTCC  scripts/kconfig/conf.o
    SHIPPED scripts/kconfig/zconf.tab.c
    SHIPPED scripts/kconfig/zconf.lex.c
    SHIPPED scripts/kconfig/zconf.hash.c
    HOSTCC  scripts/kconfig/zconf.tab.o
    HOSTLD  scripts/kconfig/conf
    #
    # configuration written to .config
    #
    #
    # configuration written to spl/.config
    #
    配置config输出如上信息
    # make CROSS_COMPILE=arm-none-eabi-
    编译完成输出如下信息:
    OBJCOPY spl/u-boot-spl.bin
    MKIMAGE boot.bin

    u-boot编译完成图片
    第四步 下载linux-at91并编译:
    1.下载安装过程请参考linux4sam网站,我下载目录在/home/allen/ATMEL
    2.部分指令如下:
    # make ARCH=arm sama5d3_xplained_defconfig
    HOSTCC  scripts/basic/fixdep
    HOSTCC  scripts/kconfig/conf.o
    SHIPPED scripts/kconfig/zconf.tab.c
    SHIPPED scripts/kconfig/zconf.lex.c
    SHIPPED scripts/kconfig/zconf.hash.c
    HOSTCC  scripts/kconfig/zconf.tab.o
    HOSTLD  scripts/kconfig/conf
    #
    # configuration written to .config
    配置config输出以上信息,官网上指令为make ARCH=arm sama5d3_xplained_defconfig for instance,但是一直提示错误
    # make ARCH=arm  CROSS_COMPILE=/opt/arm-cross/arm-2011.03/bin/arm-none-eabi- zImage
    编译zImage输出信息量较多,不列举了
    # make ARCH=arm  CROSS_COMPILE=/opt/arm-cross/arm-2011.03/bin/arm-none-eabi- uImage
    CHK  include/generated/uapi/linux/version.h
    CHK  include/generated/utsrelease.h
    make[1]: “include/generated/mach-types.h”是最新的。
    CALL  scripts/checksyscalls.sh
    CC  scripts/mod/devicetable-offsets.s
    GEN  scripts/mod/devicetable-offsets.h
    HOSTCC  scripts/mod/file2alias.o
    HOSTLD  scripts/mod/modpost
    CHK  include/generated/compile.h
    Kernel: arch/arm/boot/Image is ready
    Kernel: arch/arm/boot/zImage is ready
    UIMAGE  arch/arm/boot/uImage
    Image Name:  Linux-3.10.0+
    Created:  Tue May 12 17:35:53 2015
    Image Type:  ARM Linux Kernel Image (uncompressed)
    Data Size:  3804104 Bytes = 3714.95 kB = 3.63 MB
    Load Address: 20008000
    Entry Point:  20008000
    Image arch/arm/boot/uImage is ready
    编译uImage输出以上信息
    # make ARCH=arm  CROSS_COMPILE=/opt/arm-cross/arm-2011.03/bin/arm-none-eabi- dtbs

    Linux-at91 zImage编译完成图片

    Linux-at91 uImage dtbs编译图片
    后续文章内容会包括tftp服务器、nfs服务器,但在配置SAMA5D3_XPLAINED开发板nfs功能时,编译buildroot-at91一直提示出错,一直卡在这个位置,告警提示内容如下:
    >>> toolchain-external undefined Patching
    >>> toolchain-external undefined Configuring
    Cannot execute cross-compiler '/home/allen/ATMEL/buildroot-at91/output/host/opt/ext-toolchain/bin/arm-linux-gnueabihf-gcc'
    make: *** [/home/allen/ATMEL/buildroot-at91/output/build/toolchain-external-undefined/.stamp_configured] 错误 1
    如果有论坛朋友知道问题原因,请一定告诉我!!!谢谢
    感谢爱板论坛版主的支持,可以继续学习SAMA5D3_Xplained开发板!感谢博客园“阿青1987”拍疑解惑!请高手不吝赐教,让我们初学者走出困惑!
    wspytu 2015/5/13
    回复

    使用道具 举报

    您需要登录后才可以回帖 注册/登录

    本版积分规则

    关闭

    站长推荐上一条 /2 下一条

    手机版|小黑屋|与非网

    GMT+8, 2024-4-26 11:23 , Processed in 0.109950 second(s), 17 queries , MemCache On.

    ICP经营许可证 苏B2-20140176  苏ICP备14012660号-2   苏州灵动帧格网络科技有限公司 版权所有.

    苏公网安备 32059002001037号

    Powered by Discuz! X3.4

    Copyright © 2001-2024, Tencent Cloud.