Hi,
The code for entering “system mode, PSR [4:0] = 11111” works fine on my own board, but crashes on LogicPD L138 experimenter.
I put the following line of code at the beginning line of main() to enter system mode on my own board:
_call_swi(458752);
and the definition for SWI handler is in exceptionhandler.asm which is part of the Starterware:
;******************************************************************************
;* Function Definition of SWI Handler
;******************************************************************************
;
; The SWI Handler switches to system mode if the SWI number is 458752. If the
; SWI number is different, no mode switching will be done. No other SWI are
; handled here
;
SWIHandler:
STMFD r13!, {r0-r1, r14} ; Save context in SVC stack
LDR r0, [r14, #-4] ; R0 points to SWI instruction
BIC r0, r0, #MASK_SWI_NUM ; Get the SWI number
CMP r0, #458752
MRSEQ r1, spsr ; Copy SPSR
ORREQ r1, r1, #0x1F ; Change the mode to System
MSREQ spsr_cf, r1 ; Restore SPSR
LDMFD r13!, {r0-r1, pc}^ ; Restore registers from IRQ stack
On my customized board this (_call_swi(458752)) successfully changed PSR [4:0] to 11111, however on LogicPD experimenter it caused PC to jump to an undefined location (like 0x0155b310 which according is not defined in the memory mapping, see “2.5 Memory Map Summary” of SPRS586C). In addition, it changes PSR [4:0] to 11011 : “Undefined mode”.
Could someone give this a test on the experimenter and give some help?
Paul