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

📄 boot.lis

📁 cypress 的PSOC DESIGNER 4.4如何在C语言中调用汇编程序.
💻 LIS
📖 第 1 页 / 共 5 页
字号:
 00F8           SILICON_ID_1:						equ		 F8h   ; first byte of silicon ID
 00F9           SILICON_ID_0:						equ		 F9h   ; second byte of silicon ID
 00F8           VOLTAGE_TRIM_3V:					equ		 F8h   ; 3.3V internal voltage reference trim value
 00F9           OSCILLATOR_TRIM_3V:					equ		 F9h   ; 3.3V internal main oscillator trim value
 00FC           VOLTAGE_TRIM_5V:					equ		 FCh   ; 5V internal voltage reference trim value
 00FD           OSCILLATOR_TRIM_5V:					equ		 FDh   ; 5V internal main oscillator trim value
 0000           ;-----------------------------------------------------------------------------
 0000           ;  MACRO NAME: SSC_Action
 0000           ;
 0000           ;  DESCRIPTION:
 0000           ;     Performs locally defined supervisory operations.
 0000           ;     Macro Instantiation: SSC_Action bOperation
 0000           ;
 0000           ;     !!! DO NOT CHANGE THIS CODE !!!
 0000           ;        This sequence of opcodes provides a 
 0000           ;        signature for the debugger and ICE.
 0000           ;     !!! DO NOT CHANGE THIS CODE !!!
 0000           ;
 0000           ;  ARGUMENTS:
 0000           ;     BYTE  bOperation   - specified supervisory operation - defined operations
 0000           ;                          are:  FLASH_WRITE, FLASH_ERASE, FLASH_READ, TABLE_READ,
 0000           ;                                FLASH_CHECKSUM, PROTECT_BLOCK
 0000           ;
 0000           ;  RETURNS:
 0000           ;     none.
 0000           ;
 0000           ;  SIDE EFFECTS:
 0000           ;     A and X registers are destroyed
 0000           ;
 0000           ;  PROCEDURE:  
 0000           ;     1) specify a 3 byte stack frame.  Save in [KEYSP]
 0000           ;     2) insert the flash Supervisory key in [KEY1]
 0000           ;     3) store function code in A
 0000           ;     4) call the supervisory code
 0000           ;-----------------------------------------------------------------------------
 0000           macro SSC_Action  
 0000                 mov   X, SP                         ; copy SP into X
 0000                 mov   A, X                          ; mov to A
 0000                 add   A, 3                          ; create 3 byte stack frame
 0000                 mov   [bSSC_KEYSP], A               ; save stack frame for supervisory code
 0000                 mov   [bSSC_KEY1], OPER_KEY                 ; load the supervisory code for supervisory operations
 0000                 mov   A, @0                         ; load A with specific Flash operation
 0000                 SSC                                 ; SSC call the supervisory code
 0001           C_LANGUAGE_SUPPORT: equ 1   ;Set to 0 to optimize for ASM only
 0000           
 0000           ;-----------------------------------------------------------------------------
 0000           ; The following equate is required for proper operation. Reseting its value
 0000           ; is discouraged.
 0000           ;-----------------------------------------------------------------------------
 0000           
 0001           WAIT_FOR_32K: equ 1         ; Wait for Crystal to start before allowing main()
 0000                                       ; Is effective only if the crystal oscillator is 
 0000                                       ; selected.  If the designer choses to not WAIT,
 0000                                       ; then the ECO and PLL_Lock process must be taken
 0000                                       ; care of with user code. 
 0000           
 0000           ;-----------------------------------------------------------------------------
 0000           ; Export Declarations
 0000           ;-----------------------------------------------------------------------------
 0000           
                export __Start
                export __Exit
                export __bss_start
                
                export __lit_start
                export __idata_start
                export __data_start
                export __func_lit_start
                export __text_start
                
                
                ;-----------------------------------------------------------------------------
                ; Interrupt Vector Table
                ;-----------------------------------------------------------------------------
                ;
                ; Interrupt vector table entries are 4 bytes long and contain the code
                ; that services the interrupt (or causes it to be serviced).
                ;
                ;-----------------------------------------------------------------------------
                
                
                    AREA    TOP(ROM, ABS)
                
                    org 0                   ;Reset Interrupt Vector
 0000 803F          jmp __Start             ;First instruction executed following a Reset
 0002           
                    org 04h                 ;Supply Monitor Interrupt Vector
 0004 30            halt                    ;Stop execution if power falls too low
 0005 7E            reti
 0006           
                    org 08h                 ;PSoC Block DBA00 Interrupt Vector
                    // call     void_handler
 0008 7E            reti
 0009           
                    org 0Ch                 ;PSoC Block DBA01 Interrupt Vector
                    // call     void_handler
 000C 7E            reti
 000D           
                    org 10h                 ;PSoC Block DBA02 Interrupt Vector
                    // call     void_handler
 0010 7E            reti
 0011           
                    org 14h                 ;PSoC Block DBA03 Interrupt Vector
                    // call     void_handler
 0014 7E            reti
 0015           
                    org 18h                 ;PSoC Block DCA04 Interrupt Vector
                    // call     void_handler
 0018 7E            reti
 0019           
                    org 1Ch                 ;PSoC Block DCA05 Interrupt Vector
                    // call     void_handler
 001C 7E            reti
 001D           
                    org 20h                 ;PSoC Block DCA06 Interrupt Vector
                    // call     void_handler
 0020 7E            reti
 0021           
                    org 24h                 ;PSoC Block DCA07 Interrupt Vector
                    // call     void_handler
 0024 7E            reti
 0025           
                    org 28h                 ;Analog Column 0 Interrupt Vector
                    // call     void_handler
 0028 7E            reti
 0029           
                    org 2Ch                 ;Analog Column 1 Interrupt Vector
                    // call     void_handler
 002C 7E            reti
 002D           
                    org 30h                 ;Analog Column 2 Interrupt Vector
                    // call     void_handler
 0030 7E            reti
 0031           
                    org 34h                 ;Analog Column 3 Interrupt Vector
                    // call     void_handler
 0034 7E            reti
 0035           
                    org 38h                 ;GPIO Interrupt Vector
                    // call     void_handler
 0038 7E            reti
 0039           
                    org 3Ch                 ;Sleep Timer Interrupt Vector
                    // call     void_handler
 003C 7E            reti
 003D           
 003D           ;-----------------------------------------------------------------------------
 003D           ;  Start of Execution
 003D           ;  CPU is operating at 3 MHz, change to 12 MHz
 003D           ;  IO Bank is Bank0
 003D           ;-----------------------------------------------------------------------------
                    org 40h
 0040           __Start:
 0040 55F800        mov [bSSC_KEY1] ,0      ;Lockout Flash and Supervisiory operations
 0043 55F900        mov [bSSC_KEYSP],0      ;(especially after a Software Reset Supervisory op)
 0046           
 0046 5000          mov A,__bss_end         ;Set top of stack to end of used RAM
                IF (COMM_RX_PRESENT)
                    cmp A,40h
                    jnc .SetStack           ; Stack must start at or above 40h
                    mov A,40h
                ENDIF ;(COMM_RX_PRESENT)
                
 0048           .SetStack:
 0048 4E            swap SP,A
 0049           
 0049               ;-------------------------------------------------------------------------
 0049               ; Set clock and BandGap trim if the operating voltage is 3.3V. On power
 0049               ; up, 5V is loaded, so this is only needed for 3.3V operation.
 0049               ;-------------------------------------------------------------------------
 0049           
                IF (SUPPLY_VOLTAGE)                ; 1 means 5.0V
                ELSE                               ; 0 means 3.3V
                    mov  [bSSC_TABLE_TableId], 1   ; Point to the Trim table
                      mov   X, SP                         ; copy SP into X
                      mov   A, X                          ; mov to A
                      add   A, 3                          ; create 3 byte stack frame
                      mov   [bSSC_KEYSP], A               ; save stack frame for supervisory code
                      mov   [bSSC_KEY1], OPER_KEY                 ; load the supervisory code for supervisory operations
                      mov   A, TABLE_READ                         ; load A with specific Flash operation
                    db 0
                    or    F, FlagXIOMask
                    mov  A, [OSCILLATOR_TRIM_3V]   
                    mov  reg[IMO_TR], A            ; Load the 3V trim oscillator setting
                    mov  A, [VOLTAGE_TRIM_3V]
                    mov  reg[BDG_TR], A            ; Load the bandgap trim setting for 3V
                    and   F, ~FlagXIOMask
                ENDIF ;(SUPPLY_VOLTAGE)
                
                    ;-------------------------------------------------------------------------
                    ; If the user has requested the Crystal oscillator then turn it on and
                    ; wait for it to stabilize and the system to switch over to it.  The wait
                    ; will be one sleep timer period, approximately 1 second.
                    ;-------------------------------------------------------------------------
                
                IF (SELECT_32K & WAIT_FOR_32K)
                
                    ; This will be used for XTAL and PLL startup, and is cancelled later on.
                    mov reg[INT_MSK0], INT_MSK0_Sleep   ; Only turn on Sleep interrupt
                    mov reg[INT_MSK1], 0           ; Some could be on if s/w reset took place
                
                    or    F, FlagXIOMask
                
                    mov reg[PRT1DM0],00h           ; P1[0] & P1[1] Drive Mode to High Z because
                    mov reg[PRT1DM1],03h           ; LoadConfigInit not run yet.
                IF (PLL_MODE)
                    mov reg[ECO_TR],0Fh            ; adjust ECO bias if in PLL lock mode
                ENDIF ;(PLL_MODE)
                    and   F, ~FlagXIOMask
                    mov   reg[RES_WDT], 38h
                
                    or    F, FlagXIOMask

⌨️ 快捷键说明

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