今天在arm的机子上安装软件时,发现arm下的软件分为armbe和armle,着实让我费了一番周折。
总结下,大家共享:
ARMEB = ARM EABI Big-endian ,也有称为ARMBE #大端字节序
ARMEL = ARM EABI Little-endian,也有称为ARMLE #小端字节序
EABI = Embedded Application Binary Interface, most commonly for PowerPC and ARM architecture
这个是无法通过处理器来查看到信息的,只能运行一个小程序
unsigned char chk_cpu(){
int data=0x0011;
char temp=*(char *)&data;
if(temp==0) return 0; //大端返回0;
else return 1; //小段返回1;
}
改程序转自:http://hi.baidu.com/zhouq3132/blog/item/9aac0346d6c9fe016a63e522.html
我的 测试程序为
#include<stdio.h>
//filename:test.c
int main()
{
printf("hello word!");
int data=0x0011;
char temp=*(char*)&data;
if (temp==0)
{
printf("big");
return 0;//big ,eb
}
else
{
printf("little");
return 1;
}
}
gcc test.c -o test
./test
输出helloword! little
可以判断为小端程序
本文深入探讨了在ARM架构下软件编译时所涉及的EB(Big-endian)与EL(Little-endian)的区别,并通过一个简单程序展示了如何通过运行时检查确定目标系统的字节序。
931

被折叠的 条评论
为什么被折叠?



