Modified irq.S to test disabling irq. Program hangs on "bl disable_irq". lr does not have the right value. Please double check. ---Botao
#include "amber_registers.h"
.section .text
.globl main
main:
/* 0x00 Reset Interrupt vector address */
b start
/* 0x04 Undefined Instruction Interrupt vector address */
b testfail
/* 0x08 SWI Interrupt vector address */
b testfail
/* 0x0c Prefetch abort Interrupt vector address */
b testfail
/* 0x10 Data abort Interrupt vector address */
b testfail
b testfail
/* 0x18 IRQ vector address */
b service_irq
/* 0x1c FIRQ vector address */
b testfail
disable_irq: orr lr, lr, #0x08000000 mov pc, lr
start: / Set Supervisor Mode stack pointer / ldr sp, AdrSVCStack
/* Switch to IRQ Mode */
mov r0, #0x00000002
teqp pc, r0
/* Set IRQ Mode stack pointer */
ldr sp, AdrIRQStack
/* Switch to User Mode */
/* and unset interrupt mask bits */
mov r0, #0x00000003
teqp pc, r0
bl disable_irq
(no changes below........) ldr r4, AdrRanNum ldr r5, r4 and r5, r5, #0x1c
I've recreated the bug and am working on a fix. Thanks for finding it.
The following code doesnot work due to the same bug(I believe)
(in supervisor mode here) mov r0, #0x08000002 teqp pc, r0 // move to irq mode sub lr, lr, #4 // lr doesnot change at all !!
Hopefully this is helpful.
Fix for Amber23 and Amber25 cores submitted. Users should update to the latest version to avoid this bug.