⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sndboot.asm

📁 一个在DSP上执行的flash的烧写程序
💻 ASM
字号:
             .title  "Secondary Flash bootup utility for DM642 EVM"
            .option D,T
            .length 102
            .width  140

SND_COPY_TABLE  .equ    0x90000000
FLASH_PAGE_COUNT  .equ	0x80000
FLASH_PAGE_START	.equ	0X90000000
FLASH_ADRESS		.equ	0X90080018
FLASH_PAGE_BITS		.equ	0X380000

;            .text
            .sect ".snd_boot_load"
            .global _sndboot
            .global _next_page

_sndboot:      
;************************************************************************
;* Debug Loop -  Comment out B for Normal Operation
;************************************************************************

            zero B1
_mysndloop:  ; [!B1] B _mysndloop  
            nop  5
_mysndloopend: nop


;****************************************************************************
;* Copy code sections
;****************************************************************************
        zero b7       ;******initial address register
        zero b6       ;******
        add 	2,b6,b6;*******
        mvkl  FLASH_PAGE_BITS, b7   
        mvkh  FLASH_PAGE_BITS, b7
        mvkl  FLASH_ADRESS, b4   ; load flash page pointer
        mvkh  FLASH_ADRESS, b4
        mvkl  SND_COPY_TABLE, a3   ; load table pointer
        mvkh  SND_COPY_TABLE, a3

        ldw   *a3++, b1        ; Load entry point

snd_copy_section_top:
 		 and   b7,a3,b2   ;******compare the address is bottom of page or not 
 [b2]	call  _next_page	   ;******
        MVKL     return1, B3
        MVKH     return1, B3
 		nop 	3	   ;******	
 		
return1: 			
        ldw   *a3++, b0        ; byte count 
        
        and   b7,a3,b2   ;******compare the address is bottom of page or not 
 [b2]	call  _next_page	   ;******
        MVKL     return2, B3
        MVKH     return2, B3
 		nop 	3	   ;******	
return2:	
 	
        ldw   *a3++, a4        ; ram start address
        
 [!b0]  b snd_copy_done            ; have we copied all sections?
        nop   5

snd_copy_loop:
		and   b7,a3,b2   ;******compare the address is bottom of page or not 
 [b2]	call  _next_page
 		MVKL     return3, B3
        MVKH     return3, B3
 		nop 	3	   ;******	
return3:
        ldb   *a3++,b5
        
		sub   b0,1,b0          ; decrement counter
        
 [ b0]  b     snd_copy_loop        ; setup branch if not done
 [!b0]  b     snd_copy_section_top
        zero  a1
 [!b0]  and   3,a3,a1
        stb   b5,*a4++
 [!b0]  and   -4,a3,a5         ; clear last two bits
 [ a1]  add   4,a5,a3          ; round address up to next multiple of 4
; every start of section'address  must be multiple of 4
;so when in a section a1=0,the next address+1,but when in the bottem of a section,
;current address&&-4(fffc)+4=next address
;****************************************************************************
;* Jump to entry point
;****************************************************************************
snd_copy_done:
        b    .S2 b1
        nop   5

;******************************************
;turn to next page
;******************************************
_next_page:
	
		mvkl  FLASH_PAGE_START, a3   ; load table pointer
        mvkh  FLASH_PAGE_START, a3	
        add  b6,1,b6
        stw	 b6,*b4
        zero b2 
        b    b3
        nop  5
        

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -