📄 boot.lis
字号:
0000
export __Start
export __Exit
export __bss_start
export __lit_start
export __idata_start
export __data_start
export __func_lit_start
export __text_start
export __usermodules_start
export __psoc_config_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,CON)
org 0 ;Reset Interrupt Vector
0000 7D0068 ljmp __Start ;First instruction executed following a Reset
0003
org 04h ;Supply Monitor Interrupt Vector
0004 30 halt ;Stop execution if power falls too low
0005
org 08h ;INT0 Interrupt Vector
0008 7D0000 ljmp INT0_ISR
000B 7E reti
000C
org 0Ch ;SPI TX Empty Interrupt Vector
// call void_handler
000C 7E reti
000D
org 10h ;SPI RX Full Interrupt Vector
// call void_handler
0010 7E reti
0011
org 14h ;GPIO Port 0 Interrupt Vector
0014 7D0003 ljmp PORT0_ISR
0017 7E reti
0018
org 18h ;GPIO Port 1 Interrupt Vector
0018 7D0004 ljmp PORT1_ISR
001B 7E reti
001C
org 1Ch ;INT1 Interrupt Vector
001C 7D0001 ljmp INT1_ISR
001F 7E reti
0020
org 20h ;USB Endpoint 0 Interrupt Vector
0020 7D0000 ljmp _USB_EP0_ISR
0023 7E reti
0024
org 24h ;USB Endpoint 1 Interrupt Vector
0024 7D0000 ljmp _USB_EP1_ISR
0027 7E reti
0028
org 28h ;USB Endpoint 2 Interrupt Vector
0028 7D0000 ljmp _USB_EP2_ISR
002B 7E reti
002C
org 2Ch ;USB Bus Reset Interrupt Vector
002C 7D0000 ljmp _USB_RESET_ISR
002F 7E reti
0030
org 30h ;USB Bus Activity Interrupt Vector
0030 7D0000 ljmp _USB_ACT_ISR
0033 7E reti
0034
org 34h ;One Millisecond Interval Timer Interrupt Vector
// call void_handler
0034 7E reti
0035
org 38h ;Programmable Interval Timer Interrupt Vector
// call void_handler
0038 7E reti
0039
org 3Ch ;Timer Capture 0 Interrupt Vector
// call void_handler
003C 7E reti
003D
org 40h ;Timer Capture 1 Interrupt Vector
// call void_handler
0040 7E reti
0041
org 44h ;Free Running Counter Wrap Interrupt Vector
// call void_handler
0044 7E reti
0045
org 48h ;INT 2 Interrupt Vector
0048 7D0002 ljmp INT2_ISR
004B 7E reti
004C
org 4Ch ;PS2 Data Low
// call void_handler
004C 7E reti
004D
org 50h ;GPIO Port 2 Interrupt Vector
0050 7D0005 ljmp PORT2_ISR
0053 7E reti
0054
org 54h ;GPIO Port 3 Interrupt Vector
0054 7D0006 ljmp PORT3_ISR
0057 7E reti
0058
org 58h ;GPIO Port 4 Interrupt Vector
0058 7D0007 ljmp PORT4_ISR
005B 7E reti
005C
org 5Ch ;Reserved
// call void_handler
005C 7E reti
005D
org 60h ;Reserved
// call void_handler
0060 7E reti
0061
org 64h ;Sleep Timer Interrupt Vector
// call void_handler
0064 7E reti
0065
0065 ;-----------------------------------------------------------------------------
0065 ; Start of Execution
0065 ; CPU is operating at 3 MHz
0065 ; IO Bank is Bank0
0065 ;-----------------------------------------------------------------------------
org 68h
0068 __Start:
0068
IF ( WATCHDOG_ENABLE ) ; WDT selected in Global Params
and reg[CPU_SCR], ~CPU_SCR_PORS_MASK
ENDIF
;------------------
; Set up the clocks
;------------------
; Configure the external oscillator, EFTB Filter, and clock out
; It is configured with an 'OR' in case a USB Bus Reset occurred and
; the external oscillator has already been started. This way
; it does not get unselected.
IF XOSC_ENABLE
MOV REG[XOSCTR], XOSC_XGM_JUST ; Set the external OSC XGM
OR REG[CLKIOCR], (XOSC_ENABLE_JUST | EFTB_JUST | CLOCK_OUT_JUST)
; If the external oscillator has been selected, wait for it to stabilize
; then select it
or F, FLAG_XIO_MASK
AND REG[OSC_CR0], ~OSC_CR0_SLEEP
OR REG[OSC_CR0], OSC_CR0_SLEEP_512Hz ; Wait ~2 mSec
and F, ~FLAG_XIO_MASK
mov reg[RES_WDT], 38h
MOV REG[INT_VC], 0 ; Clear all pending interrupts
.WaitForStableXOSC:
TST REG[INT_CLR0], INT_MSK0_SLEEP ; Test the SleepTimer Interrupt Status
JZ .WaitForStableXOSC ; Wait until ~2 mSec has elapsed
OR REG[CLKIOCR], CLKIOCR_XOSC_SELECT ; Now, select the external oscillator
ELSE
0068 433200 OR REG[CLKIOCR], (EFTB_JUST | CLOCK_OUT_JUST)
ENDIF
006B 55F800 mov [bSSC_KEY1],0 ; Lockout Flash and Supervisiory operations
006E 55F900 mov [bSSC_KEYSP],0
0071
0071 ;------------------
0071 ; Set up the stack
0071 ;------------------
0071 5000 mov A, __ramareas_end ; Set top of stack to end of used RAM
0073 4E swap SP, A ; This is only temporary if going to LMM
0074
0074 ;-------------------------------------------------------------------------
0074 ; All the user selections and UserModule selections are now loaded,
0074 ; except CPU frequency (CPU is runing at 12 MHz). Load the PSoC
0074 ; configuration with a 12 MHz CPU clock to keep config time short.
0074 ;-------------------------------------------------------------------------
0074 7C0000 lcall LoadConfigInit ; Configure PSoC blocks per Dev Editor
0077
0077
IF (C_LANGUAGE_SUPPORT)
0077 9008 call InitCRunTime ; Initialize for C language
ENDIF ;(C_LANGUAGE_SUPPORT)
;-------------------------------------------------------------------------
; Global Interrupt are NOT enabled, this should be done in main().
; LVD is set but will not occur unless Global Interrupts are enabled.
; Global Interrupts should be as soon as possible in main().
;-------------------------------------------------------------------------
0079 62E200 mov reg[INT_VC],0 ; Clear any pending interrupts which may
007C ; have been set during the boot process.
007C 7C0000 lcall _main ; Call main
007F
007F __Exit:
007F 8FFF jmp __Exit ; Wait here till power is turned off
0081
0081
0081
0081 ;-----------------------------------------------------------------------------
0081 ; C Runtime Environment Initialization
0081 ; The following code is conditionally assembled.
0081 ;-----------------------------------------------------------------------------
0081
IF (C_LANGUAGE_SUPPORT)
0081 InitCRunTime:
0081 ;-----------------------------
0081 ; clear bss segment
0081 ;-----------------------------
0081 5000 mov A,0
0083 550000 mov [__r0],<__bss_start
0086 BssLoop:
0086 3C0000 cmp [__r0],<__bss_end
0089 A005 jz BssDone
008B 3F00 mvi [__r0],A
008D 8FF8 jmp BssLoop
008F BssDone:
008F ;----------------------------
008F ; copy idata to data segment
008F ;----------------------------
008F 5000 mov A,>__idata_start
0091 5700 mov X,<__idata_start
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -