请问下朋友们 汇编伪指令:.usect 和.def的作用到底是什么呢?
分配好内存后,然后对外发布指针接口吗?但是C文件中,对汇编文件中同样方式定义的变量,一些是声明为指针,一个是声明为变量,但是我在调试仿真状态下,
加载变量,却显示unkonwn。
BLPFC的2Z2P_CTRL文件中有这么一段,就是CNTL_2Z2P_INIT如下
CNTL_2P2Z_INIT .macro n
;=============================
; allocate memory space for data & terminal pointers
_CNTL_2P2Z_Ref:n: .usect "CNTL_2P2Z_Section",2,1,1 ; reference input terminal
_CNTL_2P2Z_Fdbk:n: .usect "CNTL_2P2Z_Section",2,1,1 ; feedback input terminal
_CNTL_2P2Z_Out:n: .usect "CNTL_2P2Z_Section",2,1,1 ; output terminal
_CNTL_2P2Z_Coef:n: .usect "CNTL_2P2Z_Section",2,1,1 ; coefficients & saturation limits (14 words)
_CNTL_2P2Z_DBUFF:n: .usect "CNTL_2P2Z_Section",10,1,1 ; internal Data BUFF
; publish terminal pointers for access from the C environment
.def _CNTL_2P2Z_Ref:n:
.def _CNTL_2P2Z_Fdbk:n:
.def _CNTL_2P2Z_Out:n:
.def _CNTL_2P2Z_Coef:n:
.def _CNTL_2P2Z_DBUFF:n:
; set terminal pointers to ZeroNet
MOVL XAR2, #ZeroNet
MOVW DP, #_CNTL_2P2Z_Ref:n:
MOVL @_CNTL_2P2Z_Ref:n:, XAR2
MOVW DP, #_CNTL_2P2Z_Fdbk:n:
MOVL @_CNTL_2P2Z_Fdbk:n:, XAR2
MOVW DP, #_CNTL_2P2Z_Out:n:
MOVL @_CNTL_2P2Z_Out:n:, XAR2
; zero data buffer
MOVW DP, #_CNTL_2P2Z_DBUFF:n:
MOVL XAR2,#_CNTL_2P2Z_DBUFF:n:
RPT #9 ; 10 times
|| MOV *XAR2++, #0
.endm
C文件声明:最后一个是声明为变量
// CONTROL_2P2Z
extern volatile long *CNTL_2P2Z_Ref1; // instance #1
extern volatile long *CNTL_2P2Z_Out1; // instance #1
extern volatile long *CNTL_2P2Z_Fdbk1; // instance #1
extern volatile long *CNTL_2P2Z_Coef1; // instance #1
extern volatile long CNTL_2P2Z_DBUFF1[5];
Seven Han:
请参考 C28x Assembly Language Tools Users Guide中关于.usect 和.def指令的解释,帮助您理解。