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:如何使用 SVC 指令重新启动(来自非特权代码)

Guru**** 2512055 points
Other Parts Discussed in Thread: TM4C123FH6PM

请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1421894/tm4c123fh6pm-how-to-use-the-svc-instruction-to-reboot-from-non-privileged-code

器件型号:TM4C123FH6PM

工具与软件:

我们的应用程序可以自行更新、然后需要重新启动。  

SysCtlReset()调用仅在从特权模式(在中断中为 f.i.)执行时起作用。 为了能够使用它、我要触发一个软件中断。 处理器的数据表在"2.3.1中显示。 处理器模式和软件执行的权限级别"一文中所述、SVC 指令可用于传输到管理员模式。

在提供的示例中、我找不到 SVC (汇编器)指令的用法。 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的解决方案 提到了针对 IAR 编译器的这个指令。

使用的编译器是 ti-cgt-arm_20.2.7_LTS。

命令行: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"。

重新引导功能通过以下方式注册:

IntRegister (FAULT_SVCALL、my_reset_board);

my_reset_board 函数调用 SysCtrlReset 函数:

void my_reset_board()

SysCtlReset();
}

调用 Svc 故障中断的正确指令是什么(不是引导加载程序演示中使用的调用: (*(void (*)(void))(*(uint32_t *) 0x2C))();)?

是否存在使用此编译器的 Svc 指令的示例?

此致、

wim  

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    [报价 userid="460278" url="~/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1421894/tm4c123fh6pm-how-to-use-the-svc-instruction-to-reboot-from-non-privileged-code "]

    SysCtlReset()调用仅在从特权模式(在中断中为 f.i.)执行时起作用。 为了能够使用它、我要触发一个软件中断。 处理器的数据表在"2.3.1中显示。 处理器模式和软件执行的权限级别"一文中所述、SVC 指令可用于传输到管理员模式。

    在提供的示例中、我找不到 SVC (汇编器)指令的用法。

    [报价]

    您好!

     您是否直接尝试过 SVC 汇编指令?  https://developer.arm.com/documentation/dui0473/m/arm-and-thumb-instructions/svc

     下面是在 TI Arm 编译器的 C 代码中嵌入汇编指令的示例。  

     asm (" NOP");

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    感谢您的答复。

    我首先尝试"__asm ("SVC #0");"、但编译器会显示错误:指定了非法助记符。

    呼叫

     _asm (" SVC #0");

    工作正常。 请注意 SVC 前面的空格。