macro分析:
unused .macro id
.global unused:id:
unused:id:
b unused:id: ; nested branches to block interrupts
nop 4
b unused:id:
nop
nop
nop
nop
nop
.endm
spru186q:TMS320C6000 Assembly Language Tools v 6.1
此外,build option中的-al选项可以得到asm文件的lst文件,可以查看完全展开后的结果。
例1:vectors.asm(DSP原理及其C编程开发技术 光盘\dsp\loop_intr)
*Vectors_11.asm Vector file for interrupt-driven program
.ref _c_int11 ;ISR used in C program
.ref _c_int00 ;entry address
.sect "vectors" ;section for vectors
RESET_RST: mvkl .S2 _c_int00,B0 ;lower 16 bits --> B0
mvkh .S2 _c_int00,B0 ;upper 16 bits --> B0
B .S2 B0 ;branch to entry address
NOP ;NOPs for remainder of FP
NOP ;to fill 0x20 Bytes
NOP
NOP
NOP
NMI_RST: .loop 8
NOP ;fill with 8 NOPs
.endloop
RESV1: .loop 8
NOP
.endloop
RESV2: .loop 8
NOP
.endloop
INT4: .loop 8
NOP
.endloop
INT5: .loop 8
NOP
.endloop
INT6: .loop 8
NOP
.endloop
INT7: .loop 8
NOP
.endloop
INT8: .loop 8
NOP
.endloop
INT9: .loop 8
NOP
.endloop
INT10: .loop 8
NOP
.endloop
INT11: b _c_int11 ;branch to ISR
.loop 7
NOP
.endloop
INT12: .loop 8
NOP
.endloop
INT13: .loop 8
NOP
.endloop
INT14: .loop 8
NOP
.endloop
INT15: .loop 8
NOP
.endloop
例2:vectors.asm(CCStudio_v3.3\tutorial\sim64xx\volume1)
;
; Copyright 2003 by Texas Instruments Incorporated.
; All rights reserved. Property of Texas Instruments Incorporated.
; Restricted rights to use, duplicate or disclose this code are
; granted through contract.
;
;
; "@(#) DSP/BIOS 4.90.270 01-13-05 (barracuda-o07)"
;
; ======== vectors.asm ========
; Plug in the entry point at RESET in the interrupt vector table
;
;
; ======== unused ========
; plug inifinite loop -- with nested branches to
; disable interrupts -- for all undefined vectors
;
unused .macro id
.global unused:id:
unused:id:
b unused:id: ; nested branches to block interrupts
nop 4
b unused:id:
nop
nop
nop
nop
nop
.endm
.sect ".vectors"
.ref _c_int00 ; C entry point
.align 32*8*4 ; must be aligned on 256 word boundary
RESET: ; reset vector
mvkl _c_int00,b0 ; load destination function address to b0
mvkh _c_int00,b0
b b0 ; start branch to destination function
mvc PCE1,b0 ; address of interrupt vectors
mvc b0,ISTP ; set table to point here
nop 3 ; fill delay slot
nop
nop
;
; plug unused interrupts with infinite loops to
; catch stray interrupts
;
unused 1
unused 2
unused 3
unused 4
unused 5
unused 6
unused 7
unused 8
unused 9
unused 10
unused 11
unused 12
unused 13
unused 14
unused 15
PCE1:program counter(spru186q)
例3:vecs.asm(DEC6713_EDMA)
*********************************************************************************
* vecs.asm
* Copyright 2003 by SEED Electronic Technology Ltd.
* All rights reserved. Property of SEED Electronic Technology Ltd. *
* Designed by: Hongshuai.Li *
*********************************************************************************
*------------------------------------------------------------------------------
* Global symbols defined here and exported out of this file
*------------------------------------------------------------------------------
.global _vectors
.global _c_int00
.global _vector1
.global _vector2
.global _vector3
.global _vector4
.global _vector5
.global _vector6
.global _vector7
.global _c_int08 ; Hookup the c_int08 ISR in main()
.global _vector9
.global _vector10
.global _vector11
.global _vector12
.global _vector13
.global _vector14
.global _vector15
*------------------------------------------------------------------------------
* Global symbols referenced in this file but defined somewhere else.
* Remember that your interrupt service routines need to be referenced here.
*------------------------------------------------------------------------------
.ref _c_int00
*------------------------------------------------------------------------------
* This is a macro that instantiates one entry in the interrupt service table.
*------------------------------------------------------------------------------
VEC_ENTRY .macro addr
STW B0,*--B15
MVKL addr,B0
MVKH addr,B0
B B0
LDW *B15++,B0
NOP 2
NOP
NOP
.endm
*------------------------------------------------------------------------------
* This is a dummy interrupt service routine used to initialize the IST.
*------------------------------------------------------------------------------
_vec_dummy:
B B3
NOP 5
*------------------------------------------------------------------------------
* This is the actual interrupt service table (IST). It is properly aligned and
* is located in the subsection .text:vecs. This means if you don't explicitly
* specify this section in your linker command file, it will default and link
* into the .text section. Remember to set the ISTP register to point to this
* table.
*------------------------------------------------------------------------------
.sect ".text:vecs"
.align 1024
_vectors:
_vector0: VEC_ENTRY _c_int00 ;RESET
_vector1: VEC_ENTRY _vec_dummy ;NMI
_vector2: VEC_ENTRY _vec_dummy ;RSVD
_vector3: VEC_ENTRY _vec_dummy
_vector4: VEC_ENTRY _vec_dummy
_vector5: VEC_ENTRY _vec_dummy
_vector6: VEC_ENTRY _vec_dummy
_vector7: VEC_ENTRY _vec_dummy
_vector8: VEC_ENTRY _c_int08 ; Hookup the c_int08 ISR in main()
_vector9: VEC_ENTRY _vec_dummy
_vector10: VEC_ENTRY _vec_dummy
_vector11: VEC_ENTRY _vec_dummy
_vector12: VEC_ENTRY _vec_dummy
_vector13: VEC_ENTRY _vec_dummy
_vector14: VEC_ENTRY _vec_dummy
_vector15: VEC_ENTRY _vec_dummy
*------------------------------------------------------------------------------
********************************************************************************
* End of vecs.asm
********************************************************************************
注:B3 寄存器在C6000用于存储函数返回的地址。