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.

TMS320C6655: 如何把中断服务程序加载到ISTP中?(不使用库函数)

Part Number: TMS320C6655

因项目的特殊性,不能使用csl库函数。

环境:第三方开发板DSP C6655,ccs5.5,win11 64bit。

目标:EMAC发送一帧网络数据后,进入发送结束中断服务程序。

目前进度:EMAC发送一帧数据后,CPU INT4已置位(IFR bit4)。

查询了TI处理器论坛,其中一个帖子中给出了方法,下载了vectors.asm并拷贝到项目的目录下。

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/41441/how-to-initialize-the-interrupt-service-table

配置了vectors.asm进入INT4的入口,编译后发现如下错误。


Vectors.asm如下:


.ref _c_int00
.ref _EAMC_TX_Complete

.sect "vectors"

; tell assembler not to use 16-bit compact instructions
; or else the vectors will not reside properly in memory
; (applies to entire section in which it is contained)
.nocmp

RESET_RST:
mvkl .S2 _c_int00, B0
mvkh .S2 _c_int00, B0
B .S2 B0
NOP
NOP
NOP
NOP
NOP
NMI_RST:
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP

RESV1:
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP

RESV2:
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP

INT4:
stw b0,*b15--[2]                                   ; temp save b0 on stack
mvkl _EAMC_TX_Complete,b0          ; load destination address to b0
mvkh _EAMC_TX_Complete,b0
b b0                                                     ; start branch to destination
ldw *++b15[2],b0                                 ; restore b0 register
nop 2                                                   ; fill 2 of b0 restore delay slots
nop                                                      ; fill delay slot, pad packet
nop                                                       ; fill delay slot, pad packet

EAMC_TX_Complete是希望进入的中断服务函数,声明为:interrupt void EAMC_TX_Complete(void),该函数不在main.c中(应该不是问题的原因)。

cmd文件如下:

问题:

1、下载的vectors.asm拷贝到项目的目录下,在ccs中能直接查看,应该是已经加入到项目中了,该理解是否正确?

2、Vectors.asm和cmd的配置哪里有错?

