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.

[参考译文] TMS320F28027:如何从以汇编语言编写的 ISR 中调用 C 函数?

Guru**** 2522770 points


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

https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1323532/tms320f28027-how-to-call-c-function-from-isr-written-in-assembly

器件型号:TMS320F28027

对于通过汇编语言编写的 ISR 调用的 C 函数、我是否需要执行任何特殊操作?

例如、这样可以吗:

装配

.global _testisr
.global _testfunc

testisr (_T):
LCR _测试 func
NOP
IRET

C

void testfunc()
GpioDataRegs.GPATOGGLE.bit.GPIO1 = 1;

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

    Mark、您好!

    没有问题、只需确保针对汇编代码进行了适当缩进、否则将出现编译器错误:

            .global _testisr
            .global _testfunc
    
    _testisr:
            LCR _testfunc
            NOP
            IRET