Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12589 Discussions

eret does not update registers properly.

Altera_Forum
Honored Contributor II
1,014 Views

Hi, 

 

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. 

 

Thanks! 

 

[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
Reply