Hello, I Just ported picoos to ARM7 Pid board
The job was easy, just some modifications to do , let's
start!
under ports/arm/boot open the file interrupts.c
Change the orginial with this:
#define VPint *(volatile unsigned int *)
/* ************ BEGIN TARGET SPECIFIC SECTION
**************/
#define Timer0Load (*((volatile unsigned long *)
0xA800000))
#define Timer0Value (*((volatile unsigned long *)
0xA800004))
#define Timer0Ctrl (*((volatile unsigned long *)
0xA800008))
#define Timer0Clr (*((volatile unsigned long *)
0xA80000C))
#define Timer1Load (*((volatile unsigned long *)
0xA800020))
#define Timer1Value (*((volatile unsigned long *)
0xA800024))
#define Timer1Ctrl (*((volatile unsigned long *)
0xA800028))
#define Timer1Clr (*((volatile unsigned long *)
0xA80002C))
#define IrqStatus (*((volatile unsigned long *)
0xA000000))
#define IrqRawStatus (*((volatile unsigned long *)
0xA000004))
#define IrqEnable (*((volatile unsigned long *)
0xA000008))
#define IrqEnableClear (*((volatile unsigned long *)
0xA00000C))
#define IrqSoft (*((volatile unsigned long *)
0xA000010))
#define FiqStatus (*((volatile unsigned long *)
0xA000100))
#define FiqRawStatus (*((volatile unsigned long *)
0xA000104))
#define FiqEnable (*((volatile unsigned long *)
0xA000108))
#define FiqEnableClear (*((volatile unsigned long *)
0xA00010C))
/* ************ END TARGET SPECIFIC SECTION
**************/
typedef struct
Also modify :
void osTimerInterruptInitialize(void)
{
Timer1Ctrl=0x40; // Periodic /
prescale_1
Timer1Load=150000; // Load
Timer1Ctrl=0xC0; // Enable
IrqEnable=0x20;
// Enable Time IRQ
}
void osInterruptInitialize(void)
{
memset(InterruptHandlers, 0, sizeof
(InterruptHandlers));
/* ************ BEGIN TARGET SPECIFIC SECTION
************/
//IrqEnable=0xFFFFFFFF;
/* ************ END TARGET SPECIFIC SECTION
**************/
}
NOTE
In the attacched file time setting are:
Timer1Ctrl=0x44; // Periodic /
prescale_16
Timer1Load=150000; // Load
Timer1Ctrl=0xC4; // Enable
i use a prescale of 16 , timig is more or less accurate on
a 30 mhz arm7 cpu
Now go one folder back and open arch_arm_asm.s
Add these instead of the original ones:
FIQ_MODE EQU 0x11 ; Fast Interrupt Mode
(FIQ)
; ************ BEGIN TARGET SPECIFIC SECTION
**************
IrqStatus EQU 0xA000000
IrqRawStatus EQU 0xA000004
IrqEnable EQU 0xA000008
IrqEnableClear EQU 0xA00000C
IrqSoft EQU 0xA000010
FiqStatus EQU 0xA000100
FiqRawStatus EQU 0xA000104
FiqEnable EQU 0xA000108
FiqEnableClear EQU 0xA00010C
Timer0Load EQU 0xA800000
Timer0Value EQU 0xA800004
Timer0Ctrl EQU 0xA800008
Timer0Clr EQU 0xA80000C
Timer0IrqBMap EQU 0x10
Timer1Load EQU 0xA800020
Timer1Value EQU 0xA800024
Timer1Ctrl EQU 0xA800028
Timer1Clr EQU 0xA80002C
Timer1IrqBMap EQU 0x20
; ************ END TARGET SPECIFIC SECTION
**************
; stack size
Change the system configuration in this way:
MSR cpsr_cxsf, r0
; ************ BEGIN TARGET SPECIFIC SECTION
**************
MOV R10, #0xA000000
;loads in R10
0xA000000
MVN R0, #0
;loads in
R0 !0x0 (0xFFFFFFFF)
STR R0, [R10,#0x10C]
;Stores in 0xA000000+0x10C the
0xFFFFFFFF value -> does FIQEnableClear
STR R0, [R10,#0xC]
;Stores in
0xA000000+0xC the 0xFFFFFFFF value -> does
IRQEnableClear
MOV R10, #0xB000000
;loads in R10
0xB000000 (remap and pause base address)
STR R0, [R10,#0x20]
;Stores in
0xB00000+0x20 the 0xFFFFFFFF value -> does
ClearResetMap
LDR r0, =IrqEnableClear
LDR r1, =0xFFFFFFFF
STR r1, [r0]
; ************ END TARGET SPECIFIC SECTION
**************
INITIALIZE_STACK
and change the ISR code in this way:
STMFD sp!, {r0-r12, lr}
; ************ BEGIN TARGET SPECIFIC SECTION
**************
LDR r1, =IrqStatus ; Get location of
interrupt contrl
LDR r0, [r1] ; Get current IRQ status
CMP r0, #Timer1IrqBMap
BLE is_valid_intno
; invalid then return
LDMFD sp!, {r0-r12, pc}^
is_valid_intno
CMP r0, #Timer1IrqBMap ; Check for timer0
interrupt
BNE skip_timer
LDR r2, =Timer1Clr
MOV r1, #0
STR r1, [R2]
skip_timer
; ************ END TARGET SPECIFIC SECTION
**************
; save SPSR_irq, it is CPSR_svc
Now look for:
MOV r0, r5
BL ISRIrqHandler
CMP r5, #0x1d
BNE skip_postimer
BL c_pos_timerInterrupt
and change it with:
MOV r0, r5
BL ISRIrqHandler
CMP r5, #Timer1IrqBMap
BNE skip_postimer
BL c_pos_timerInterrupt
NOTE this is not between END TARGET SPECIFIC...
Attached there is a complete project loadable under
ADS1.2 and compiles..
I had to put a pair posTaskSleep since the code bloked
Port for Arm7 PID and example for ADS (tested with AXD)