arm-linux-gcc交叉工具链的安装和使用

上传人:hs****ma 文档编号:561820289 上传时间:2023-01-16 格式:DOC 页数:5 大小:32KB
返回 下载 相关 举报
arm-linux-gcc交叉工具链的安装和使用_第1页
第1页 / 共5页
arm-linux-gcc交叉工具链的安装和使用_第2页
第2页 / 共5页
arm-linux-gcc交叉工具链的安装和使用_第3页
第3页 / 共5页
arm-linux-gcc交叉工具链的安装和使用_第4页
第4页 / 共5页
arm-linux-gcc交叉工具链的安装和使用_第5页
第5页 / 共5页
亲,该文档总共5页,全部预览完了,如果喜欢就下载吧!
资源描述

《arm-linux-gcc交叉工具链的安装和使用》由会员分享,可在线阅读,更多相关《arm-linux-gcc交叉工具链的安装和使用(5页珍藏版)》请在金锄头文库上搜索。

1、文档供参考,可复制、编制,期待您的好评与关注! arm-linux-gcc交叉工具链的安装和使用分类:linux内核工具使用2013-01-18 01:012295人阅读评论(0)收藏举报1、安装arm-linux-gcc交叉工具链rootlocalhost Denny# lsarm-linux-gcc-4.3.2.tgz Desktop gcc kernel modules shell实验 smb.conf tftp安装包 wireshark软件包at_remind.c file gdb makefiles samba安装包 smb test wirelessrootlocalhost De

2、nny#tar zxvf arm-linux-gcc-4.3.2.tgz-C/ /-C参数指的是解压到根目录下面rootlocalhost /# cd /usr/local/rootlocalhost local# lsarm bin etc games include lib libexec sbin share srcrootlocalhost local# cd arm/4.3.2/arm-none-linux-gnueabi/ bin/ lib/ libexec/ share/rootlocalhost local# cd arm/4.3.2/bin/ / 安装在/usr/local/

3、arm/4.3.2/bin/ 的“bin”目录下面rootlocalhost bin#rootlocalhost bin#/usr/local/arm/4.3.2/bin/arm-linux-gcc /arm-linux-gcc 使用方法1:跟上“全路径”rootlocalhost bin#echo $PATH/usr/lib/qt-3.3/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/binro

4、otlocalhost bin#export $PATHbash: export: /usr/lib/qt-3.3/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin: not a valid identifierrootlocalhost bin# vi /etc/proprofile profile.d/ protocols rootlocalhost bin#vi /etc/profile

5、 /arm-linux-gcc 使用方法2:添加路径到环境变量中去 ,在系统的时候就可以“任何地方”使用arm-linux-gccrootlocalhost bin# Path manipulationif $EUID = 0 ; then pathmunge /sbin pathmunge /usr/sbin pathmunge /usr/local/sbin pathmunge /usr/local/arm/4.3.2/bin/环境变量添加的位置firootlocalhost file# cat hello.c#include int main() char *p=hello world!

6、; printf(%s:,*p); / 错误:字符串的输出printf(%s:,p); 不用加*p(字符串指针),和其他指针不同 return 0;rootlocalhost file# vi hello.crootlocalhost file#gcc hello.c -o hello / x86编译方式rootlocalhost file#./hello / 在x86上能够运行hello world!:rootlocalhost file# arm-linux-gcarm-linux-gcc arm-linux-gcc-4.3.2 arm-linux-gcovrootlocalhost fi

7、le#arm-linux-gcc hello.c -o hello1 / ARM编译方式rootlocalhost file# lsfork hello hello1 hello.c lib_file sys_file time_filerootlocalhost file#./hello1 / 在x86上不能够运行bash: ./hello1: cannot execute binary filerootlocalhost file#2、arm-linux-gcc交叉编译工具的使用今晚用了:arm-linux-objdump -S -D hello 反汇编指令时,遇到以下提示的错误:arm-

8、linux-objdump: Cant disassemble for architecture UNKNOWN!现在还不知道是什么错误引起的,等着明天再解决了!原因是:由于上面用了“gcc hello.c -o hello x86编译方式” 和 “arm-linux-gcc hello.c -o hello1 ARM编译方式”产生了hello 和 hello1 对应不同平台的文件,当然用“arm-linux-objdump -S -D hello”用arm反汇编指令对x86平台产生的bin文件进行反汇编,肯定出现错误(1)、反汇编arm-linux-objdump 使用rootlocalho

9、st filearm-linux-objdump -S -D helloarm-linux-objdump: Cant disassemble for architecture UNKNOWN!rootlocalhost file# lsforkhello hello1hello.c lib_file sys_file time_file / hello 是x86编译出来的,hello1是arm编译出来的rootlocalhost file#arm-linux-gcc -g hello.c -o hello1 / -g编译产生带有调试的信息的文件(反汇编后:c语言才能和汇编语言对应上)root

10、localhost file#arm-linux-objdump -D -S hello1 log rootlocalhost file# lsfork hello hello1 hello.c lib_file log sys_file time_filerootlocalhost file#vi log / 查看对应的文件如下00008380 :#include int main() 8380: e92d4800 push fp, lr 8384: e28db004 add fp, sp, #4 ; 0x4 8388: e24dd008 sub sp, sp, #8 ; 0x8 char

11、*p=hello world!; 838c: e59f3020 ldr r3, pc, #32 ; 83b4 8390: e50b3008 str r3, fp, #-8 printf(%s:,p); 8394: e59f001c ldr r0, pc, #28 ; 83b8 8398: e51b1008 ldr r1, fp, #-8 839c: ebffffc7 bl 82c0 return 0; 83a0: e3a03000 mov r3, #0 ; 0x0(2)arm-linux-readelf文件查看工具rootlocalhost file#arm-linux-readelf -a

12、hello1 log ELF Header: /主要查看这个头文件 Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 Class: ELF32 Data: 2s complement,little endian /采用的是小端模式(程序运行不起来,硬件平台是打断格式,交叉工具链是小端格式) Version: 1 (current) OS/ABI: UNIX - System V ABI Version: 0 Type: EXEC (Executable file) Machine: ARM /程序运行在ARM平台上 Version: 0x1 Entry point address: 0x82cc Start of program headers: 52 (bytes into file) Start of section headers:

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 行业资料 > 国内外标准规范

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号