This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Part Number: HERCULES_SAFETY_MCU_DEMOS
Hi All,
I am working on SafeTI diagnostic library with RTOS. The MCU we are using is TMS570LC43xx .
I am facing some problem that
Before main function (" _c_int00() and afterSTC()") all the initialization done in Supervisor mode "ARM_MODE_SVC 0x13". But for initialization of RTOS schedular we need to run processor in system mode "ARM_MODE_SYS 0x1F".
I have tried to change from SVC to system mode but the code is going to reset SWRST. i have tried to change in SL_Init_R5Registers(); and SL_Init_StackPointers(); also. but no result.
Q1. How we can change mode from supervisor mode "ARM_MODE_SVC 0x13" to system mode "ARM_MODE_SYS 0x1F".
Q2. After switching from supervisor mode "ARM_MODE_SVC 0x13" to system mode "ARM_MODE_SYS 0x1F", can we run all the SL test cases in TASK?
Thanks and regard
Pankaj Verma
Hi Pankaj Verma,
Can you please refer below thread and attached code in the below thread
In this thread i switched modes in FreeRTOS code.
--
Thanks & regards,
Jagadish.
HI Jagdish,
I have tried by using assembly instruction to change the processor mode
.def _CPU_system_mode_Switch
.asmFunc
_CPU_system_mode_Switch
MRS r0, CPSR ;read cpsr into r0
orr r0, r0, #0x1f ; set mode to SYS
MSR CPSR, r0 ; write r0 back to cpsr
bx lr ; return
.endasmfunc
After execution of this instruction system is going to reset condition and MCU System register shows SWRST.
I think we need to change in below section also using __SVC "Can you share me the code to switching mode, u tired previously"
.ref _c_int00
.ref vUndefAbort
.ref vSafeRTOSSVCHandler
.ref vPrefetchAbort
.ref vDataAbort
.ref phantomInterrupt
.def resetEntry
;-------------------------------------------------------------------------------
; interrupt vectors
resetEntry
b _c_int00
b vUndefAbort
b vSafeRTOSSVCHandler
b vPrefetchAbort
b vDataAbort
b phantomInterrupt
ldr pc,[pc,#-0x1b0]
ldr pc,[pc,#-0x1b0]
Thanks
Pankaj Verma
Hi Pankaj,
Please refer the below attached code in my previous shared thread:
If you verify code here i am calling below two lines to switch mode to supervisor mode
register uint32_t u32Mode = 0x13ul; /* Supervisor */
u32Mode = switchCpuMode(u32Mode);
We passed Mode value as 0x13 because you can see the mode value of the supervisor mode.
So similarly, you can pass your required mode value to the above function.
--
Thanks & regards,
Jagadish.
HI Jagadish,
I appreciate your efforts.
Got it i will try and update you.
But parallelly, i am facing some more issues.
Can you please answer this thread.
Thanks
Pankaj Verma
Hi Pankaj,
I will answer the thread you mentioned and i am closing this thread.
--
Thanks & regards,
Jagadish.