已有的.pjt工程文件,往往有一个.asm文件,.asm文件包含了设置跳转到该程序的c入口点的reset中断(C_int00)所需的汇编指令,还会定义附加的中断向量。
每个DSP处理器都有一个中断源列表,有的是固定的有的是可通过编程修改的。向量表(vector table)又叫做中断服务表(interrupt service table),往往在cmd文件中分配了其存储区。DSP复位,程序加载后,寄存器初始化为默认值,程序计数器(PC)设置为复位向量,同时cpu开始从地址0运行代码,这个位置往往就是复位向量。
每个中断向量的长度是固定的,为8个字。中断向量表以0x400B为边界,因为一共有32个向量,每个向量32B,这样就是0x400B。当移动中断服务表时,中断服务表指针(ISTP)也要相应改变,复位后ISTP保持为0。
?
?
DSP用到的的汇编伪指令查看assembly language tools v7.6 UG.pdf
用到的汇编指令查看tms320c64x64x+ DSP CPU and instruction set refrence guide.pdf
从pdf里搜索的时候这么搜"syntax "
?
?
.def指令在当前模块中定义
.ref指令在当前模块使用在别的模块中定义的符号
.global指令可以是上面任何一种情况
?
?
汇编指令查看tms320c64x64x+ DSP CPU and instruction set refrence guide.pdf
?
.sect
Example:
?
Mvk
?
Zero
LDB:load byte from memory with a 15-bit unsigned constant offset
ADD
B
Cmplt
?
Stb
?
?
?
?
?
?
?
?
?
?
?
bootDSK6455.asm文件内容
.ref _c_int00????????????C入口点
.global RESET_RST????????
?
FLASH_START ????.equ 0xB0000400 ;flash start address????????//In EMIFA boot mode, the bootloader simply branches to the base address of EMIFA CE3 (0xB000 0000).Interrupts are disabled.这个地址 EMIFA_CE3: o = 0xB0000000 l = 0x00800000
CODE_START ????.equ 0x00800400 ;start of non boot code
CODE_SIZE ????.equ 0x0000F000 ;application code size in byte
?
????.sect "vectors"????????????????????????????????//中断服务表
RESET_RST:
?
NOP ; mvkl .S2 _c_int00, B0
NOP ; mvkh .S2 _c_int00, B0
NOP ; 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:
NOP
????NOP
????NOP
????NOP
????NOP
????NOP
????NOP
????NOP
?
INT5:
NOP
????NOP
????NOP
????NOP
????NOP
????NOP
????NOP
????NOP
?
INT6:
NOP
????NOP
????NOP
????NOP
????NOP
????NOP
????NOP
????NOP
?
INT7:
NOP
????NOP
????NOP
????NOP
????NOP
????NOP
????NOP
????NOP
?
INT8:
NOP
????NOP
????NOP
????NOP
????NOP
????NOP
????NOP
????NOP
?
INT9:
NOP
????NOP
????NOP
????NOP
????NOP
????NOP
????NOP
????NOP
?
INT10:
NOP
????NOP
????NOP
????NOP
????NOP
????NOP
????NOP
????NOP
?
INT11:
NOP
????NOP
????NOP
????NOP
????NOP
????NOP
????NOP
????NOP
?
INT12:
NOP
????NOP
????NOP
????NOP
????NOP
????NOP
????NOP
????NOP
?
INT13:
NOP
????NOP
????NOP
????NOP
????NOP
????NOP
????NOP
????NOP
?
INT14:
NOP
????NOP
????NOP
????NOP
????NOP
????NOP
????NOP
????NOP
?
INT15:
NOP
????NOP
????NOP
????NOP
????NOP
????NOP
????NOP
????NOP
?
????.sect "bootload"
????
_boot_start:
mvkl FLASH_START,B4 ;flash start address ->B4
mvkh FLASH_START,B4
????
????mvkl CODE_START,A4 ;apps code start address ->A4
????mvkh CODE_START,A4
????zero A1
????
_boot_loop1:
????ldb *B4++,B5 ; flash read
????mvkl CODE_SIZE-4,B6 ; B6 = BOOT_SIZE -1024
????
????add 1,A1,A1 ;A1+=1,inc outer counter
????|| mvkh CODE_SIZE-4,B6????????//Parallel bars (||) indicate instructions that are in parallel with a previous instruction. You can have up to eight instructions that will be executed in parallel. The following example demonstrates six instructions to be executed in parallel:
????
????cmplt A1,B6,B0
????nop
????stb B5,*A4++
????[B0] b _boot_loop1
????nop 5
????
????mvkl .S2 _c_int00, B0
????mvkh .S2 _c_int00, B0
????B .S2 B0
????nop 5????
?