How to enable the supervisor mode in the ARMv7 processor?

Hi, at the end of this article RTOS for ARM Cortex-A says:

how could I enable the supervisor mode?, I am using the Vitis IDE from Xilinx for ptogramming the RPU(real time processor unit - cortex R5) with freertos

thanks

This is my first post in reply to another user’s question ! FreeRTOS experts, please correct me if I erred ! Thanks in advance !

FreeRTOSv202112.00\FreeRTOS\Demo\CORTEX_A5_SAMA5D4x_EK_IAR\cstartup_with_FreeRTOS_vectors.s

The above file does it like this:

#define ARM_MODE_SVC     0x13


#define I_BIT            0x80
#define F_BIT            0x40


MSR     CPSR_c, #(ARM_MODE_SVC | F_BIT | I_BIT)

FreeRTOSv202112.00\FreeRTOS\Demo\CORTEX_R5_UltraScale_MPSoC\RTOSDemo_R5_bsp\psu_cortexr5_0\libsrc\standalone_v6_6\src\boot.S

The above file does it like this:

	mrs	r0, cpsr			/* get the current PSR */
	mvn	r1, #0x1f			/* set up the supervisor stack pointer */
	and	r2, r1, r0
	orr	r2, r2, #0x13		/* supervisor mode */
	msr	cpsr, r2

1 Like

Thanks Siddhartha.

As Siddhartha points out, the examples in the FreeRTOS download (for all supported architectures, not just Cortex-R) are always a good first reference point.

1 Like