Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
19 years ago

NIOS little endian or big endian?

Hi,

I have a C application, which was written for an x86 processor (i.e. using little endian) and tried running the given test cases for the application but they failed. I know that the NIOS II architecture uses little endian mode but i read that the object dump listings are in big endian.

Could some please clarify if NIOS II is actually using little endian? Because if not then the code i am running can only be run on an x86 like processor and that is why my test cases are failing. I tried compiling and running the test cases through cygwin not using the NIOS and they all passed because it was using a linux x86 architecture. But then i also used sun solaris box to compile and run my code but the same errors popped up that came when i ran the tests in the NIOS II IDE. Any help will be appreciated.

If its not little endian how can i configure it to little endian?

Thanks,

Khurrum

7 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    originally posted by khurrum@Aug 29 2006, 01:02 PM

    hi,

    i have a c application, which was written for an x86 processor (i.e. using little endian) and tried running the given test cases for the application but they failed. i know that the nios ii architecture uses little endian mode but i read that the object dump listings are in big endian.

    could some please clarify if nios ii is actually using little endian? because if not then the code i am running can only be run on an x86 like processor and that is why my test cases are failing. i tried compiling and running the test cases through cygwin not using the nios and they all passed because it was using a linux x86 architecture. but then i also used sun solaris box to compile and run my code but the same errors popped up that came when i ran the tests in the nios ii ide. any help will be appreciated.

    if its not little endian how can i configure it to little endian?

    thanks,

    khurrum

    <div align='right'><{post_snapback}> (index.php?act=findpost&pid=17936)

    --- quote end ---

    --- Quote End ---

    As I know ,nios is little endian.good luck you can see software referrance.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Also be carefull about the alignment of arrays and elements of structures.

    PC-compilers will normally put arrays on at least 4 byte boundaries, where for nios for example an array of bytes can start for example at 2 byte boundaries.

    You can use the align pragma to change this behaviour. (for members of structures, use packed and align toghether)
  • Hi ZhiqiangLiang,

    To get a quick response, please start a new thread, rather than asking a question on a 20 year old thread.

    I don't understand what you are saying about the typo about endianess

    This graphic illustrates endianness, and it matches what is in words above. Please explain your concern:

    Thanks,

    Sue