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.

TM4C123FH6PM: How to use the SVC instruction to reboot (from non privileged code)

Part Number: TM4C123FH6PM


Tool/software:

Our application can update itself and then needs to restart. 

The SysCtlReset() call only works when it is executed from privileged mode (f.i. in an interrupt). In order to be able to use it, I would like to trigger a software interrupt. The datasheet of the processor indicates in chapter "2.3.1. Processor Mode and Privilege Levels for Software Execution" that the SVC instruction can be used to make a transfer to supervisor mode.

In the provided examples I can't find a use of the SVC (assembler) instruction. The solution of post https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/891449/tm4c1294ncpdt-how-to-call-the-svcall-fault-in-ti-rtos-on-tm4c/3297279?tisearch=e2e-sitesearch&keymatch=svc%20tm4c#3297279 mentions this instruction for an IAR compiler.

The compiler used is the ti-cgt-arm_20.2.7_LTS.

Command line: C:/ti/ccs1240/ccs/tools/compiler/ti-cgt-arm_20.2.7.LTS/bin/armcl" -mv7M4 --code_state=16 --float_support=FPv4SPD16 -me -O2 --include_path="..."  ... --define=PART_TM4C123FH6PM --define=ccs="ccs" --define=TARGET_IS_TM4C123_RB2 --gcc --diag_warning=225 --diag_wrap=off --display_error_number --abi=eabi --preproc_with_compile --preproc_dependency="main.d_raw" "../main.c""

The reboot function is registered with:

IntRegister(FAULT_SVCALL, my_reset_board);

The function my_reset_board calls the SysCtrlReset function:

void my_reset_board()
{
SysCtlReset();
}

What is the correct instruction to call the svc fault interrupt (not the call used in the bootloader demo: (*((void (*)(void))(*(uint32_t *)0x2c)))();) ?

Does an example exist for the use of the svc instruction for this compiler?

Best regards,

Wim