Forum Discussion
Altera_Forum
Honored Contributor
20 years agoNIOS 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, Khurrum7 Replies
- Altera_Forum
Honored 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
Honored 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) - ZhiqiangLiang
Occasional Contributor
- ZhiqiangLiang
Occasional Contributor
- SueC_Altera
Contributor
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
- ZhiqiangLiang
Occasional Contributor
https://www.intel.com/content/www/us/en/docs/programmable/683689/current/endianness.html
Sorry, I misunderstood the logic. I withdraw my comments.
- SueC_Altera
Contributor
No worries. I'm glad we got it sorted out!
Sue