I am using SDCC with the cygnal line of 8051 microcontrollers. The one problem that I run into is that the Cygnal IDE expects multi-byte variables to be big-ended, while SDCC stores multi-byte variables as little-ended.
I noticed the define WORDS_BIGENDIAN in "sdccconf_in.h". How is this actually used? Is it possible to build SDCC so that it will create code which treats multi-byte values as big-endian.
Thank You for any help
while 8 bit CPUs normally don't care about
endianness, the 8051 has a preferred byte order (at least for variables in xdata)
As the dptr can only be incremented it is more
effective to store the least significant word
at lower addresses.
Look at adding a literal to an int:
inc dptr ; <--
you'll find clever but still lengthy code
needed to decrement the dptr f.e. in:
So Cygnal's IDE should have an option to
change endianness because
a) it is much easier to implement at a few
display routines than within a compiler
and its libraries
b) it is the technically better endianness
for the 8051
c) sdcc is probably not the only compiler
which is aware of b;)
Thanks for the info.
I wish that the Cygnal IDE did allow for support of little-endian WORDS. Unfortunately they don't. Cygnal has kind of tied their IDE to the Keil tools, (even though they do support integration of some others), and these use big-endian words.
Can you tell me what the WORDS_BIGENDIAN define in "sdccconf_in.h" does?
WORDS_BIGENDIAN is used to define the endianess of the host, on which SDCC runs.