Arm下的armeb(armbe)和armel(armle)

今天在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

可以判断为小端程序

猜你喜欢

转载自yiranwuqing.iteye.com/blog/1226524
今日推荐