谢谢!

  • 我按照TI论坛另外一个帖子,用intvecs.asm替换掉vectors.asm,同时中断函数更改为  interrupt void c674x_mask_int4_isr(void),编译过程中没有报错。但貌似未进入中断处理函数,虽然INT4已经置位。请问:还有其他条件需要设置吗?

    intvecs.asm

  • c66x的中断和C674x的中断不一样,请参加附件的keystone INTC架构的介绍。除了配置INTC,还需要配置CIC chip level事件映射。建议还是直接调用TI的csl库来写,自己从汇编写比较麻烦。

    6683.Configuring Interrupts on Keystone Devices.pdf

  • c674x_mask_int4_isr只是中断服务函数的名字,可以任意修改,与处理器型号无关。

    本人理解:EMAC TX INT作为94号System Event可以直接进入CPU Interrupt Controller,不一定要通过CIC。

    麻烦TI专家确认下该理解是否正确。谢谢!

  • 您的理解正确,EMAC TX INT可以作为Primary events进入INTC中断控制器,最后映射到12个CPU 中断。

  • 我现在碰到的问题:

    EMAC TX INT作为94号Primary events已进入INTC中断控制器(Event flag register 2, bit 30已经置位)。另外,我禁止了Event Combiner by setting the Event Mask Register all 1s.

    INTMUX1中设置INTSEL4写入Event No. 94,同时,使能INT4,NMI和全局中断允许,但IFR bit4不置位。

    请问:这些设置足够了嘛?

  • 查了很多资料,尝试了把intvecs.asm中的中断服务函数的地址赋给ISTP,但提示报错:identifier "_intcVectorTable" is undefined

    ISTP = (unsigned int)_intcVectorTable;

    请教:如何把让C语言可以获取intvecs.asm汇编中的全局变量?

    ;**********************************************************
    ;				Global Symbols
    ;**********************************************************
    	.global _intcVectorTable
    	.ref __c_int00
    	.global _c674x_nmi_isr
    	.global _c674x_rsvd_int2_isr
    	.global _c674x_rsvd_int3_isr
    	.global _c674x_mask_int4_isr
    	.global _c674x_mask_int5_isr
    	.global _c674x_mask_int6_isr
    	.global _c674x_mask_int7_isr
    	.global _c674x_mask_int8_isr
    	.global _c674x_mask_int9_isr
    	.global _c674x_mask_int10_isr
    	.global _c674x_mask_int11_isr
    	.global _c674x_mask_int12_isr
    	.global _c674x_mask_int13_isr
    	.global _c674x_mask_int14_isr
    	.global _c674x_mask_int15_isr
    
    ;**********************************************************
    ;				Interrupt Fetch Packet
    ;**********************************************************
    VEC_ENTRY .macro addr
    	STW B0,*--B15
    	MVKL addr,B0
    	MVKH addr,B0
    	B B0
    	LDW *B15++,B0
    	NOP 2
    	NOP
    	NOP
    	.endm
    
    ;**********************************************************
    ;				Interrupt Vector Table
    ;**********************************************************
    	.align 1024
    _intcVectorTable:
    	VEC_ENTRY __c_int00
    	VEC_ENTRY _c674x_nmi_isr
    	VEC_ENTRY _c674x_rsvd_int2_isr
    	VEC_ENTRY _c674x_rsvd_int3_isr
    	VEC_ENTRY _c674x_mask_int4_isr
    	VEC_ENTRY _c674x_mask_int5_isr
    	VEC_ENTRY _c674x_mask_int6_isr
    	VEC_ENTRY _c674x_mask_int7_isr
    	VEC_ENTRY _c674x_mask_int8_isr
    	VEC_ENTRY _c674x_mask_int9_isr
    	VEC_ENTRY _c674x_mask_int10_isr
    	VEC_ENTRY _c674x_mask_int11_isr
    	VEC_ENTRY _c674x_mask_int12_isr
    	VEC_ENTRY _c674x_mask_int13_isr
    	VEC_ENTRY _c674x_mask_int14_isr
    	VEC_ENTRY _c674x_mask_int15_isr
    

  • Event flag register 2, bit 30已经置位

    IFR没有置位和中断向量表没有关系。event flag标志位置1了,说明事件发生了。代码是core0的吧? 初始化代码执行后,到ccs里看一下Event Mask Register是否都置1了?INTMUX1.INTSEL4位的值是否是94?

  • Event Flag标志位已置1,94号EMAC TX事件确实已经发生,看过寄存器的内容:Event Mask Register都置1,INTMUX1.INTSEL4位的值是94,因此寄存器配置没问题。

    我现在不去纠结IFR的是否置位,现在想编写相应的中断处理函数。在理解的基础上,拷贝了中断初始化函数Intc_Init(),如下:

    void Intc_Init (void)
    {
        unsigned int step = 0;
    
        /* Set ISRs to default "do-nothing" routine */
        while(step != C674X_INT_COUNT)
            c674xISRtbl[step++] = IntDefaultHandler;
    
        /* Set interrupt service table pointer to the vector table */
        ISTP = (unsigned int)intcVectorTable;
    
        /* Clear pending CPU maskable interrupts (if any) */
        ICR = 0xFFF0;
    
        /* Enable NMIE bit to allow CPU maskable interrupts */
        IER = (1 << C674X_NMI);
    }

    编译后出现错误,提示如下:

    Description	Resource	Path	Location	Type
    #10010 errors encountered during linking; "LEDTest.out" not built	LEDTest		 	C/C++ Problem
    <a href="file:/C:/ti/ccsv5/tools/compiler/dmed/HTML/10234.html">#10234-D</a>  unresolved symbols remain	LEDTest		 	C/C++ Problem
    unresolved symbol intcVectorTable, first referenced in ./Ethernet/csl_interrupt.obj	LEDTest		 	C/C++ Problem
    

    个人判断:把向量中断表格赋值给ISTP的语句出现错误

         ISTP= (unsigned int)intcVectorTable;

    intcVectorTable是在intvecs.asm定义的全局变量,在C源文件声明为 extern void intcVectorTable(void),感觉C源文件没有引用汇编语言中的全局变量,导致报错。

    找了一圈资料,没有解释后台的运行机制,大部分都是调用现成的函数,但本人想理解中断过程,貌似就差临门一脚了。

  • 请尝试把intvecs.asm里_intcVectorTable前面的下划线去掉。

  • Hello Shine,

    非常感谢这个建议。把函数前面的下划线去掉,另外c_int00前面只留一条下划线,编译通过。目前也能进ISR。

    感谢啊~~

  • 不客气, 应该的~

    非常高兴您的问题解决了。