Forum Discussion
Altera_Forum
Honored Contributor
8 years agoNios - II memory alignment issue while accessing integer from non word align location
- Using Nios-II with eclipse. While accessing integer(32 bit) form non word align location getting incorrect value as described in below example. - Tested with eclipse version 13 and 16, both are...
Altera_Forum
Honored Contributor
8 years agoThis is not due to Eclipse, it is a limitation of the Nios II architecture that does not support unaligned accesses.
But anyway, please note that using an unaligned pointer accesses is "undefined behaviour" in the C standard, so your code could return anything and still be 100% correct according to the C standard. This kind of construct is not portable because it can work on some architectures and not on others. It could even work on some compilers and not others.