正常情况下这个代码应该会执行未定义异常,然后输出一个字符串,但是我加载进开发板的时候没有反应
.text
.global _start
_start:
b reset /*0x0000 起始位置*/
ldr pc,=do_und/*0x00000004*/
ldr pc,=do_swi /*0x00000008*/
und_def:
.word do_und
swi_exception:
.word do_swi
//irq_interrupt:
//.word do_irq
do_swi:
ldr sp,=0x33e00000
stmdb sp!,{r0-r12,lr}
ldr r0,=swi_string
bl put_byte
mov r4,lr
sub r0,r4,#4
bl print_swi
ldmia sp!,{r0-r12,pc}^
do_und:
//bl text_putchar
/*设置und异常栈*/
ldr sp,=0x34000000
stmdb sp!, {r0-r12,lr} /*压栈,保护现场*/
/*要执行的中断操作*/
ldr r0,=und_string
bl printexception
/*恢复现场*/
ldmia sp!,{r0-r12,pc}^
.align 4
//do_irq:
/*
ldr sp,=0x33d00000
sub lr, lr, #4
stmdb sp!,{r0-r12,lr}
bl handle_interrupt
ldmia sp!,{r0-r12,pc}^
*/
und_string:
.string "und_def,exception"
.align 4
swi_string:
.string "swi ecxception"
.align 4
reset:
/* 关闭看门狗 */
ldr r0, =0x53000000
ldr r1, =0
str r1, [r0]
/* 设置MPLL, FCLK : HCLK : PCLK = 400m : 100m : 50m */
/* LOCKTIME(0x4C000000) = 0xFFFFFFFF */
ldr r0, =0x4C000000
ldr r1, =0xFFFFFFFF
str r1, [r0]
/* CLKDIVN(0x4C000014) = 0X5, tFCLK:tHCLK:tPCLK = 1:4:8 */
ldr r0, =0x4C000014
ldr r1, =0x5
str r1, [r0]
/* 设置CPU工作于异步模式 */
mrc p15,0,r0,c1,c0,0
orr r0,r0,#0xc0000000 //R1_nF:OR:R1_iA
mcr p15,0,r0,c1,c0,0
/* 设置MPLLCON(0x4C000004) = (92[0] */
ldr r2, [r1] /* r2=[0] */
cmp r1, r2 /* r1==r2? 如果相等表示是NAND启动 */
ldr sp, =0x40000000+4096 /* 先假设是nor启动 */
moveq sp, #4096 /* nand启动 */
streq r0, [r1] /* 恢复原来的值 */
bl Init_SDRAM /*初始化SDRAM*/
/*将svc模式装换成user模式*/
mrs r0, cpsr
bic r0, r0, #0xf
bic r0,r0, #(1