Hi all,
I am actually preparing some exercises on a M52259Demo and encountered an issue for the user mode demonstration program.
The complete program simulates a user mode operating system trap call, using the user stack for parameter passing. So I set up a code like this to create an user stack an switch to user mode:
asm {
The code warrior register panel reflects 0x0704 as SR register value, which should be the non-supervisor mode, plus the correct address pointing to my user stack as OTHER_A7. But when I push the pointer to "counter" via the pea command, it pushes it onto the supervisor stack.
I verified the user mode, via the following putchar commands. Those are blocked in the user mode after reset state and perform correct using MCF_SCM_PACR2 |= 0x60, so I guess the switch to user mode performs correct.
I received the code from an old example (target processor 68030 embedded system, so I guess the code performed correct on the old system.
The simplified project, including the code example should be attached to this post.
Any help would be very much appreciated ![]()
BR,
mike aka modEmMaik
To enable usage of user stack you should enable it in CACR register of processor - bit 4 - EUSP.