在线时间0 小时
UID386311
注册时间2011-9-3
NXP金币0
该用户从未签到
新手上路

- 积分
- 23
- 最后登录
- 1970-1-1
|
芯片复位后无法跳到规定的指令段0X410运行,0X04原本是指向复位后PC的值的结果为0,代码如下
//中断向量文件
.text
/*
* Exception Vector Table
*/
VECTOR_TABLE:
_VECTOR_TABLE:
INITSP: .long __SP_INIT /* Initial SP */
INITPC: .long _asm_startmeup /* Initial PC */
vector002: .long asm_exception_handler /* Access Error */
vector003: .long asm_exception_handler /* Address Error */
vector004: .long asm_exception_handler /* Illegal Instruction */
vector005: .long asm_exception_handler /* Reserved */
vector006: .long asm_exception_handler /* Reserved */
vector007: .long asm_exception_handler /* Reserved */
vector008: .long asm_exception_handler /* Privilege Violation */
vector009: .long asm_exception_handler /* Trace */
vector010: .long asm_exception_handler /* Unimplemented A-Line */
vector011: .long asm_exception_handler /* Unimplemented F-Line */
vector012: .long asm_exception_handler /* Debug Interrupt */
vector013: .long asm_exception_handler /* Reserved */
vector014: .long asm_exception_handler /* Format Error */
vector015: .long asm_exception_handler /* Unitialized Int. */
vector016: .long asm_exception_handler /* Reserved */
vector017: .long asm_exception_handler /* Reserved */
vector018: .long asm_exception_handler /* Reserved */
vector019: .long asm_exception_handler /* Reserved */
vector020: .long asm_exception_handler /* Reserved */
vector021: .long asm_exception_handler /* Reserved */
vector022: .long asm_exception_handler /* Reserved */
vector023: .long asm_exception_handler /* Reserved */
vector024: .long asm_exception_handler /* Spurious Interrupt */
vector025: .long asm_exception_handler /* Autovector Level 1 */
vector026: .long asm_exception_handler /* Autovector Level 2 */
vector027: .long asm_exception_handler /* Autovector Level 3 */
vector028: .long asm_exception_handler /* Autovector Level 4 */
vector029: .long asm_exception_handler /* Autovector Level 5 */
vector030: .long asm_exception_handler /* Autovector Level 6 */
vector031: .long asm_exception_handler /* Autovector Level 7 */
vector032: .long asm_exception_handler /* TRAP #0 */
vector033: .long asm_exception_handler /* TRAP #1 */
vector034: .long asm_exception_handler /* TRAP #2 */
vector035: .long asm_exception_handler /* TRAP #3 */
vector036: .long asm_exception_handler /* TRAP #4 */
vector037: .long asm_exception_handler /* TRAP #5 */
vector038: .long asm_exception_handler /* TRAP #6 */
vector039: .long asm_exception_handler /* TRAP #7 */
vector040: .long asm_exception_handler /* TRAP #8 */
vector041: .long asm_exception_handler /* TRAP #9 */
vector042: .long asm_exception_handler /* TRAP #10 */
vector043: .long asm_exception_handler /* TRAP #11 */
vector044: .long asm_exception_handler /* TRAP #12 */
vector045: .long asm_exception_handler /* TRAP #13 */
vector046: .long asm_exception_handler /* TRAP #14 */
vector047: .long asm_exception_handler /* TRAP #15 */
vector048: .long asm_exception_handler /* Reserved */
vector049: .long asm_exception_handler /* Reserved */
vector050: .long asm_exception_handler /* Reserved */
vector051: .long asm_exception_handler /* Reserved */
vector052: .long asm_exception_handler /* Reserved */
vector053: .long asm_exception_handler /* Reserved */
vector054: .long asm_exception_handler /* Reserved */
vector055: .long asm_exception_handler /* Reserved */
vector056: .long asm_exception_handler /* Reserved */
vector057: .long asm_exception_handler /* Reserved */
vector058: .long asm_exception_handler /* Reserved */
vector059: .long asm_exception_handler /* Reserved */
vector060: .long asm_exception_handler /* Reserved */
vector061: .long asm_exception_handler /* Reserved */
vector062: .long asm_exception_handler /* Reserved */
vector063: .long asm_exception_handler /* Reserved */
vector064: .long asm_exception_handler /* IRQ_Pin */
vector065: .long asm_exception_handler /* Low_Voltage */
vector066: .long asm_tpm1_ch0_handler /* TPM1_ch0 */
vector067: .long asm_exception_handler /* TPM1_ch1 */
vector068: .long asm_exception_handler /* TPM1_ch2 */
vector069: .long asm_exception_handler /* TPM1_ovfl */
vector070: .long asm_exception_handler /* TPM2_ch0 */
vector071: .long asm_exception_handler /* TPM2_ch1 */
vector072: .long asm_exception_handler /* TPM2_ch2 */
vector073: .long asm_exception_handler /* TPM2_ovfl */
vector074: .long asm_exception_handler /* SPI2 */
vector075: .long asm_exception_handler /* SPI1 */
vector076: .long asm_exception_handler /* SCI1_err */
vector077: .long asm_exception_handler /* SCI1_rx */
vector078: .long asm_exception_handler /* SCI1_tx */
vector079: .long asm_exception_handler /* IICx */
vector080: .long asm_exception_handler /* KBIx */
vector081: .long asm_exception_handler /* ADC */
vector082: .long asm_exception_handler /* ACMPx */
vector083: .long asm_exception_handler /* SCI2_err */
vector084: .long asm_exception_handler /* SCI2_rx */
vector085: .long asm_exception_handler /* SCI2_tx */
vector086: .long asm_exception_handler /* RTC */
vector087: .long asm_exception_handler /* TPM3_ch0 */
vector088: .long asm_exception_handler /* TPM3_ch1 */
vector089: .long asm_exception_handler /* TPM3_ch2 */
vector090: .long asm_exception_handler /* TPM3_ch3 */
vector091: .long asm_exception_handler /* TPM3_ch4 */
vector092: .long asm_exception_handler /* TPM3_ch5 */
vector093: .long asm_exception_handler /* TPM3_ovrfl */
vector094: .long asm_exception_handler /* Reserved */
vector095: .long asm_exception_handler /* Reserved */
vector096: .long asm_exception_handler /* Level 7 SWI */
vector097: .long asm_exception_handler /* Level 6 SWI */
vector098: .long asm_exception_handler /* Level 5 SWI */
vector099: .long asm_exception_handler /* Level 4 SWI */
vector100: .long asm_exception_handler /* Level 3 SWI */
vector101: .long asm_exception_handler /* Level 2 SWI */
vector102: .long asm_exception_handler /* Level 1 SWI */
.end
//主程序masm.asm
.extern ___SP_INIT
.global _asm_function
.global _main
.global _Init_Timer
.global _wait
.global _asm_startmeup
.include "derivative.inc"
.text
.function "_asm_startmeup",_asm_startmeup,_asm_startmeup_end-_asm_startmeup
_asm_startmeup:
/* disable interrupts */
move.w #0x2700,SR
/* setup the stack pointer */
lea ___SP_INIT,A7
/* setup A6 dummy stackframe */
movea.l #0,A6
link A6,#0
_main:
bsr.l _Init_Timer
clr.l D4 /* Initialize timeouts (0=off) */
clr.l D5
clr.l D6
move.b #$03,D0
move.b D0,SOPT1
move.b #$F,D4 /* Schedule a timeout1 event ~ 160ms @ 4MHz Bus Frequency */
move.b #$FF,D0
move.b D0,PTFDD /* Set DEMOQE led ports as outputs */
move.b #$0,D0
move.b D0,PTFD
move.b #$C0,D0
move.b D0,PTEDD
move.b #$20,D0
move.b D0,PTBD
move.b #$3F,D0
move.b D0,PTCD
move.b #$C0,D0
move.b D0,PTED
/* enable interrupts */
move SR,D0
andi.l #0xF8FF,D0
move D0,SR
_wait:
bra _wait
/*************************************************************
* Init_Timer - Turns on timer 1 channel 0 for an Output *
* Compare in approximately 10ms. The timer *
* interrupt service routine continually sets *
* the next interrupt to occur 10ms later. *
**************************************************************/
_Init_Timer:
move.b #$06,D0
move.b D0,TPM1SC /* Timer 1 - Cleared + Stopped.
Clicks once every 64 BUS Cycles
Bus Clock Selected */
move.b #$54,D0
move.b D0,TPM1C0SC /* Timer 1 Channel 0
Set for Output Compare operation. */
move.b #$02,D0
move.b D0,TPM1C0VH /* Set Output Compare to happen 622T clicks ($26e) */
move.b #$6e,D0
move.b D0,TPM1C0VL /* after we start the timer. (~10ms). The
timer interrupt will set OC for another ~10ms. */
move.b #$0E,D0
move.b D0,TPM1SC /* Start the timer */
rts
_asm_startmeup_end:
.end
/* This source is (C)opyright 2003, P&E Microcomputer Systems, Inc.
Visit us at http://www.pemicro.com */
|
|