Hallo zusammen, Entwicklungsumgebung: ARM9 mit Gnu 3.4.4, software floating point library (-msoft-float) und uClibc 0.9.27 In diesem Beispiel wird die double Zahl 1.1 und ihr Speicherordnung im Terminal ausgegeben Merken: 1,1 -> 0x3FF199999999999A Meine Frage: Warurm ist die Speicherung der Doublewert auf dem ARM in big Endiann, obwohl die CPU in Little Endian eingeschaltet ist. Snippet 1 läuft auf einen Win32 Rechner und die Ausgaben im Terminal entsprechen die Erwarteten Speicher Zuordnug. ABER beim Snippet 2 ist der double 1.1 in Big-Endian Format gespeichert. Git's einen Compiler-Schalter oder ähnliches um die FloatingUnit zu sagen, die soll in littleEndian arbeiten? Snippet 1: double d = 1.1; unsigned int* pd = (unsigned int*)&d; printf("d=%E, d.low=%08x, d.high=%08x\n", d, pd[0], pd[1]); Terminal-Output: d=1.100000E+000, d.low=9999999a, d.high=3ff19999 ********************** Snippet 2: double d = 1.1; unsigned int* pd = (unsigned int*)&d; printf("d=%E, d.low=%08x, d.high=%08x\n", d, pd[0], pd[1]); Terminal-Output: d1=1,1000000E d1.low=3FF19999 , d1.high=9999999A Danke imvoraus
Es gibt bei ARM beides. Das VFP Format definiert konsistente Endianess, das ältere FPA Format die beobachtete Mischform. Siehe Doku zu -mfpu=xxx neuerer Versionen vom GCC. V3.4 scheint aber kein VFP zu kennen, da ist möglicherweise nichts zu machen.
@A. K. Dass die FPA einen mixed-endian-double stimmt. Siehe auch: http://wiki.debian.org/ArmEabiPort da steht: "The FPA unit also has the peculiarity of having mixed-endian doubles, which is usually the biggest grief for ARM porters" Ist softfloat automatisch FPA?
Toto schrieb: > Ist softfloat automatisch FPA? Für 3.4 sieht es so aus. In der 4.7 Doku zu -mfpu=xxx steht explizit drin, dass das Layout von Software-FP von der Definition der nicht vorhandenen Hardware abhängt: "If -msoft-float is specified this specifies the format of floating-point values". In 4.7 lässt sich das also einstellen.
Hallo, in der uclibc header "include/endian.h" ist ein define "__FLOAT_WORD_ORDER" und es schein dass dies die Wordorder (Endianess) in einem double bestimmt. Weiss jemmand wie man dies am besten auf little_endian einstellen kann? soll die uclibc neu kompiliert werden? hier die endian.h: #ifndef _ENDIAN_H #define _ENDIAN_H 1 #include <features.h> /* Definitions for byte order, according to significance of bytes, from low addresses to high addresses. The value is what you get by putting '4' in the most significant byte, '3' in the second most significant byte, '2' in the second least significant byte, and '1' in the least significant byte, and then writing down one digit for each byte, starting with the byte at the lowest address at the left, and proceeding to the byte with the highest address at the right. */ #define __LITTLE_ENDIAN 1234 #define __BIG_ENDIAN 4321 #define __PDP_ENDIAN 3412 /* This file defines `__BYTE_ORDER' for the particular machine. */ #include <bits/endian.h> /* Some machines may need to use a different endianness for floating point values. */ #ifndef __FLOAT_WORD_ORDER # define __FLOAT_WORD_ORDER __BYTE_ORDER #endif #ifdef __USE_BSD # define LITTLE_ENDIAN __LITTLE_ENDIAN # define BIG_ENDIAN __BIG_ENDIAN # define PDP_ENDIAN __PDP_ENDIAN # define BYTE_ORDER __BYTE_ORDER #endif #if __BYTE_ORDER == __LITTLE_ENDIAN # define __LONG_LONG_PAIR(HI, LO) LO, HI #elif __BYTE_ORDER == __BIG_ENDIAN # define __LONG_LONG_PAIR(HI, LO) HI, LO #endif #endif /* endian.h */
Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.