Forum Discussion
Altera_Forum
Honored Contributor
22 years agoNios details from reset to main()
I need to understand the system initialization details. Does the Nios always fetch 1st from the onchip bootstrap area (for a jump), even when you select flash or sram as the reset location? There app...
Altera_Forum
Honored Contributor
22 years agoThe Nios jmp instruction does not expect the register to hold the address to jump to, but rather the address divided by 2 (they are always even and this was probably done to give a larger addressable range for the 16 bit version of Nios).
As a result, the raw bit pattern for function pointers and return addresses on the Nios is the address divided by 2, not the actual address. If you want to display a function pointer as an int, you need to cast it and then double it. Data pointers are just raw addresses and can be casted to ints (or more strictly, unsigned ints) in the expected way. Does this explain what you're seeing?