about Keil MDK "step-out" in debug mode

Hi

I use ULINK2 to debug S3C2440. I notice that the start-up code provided by Keil S3C2440.s, it change the cpu mode one by one to setup the stack, and finally enter the user mode then jump to the C code:

; Setup Stack for each mode ----------------------------------------------------

                LDR     R0, =Stack_Top
                MOV     SP, R0

;  Enter Undefined Instruction Mode and set its Stack Pointer
                MSR     CPSR_c, #Mode_UND:OR:I_Bit:OR:F_Bit
                MOV     SP, R0
                SUB     R0, R0, #UND_Stack_Size

;  Enter Abort Mode and set its Stack Pointer
                MSR     CPSR_c, #Mode_ABT:OR:I_Bit:OR:F_Bit
                MOV     SP, R0
                SUB     R0, R0, #ABT_Stack_Size

;  Enter FIQ Mode and set its Stack Pointer
                MSR     CPSR_c, #Mode_FIQ:OR:I_Bit:OR:F_Bit
                MOV     SP, R0
                SUB     R0, R0, #FIQ_Stack_Size

;  Enter IRQ Mode and set its Stack Pointer
                MSR     CPSR_c, #Mode_IRQ:OR:I_Bit:OR:F_Bit
                MOV     SP, R0
                SUB     R0, R0, #IRQ_Stack_Size

;  Enter Supervisor Mode and set its Stack Pointer
                MSR     CPSR_c, #Mode_SVC:OR:I_Bit:OR:F_Bit
                MOV     SP, R0
                SUB     R0, R0, #SVC_Stack_Size

;  Enter User Mode and set its Stack Pointer
                MSR     CPSR_c, #Mode_USR
                MOV     SP, R0
                SUB     SL, SP, #USR_Stack_Size

;  Enter User Mode and set its Stack Pointer
                MSR     CPSR_c, #Mode_USR
                IF      :DEF:__MICROLIB

                EXPORT __initial_sp

                ELSE

                MOV     SP, R0
                SUB     SL, SP, #USR_Stack_Size

                ENDIF

; Enter the C code -------------------------------------------------------------

                IMPORT  __main
                LDR     R0, =__main
                BX      R0

but in my application i don't want to enter the user-mode before jump to the C code becase i need to do some MMU operation in the main() function. so i modified the S3C2440.s as follow:

;  Enter Supervisor Mode and set its Stack Pointer
                MSR     CPSR_c, #Mode_SVC:OR:I_Bit:OR:F_Bit
                MOV     SP, R0
                SUB     R0, R0, #SVC_Stack_Size

;-----------------------------------------------------------
;  Not Enter User Mode and set its Stack Pointer
;                MSR     CPSR_c, #Mode_USR
;                MOV     SP, R0
;                SUB     SL, SP, #USR_Stack_Size
;-----------------------------------------------------------

;  Enter User Mode and set its Stack Pointer
                MSR     CPSR_c, #Mode_USR
                IF      :DEF:__MICROLIB

                EXPORT __initial_sp

                ELSE

                MOV     SP, R0
                SUB     SL, SP, #USR_Stack_Size

                ENDIF

; Enter the C code -------------------------------------------------------------

                IMPORT  __main
                LDR     R0, =__main
                BX      R0

My program works well, but when i debug the code, it seems that the "Step-Out" function provided by the Keil IDE do not work, the program did not stop in the next instruction after one function return, it just continue running until i press the "Stop" button or insert a new breakpoint. But this did not happen in the original version of S3C2440.s without my modification.

Is there anything wrong in my code?

Any suggestion will be appreciated!

Eric

More questions in this forum