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