修改了光盘里提供的vboot, 只保留了其中一个文件head.S, 想做一个按键中断的测试, 咋整都不行, 请各位大侠帮忙看看.
head.S的全文见末尾.
期望的结果是:
程序在运行后, 循环点亮四个LED灯, 熄灭, 再点亮, 周而复始. 当有按键按下时, cpu跳到0x18处, 也就是到下面IRQHandle标号里面死循环. 同时, LED灯应该静止在当前状态, 不再循环.
但实际结果是:
当按键按下时. 灯的循环依旧. 对按键没反应.
其它:
按键应该是好的. 因为之前用串口输出时, 当按键按下时, 循环读取GPGDAT对应的按键位时, 一切正常.程序被编译成vboot.bin. 在串口出按v, 下载到nandflash, 也就是当作bootloader来运行,按自己的理解, 中断发生时, cpu会跳到0x18处, 这里为什么不行呢?
##### FriendlyARM BIOS 2.0 for 2440 #####
[x] format NAND FLASH for Linux
[v] Download vivi
CPSR我这里置成0x1F, 也就是系统模式, 未置F/I位, 也就是允许中断, 我成改中断模式, 也就是CPSR = 0x12也不行. 什么原因呢. 谢谢.
#define __ASSEMBLY__
#include "parameters.h"
@ Exception vector table (physical address = 0x00000000)
.section .text.FirstSector
.globl first_sector
first_sector: /**0x00*/
b Reset
UndefEntryPoint: /**0x04*/
b UndefEntryPoint
SWIEntryPoint: /**0x08*/
b SWIEntryPoint
PrefetchAbortEnteryPoint: /**0x0C*/
b PrefetchAbortEnteryPoint
DataAbortEntryPoint: /**0x10*/
b DataAbortEntryPoint
NotUsedEntryPoint: /**0x14*/
b NotUsedEntryPoint
IRQEntryPoint: /**0x18*/
b IRQHandle
FIQEntryPoint: /**0x1C*/
b FIQEntryPoint
@0x20: Fixed address global value. will be replaced by downloader.
.long ZBOOT_MAGIC
.byte OS_TYPE, HAS_NAND_BIOS, (LOGO_POS & 0xFF), ((LOGO_POS >>8) &0xFF)
.long OS_START
.long OS_LENGTH
.long OS_RAM_START
.string LINUX_CMD_LINE
.section .text
Reset:
mov r1, #0x53000000
mov r2, #0x0
str r2, [r1] /**watch-dog disable.*/
msr cpsr_c, #0x1F
ldr r0, =0x56000010 /**GPBCON*/
ldr r1, =0x0155500
str r1, [r0]
ldr r0, =0x56000018 /**GPBUP*/
ldr r1, =0x7FF
str r1, [r0]
ldr r0, =0x56000064 /**GPGDAT*/
ldr r1, =0
str r1, [r0]
ldr r0, =0x56000068 /**GPGUP*/
ldr r1, =0
str r1, [r0]
ldr r0, =0x56000060 /**GPGCON*/
ldr r1, =0x0008A882
str r1, [r0]
ldr r0, =0x5600008C /**EXTINT1*/
ldr r1, =0x22202002
str r1, [r0]
ldr r0, =0x56000090 /**EXTINT2*/
ldr r1, =0x2000
str r1, [r0]
3:
ldr r0, =0x56000014 /**GPBDAT*/
ldr r1, =0x01CE
str r1, [r0]
bl delay
ldr r1, =0x018E
str r1, [r0]
bl delay
ldr r1, =0x010E
str r1, [r0]
bl delay
ldr r1, =0x0E
str r1, [r0]
bl delay
ldr r1, =0x1EE
str r1, [r0]
bl delay
b 3b
delay:
ldr r2, =0x20000
ldr r3, =0
2:
sub r2, r2, #0x01
cmp r3, r2