I've seen exactly this behaviour when the include/gambit.h.in file determines the wrong endianness for the CPU. Given that the ARM can either be little or big-endian, chances are good that the #ifdefs in the gambit.h.in file are not sufficient to detect the endianness on the Nokia platform. Usually the C compiler or development environment will define a symbol that indicates the endianness of the CPU, and the gambit.h.in file needs to be modified to test this symbol. Here is an excerpt of the gambit.h.in file which determines the endianness when the CPU is an ARM:
#ifndef ___BIG_ENDIAN #ifndef ___LITTLE_ENDIAN
...
#ifdef ___CPU_arm #ifdef _LITTLE_ENDIAN #define ___LITTLE_ENDIAN #endif #ifdef __LITTLE_ENDIAN__ #define ___LITTLE_ENDIAN #endif #ifdef __LITTLE_ENDIAN_DATA__ #define ___LITTLE_ENDIAN #endif #endif
...
#endif #endif
Note that by default the gambit.h.in file assumes the endianness is big-endian. So I'm pretty sure none of the symbols _LITTLE_ENDIAN, __LITTLE_ENDIAN__, and __LITTLE_ENDIAN_DATA__ are defined and the gambit.h.in file will assume incorrectly that the endianness is big-endian.
There are two solutions.
#1, the clean way, is to check the compiler documentation to see which symbol is defined by the C preprocessor to indicate the endianness, and to modify the above sequence of #ifdefs to take that into account.
#2, the brute force way, is to add #define ___LITTLE_ENDIAN at the top of the gambit.h.in file.
I propose you try #2 first, and if that solves the problem, then try #1 and send me a patch so I can modify my source code.
Note that after modifying the include/gambit.h.in file, you will have to do a ./configure and probably a "make mostlyclean" before "make".
Marc
On 2009-12-29, at 3:49 AM, Frederick LeMaster wrote:
Thanks!
I tried it out and some things work great, such as cons and most of the list functions, but the reader seems to be having some serious issues:
0
3
1
2
2
1
3
0
4
7
5
6
6
5
7
4
8
*** ERROR IN (console)@9.1 -- Unbound variable: 8 1>
It seems like it is failing to read the digits properly as numbers. The arithmetic routines seem okay though,
(number->string (+ (string-length "elephant") (string-length "")))
"8"
Is the reader making an unsafe assumption? -Fred LeMaster
On Mon, Dec 28, 2009 at 6:40 AM, Marc Feeley feeley@iro.umontreal.ca wrote:
On 2009-12-28, at 3:04 AM, Frederick LeMaster wrote:
Hello Dr. Feeley, I am interested in using gambit on the nokia n900 tablet, which features an ARMv7 cpu. What changes would I need to make in the gambit sources to allow it to function correctly on this architecture?
Nothing! It should work "out of the box".
Marc
Afficher les réponses par date
Thanks! It looks like the preprocessor symbol __ARMEL__ specifies little endianness and __ARMEB__ specifies big endianness. Here's the patch for gambit.h.in
On Tue, Dec 29, 2009 at 7:13 AM, Marc Feeley feeley@iro.umontreal.ca wrote:
I've seen exactly this behaviour when the include/gambit.h.in file determines the wrong endianness for the CPU. Given that the ARM can either be little or big-endian, chances are good that the #ifdefs in the gambit.h.in file are not sufficient to detect the endianness on the Nokia platform. Usually the C compiler or development environment will define a symbol that indicates the endianness of the CPU, and the gambit.h.in file needs to be modified to test this symbol. Here is an excerpt of the gambit.h.in file which determines the endianness when the CPU is an ARM:
#ifndef ___BIG_ENDIAN #ifndef ___LITTLE_ENDIAN
...
#ifdef ___CPU_arm #ifdef _LITTLE_ENDIAN #define ___LITTLE_ENDIAN #endif #ifdef __LITTLE_ENDIAN__ #define ___LITTLE_ENDIAN #endif #ifdef __LITTLE_ENDIAN_DATA__ #define ___LITTLE_ENDIAN #endif #endif
...
#endif #endif
Note that by default the gambit.h.in file assumes the endianness is big-endian. So I'm pretty sure none of the symbols _LITTLE_ENDIAN, __LITTLE_ENDIAN__, and __LITTLE_ENDIAN_DATA__ are defined and the gambit.h.in file will assume incorrectly that the endianness is big-endian.
There are two solutions.
#1, the clean way, is to check the compiler documentation to see which symbol is defined by the C preprocessor to indicate the endianness, and to modify the above sequence of #ifdefs to take that into account.
#2, the brute force way, is to add #define ___LITTLE_ENDIAN at the top of the gambit.h.in file.
I propose you try #2 first, and if that solves the problem, then try #1 and send me a patch so I can modify my source code.
Note that after modifying the include/gambit.h.in file, you will have to do a ./configure and probably a "make mostlyclean" before "make".
Marc
Just wondering what happened with this - have you got gambit generating n900 binaries? What is the workflow like?
martin
On Wed, Dec 30, 2009 at 5:08 AM, Frederick LeMaster fred.lemaster@gmail.com wrote:
Thanks! It looks like the preprocessor symbol __ARMEL__ specifies little endianness and __ARMEB__ specifies big endianness. Here's the patch for gambit.h.in
On Tue, Dec 29, 2009 at 7:13 AM, Marc Feeley feeley@iro.umontreal.ca wrote:
I've seen exactly this behaviour when the include/gambit.h.in file determines the wrong endianness for the CPU. Given that the ARM can either be little or big-endian, chances are good that the #ifdefs in the gambit.h.in file are not sufficient to detect the endianness on the Nokia platform. Usually the C compiler or development environment will define a symbol that indicates the endianness of the CPU, and the gambit.h.in file needs to be modified to test this symbol. Here is an excerpt of the gambit.h.in file which determines the endianness when the CPU is an ARM:
#ifndef ___BIG_ENDIAN #ifndef ___LITTLE_ENDIAN
...
#ifdef ___CPU_arm #ifdef _LITTLE_ENDIAN #define ___LITTLE_ENDIAN #endif #ifdef __LITTLE_ENDIAN__ #define ___LITTLE_ENDIAN #endif #ifdef __LITTLE_ENDIAN_DATA__ #define ___LITTLE_ENDIAN #endif #endif
...
#endif #endif
Note that by default the gambit.h.in file assumes the endianness is big-endian. So I'm pretty sure none of the symbols _LITTLE_ENDIAN, __LITTLE_ENDIAN__, and __LITTLE_ENDIAN_DATA__ are defined and the gambit.h.in file will assume incorrectly that the endianness is big-endian.
There are two solutions.
#1, the clean way, is to check the compiler documentation to see which symbol is defined by the C preprocessor to indicate the endianness, and to modify the above sequence of #ifdefs to take that into account.
#2, the brute force way, is to add #define ___LITTLE_ENDIAN at the top of the gambit.h.in file.
I propose you try #2 first, and if that solves the problem, then try #1 and send me a patch so I can modify my source code.
Note that after modifying the include/gambit.h.in file, you will have to do a ./configure and probably a "make mostlyclean" before "make".
Marc
Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
Hallo,
On Wed, Jan 27, 2010 at 12:11 PM, Martin DeMello martindemello@gmail.com wrote:
Just wondering what happened with this - have you got gambit generating n900 binaries? What is the workflow like?
Gambit-C 4.6.0 has improved ARM CPU detection. I don't have the N900 SDK, but I guess the building process must be something like iPhone's:
http://jlongster.com/blog/2009/06/17/write-apps-iphone-scheme/