Nios® II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
Intel Support hours are Monday-Fridays, 8am-5pm PST, except Holidays. Thanks to our community members who provide support during our down time or before we get to your questions. We appreciate you!

Need Forum Guidance? Click here
Search our FPGA Knowledge Articles here.
12369 Discussions

eret does not update registers properly.

Honored Contributor I



I'm using Shadow Registers with VIC on NIOS II f core. I am trying to use shadow registers both for interrupts and non-interrupt threads. I have 5 interrupts and 64 shadow registers enabled in my system. 


When my system takes an interrupt, the shadow register set gets activated and using an eret after processing the interrupt works fine. 


The problem occurs when I'm in a shadow register set that's not associated with interrupt and I try to return to base register set (reg. set 0) as described in "Changing Register Sets" section on processor handbook. As recommended, I am loading r30 (since I'm in shadow register) with desired CRS and executing eret. This returns the control to the address specified in ea register and updates the status register but no other register is modified/restored. This is causing stack corruption since sp isn't getting updated either.  


Am I missing something? Any pointers are appreciated. 




[Update] It looks like this problem occurs only when trying to jump to base register set (reg. set 0 in my case) from a shadow register. Does this need to be treated as a special case?
0 Kudos
0 Replies