Sign in

username:

password:



Not a member?

Search lpc2000



Search tips

Subscribe to lpc2000



lpc2000 by Keywords

2106 | ADC | ARM7 | Atmel | Bootloader | CAN | CrossStudio | CrossWorks | DDS | ECos | Ethernet | ETM | FIFO | FLASH | FPGA | GCC | GDB | GNU | GNUARM | GPIO | I2C | IAP | IAR | JTAG | Kickstart | LCD | Linux | LPC | LPC-E2294 | LPC2000 | LPC2100 | LPC2104 | Lpc2106 | Lpc210x | LPC2114 | LPC2119 | LPC2124 | LPC2129 | Lpc2138 | LPC213x | LPC21xx | LPC2210 | LPC2212 | LPC2214 | LPC2292 | LPC2294 | LPC2xxx | LPC3128 | MCB2100 | Olimex | Philips | PWM | Rowley | RTC | RTOS | SPI | SSP | UART | UART0 | UART1 | ULINK | USB | Watchdog | Wiggler


Ads

Discussion Groups

See Also

DSPFPGAElectronics

Discussion Groups | LPC2000 | interrupts of RTC

Discussion group dedicated to the Philips LPC2000 family of ARM MCUs

interrupts of RTC - raju_nem - Oct 31 9:13:18 2009



Hi,

void readRTC_irq(void) __attribute__((interrupt));
VICINTSELECT=0x00000000;

VICVECTADDR0=(unsigned long )readRTC_irq;

VICVECTCNTL0=0x2d;

VICINTENABLE |=0x02000;
The last line VICINTENABLE |=0x02000; is not executing? what may be the reason? help me,thanks in advance.

------------------------------------



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )


Re: interrupts of RTC - capiman26061973 - Oct 31 9:34:54 2009



Hello,

> void readRTC_irq(void) __attribute__((interrupt));

> VICINTSELECT=0x00000000;
> VICVECTADDR0=(unsigned long )readRTC_irq;
> VICVECTCNTL0=0x2d;
> VICINTENABLE |=0x02000;

> The last line VICINTENABLE |=0x02000; is not executing?
> what may be the reason? help me,thanks in advance.

What have you already done to debug / narrow your problem ?

A program can't (usually) just stop at a certain command
(beside it is programmed to do this, e.g. jump in a loop). When you
always reach the 3rd command, but not the 4th command, there must
happen something in the area of 3rd or 4th command. It could be that
a higher prior task is taking over the control of your program. This
could be one of your interrupt routines. Or any other interrupt
(e.g. which you perhaps have not set, but enabled). Or there was an
exception, and the cpu is doing some (internal) interrupt like a
data abort ?
Have you perhaps checked if your interrupt routine is already called
and crashing inside, or waiting for something endless ?
Or is it perhaps called more than one time ?

Just some hints to help you narrow down your problem by yourself.

Regards,

Martin

------------------------------------



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: interrupts of RTC - raju_nem - Oct 31 10:05:23 2009

i am using only one isr_routine that is RTC,no other isr routines in my code.Even with this isr routine also,is not called.At this initialization part only struck up.I am posting the main and intialization of RTC function and at the end of the line it get strucku.

void Initialize_RTC()
{
VICINTENCLEAR=0xFFFFFFFF;
PCONP |= 0x200;
Tx_string("RTC initiallization is over5\n");

CCR=0x2; /* Reset the clock */
ILR=0x3; /* Clear the Interrupt Location Register */
CIIR=0x01;
HOUR=0x0;
SEC=0x0;
MIN=0x0;
PREINT = 0x0726;

PREFRAC = 0x0700;

VICINTSELECT=0x00000000;

VICVECTADDR0=(unsigned long )readRTC_irq;

VICVECTCNTL0=0x2d;

VICINTENABLE |=0x02000;
}

int main()
{
PINSEL0=0x00000005;
PLL_init();
InitUart0(); /* Initialize Serial port */

Initialize_RTC(); /* Initialize System */

CCR=0x01; /* Start RTC */

while (1) /* Loop forever */
{
}
}

Help me thanks in advance.
--- In l...@yahoogroups.com, "capiman26061973" wrote:
>
> Hello,
>
> > void readRTC_irq(void) __attribute__((interrupt));
>
> > VICINTSELECT=0x00000000;
> > VICVECTADDR0=(unsigned long )readRTC_irq;
> > VICVECTCNTL0=0x2d;
> > VICINTENABLE |=0x02000;
>
> > The last line VICINTENABLE |=0x02000; is not executing?
> > what may be the reason? help me,thanks in advance.
>
> What have you already done to debug / narrow your problem ?
>
> A program can't (usually) just stop at a certain command
> (beside it is programmed to do this, e.g. jump in a loop). When you
> always reach the 3rd command, but not the 4th command, there must
> happen something in the area of 3rd or 4th command. It could be that
> a higher prior task is taking over the control of your program. This
> could be one of your interrupt routines. Or any other interrupt
> (e.g. which you perhaps have not set, but enabled). Or there was an
> exception, and the cpu is doing some (internal) interrupt like a
> data abort ?
> Have you perhaps checked if your interrupt routine is already called
> and crashing inside, or waiting for something endless ?
> Or is it perhaps called more than one time ?
>
> Just some hints to help you narrow down your problem by yourself.
>
> Regards,
>
> Martin
>

------------------------------------

______________________________
Stellaris® MCU Family: New Parts, New Package, New Price.


(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: interrupts of RTC - rtstofer - Oct 31 10:48:54 2009



--- In l...@yahoogroups.com, "raju_nem" wrote:
>
> i am using only one isr_routine that is RTC,no other isr routines in my code.Even with this isr routine also,is not called.At this initialization part only struck up.I am posting the main and intialization of RTC function and at the end of the line it get strucku.
It might be helpful if you posted the vectors portion of your startup code. Then we can see if you are properly handling the VIC. Also, it kind of matters which device you are using.

Just before the startup code branches to main(), there should be a line like:

MSR CPSR_c,#MODE_SVC /* enable interrupts */

to enable interrupts.

You might also post at least the shell of your interrupt handler. Depending on the compiler, the prototype might look like:

void T0_ISR (void) __attribute__ ((interrupt));

Obviously, this is for my timer interrupt and GCC.

Richard

------------------------------------



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: interrupts of RTC - raju_nem - Nov 1 11:42:21 2009

Hi rtstofer,

This is the startup code

/*
* Some defines for the program status registers
*/
ARM_MODE_USER = 0x10 /* Normal User Mode */
ARM_MODE_FIQ = 0x11 /* FIQ Fast Interrupts Mode */
ARM_MODE_IRQ = 0x12 /* IRQ Standard Interrupts Mode */
ARM_MODE_SVC = 0x13 /* Supervisor Interrupts Mode */
ARM_MODE_ABORT = 0x17 /* Abort Processing memory Faults Mode */
ARM_MODE_UNDEF = 0x1B /* Undefined Instructions Mode */
ARM_MODE_SYS = 0x1F /* System Running in Priviledged Operating Mode */
ARM_MODE_MASK = 0x1F

I_BIT = 0x80 /* disable IRQ when I bit is set */
F_BIT = 0x40 /* disable IRQ when I bit is set */

/*
* Register Base Address
*/

.section .vectors,"ax"
.code 32

/****************************************************************************/
/* Vector table and reset entry */
/****************************************************************************/
_vectors:
ldr pc, ResetAddr /* Reset */
ldr pc, UndefAddr /* Undefined instruction */
ldr pc, SWIAddr /* Software interrupt */
ldr pc, PAbortAddr /* Prefetch abort */
ldr pc, DAbortAddr /* Data abort */
.word 0xB8A06F60
ldr pc, IRQAddr /* IRQ interrupt */
ldr pc, FIQAddr /* FIQ interrupt */
ResetAddr: .word ResetHandler
UndefAddr: .word UndefHandler
SWIAddr: .word SWIHandler
PAbortAddr: .word PAbortHandler
DAbortAddr: .word DAbortHandler
ReservedAddr: .word 0
IRQAddr: .word IRQHandler
FIQAddr: .word FIQHandler

.ltorg
.section .init, "ax"
.code 32

.global ResetHandler
.global ExitFunction
.extern main
/****************************************************************************/
/* Reset handler */
/****************************************************************************/
ResetHandler:
/*
* Wait for the oscillator is stable
*/
nop
nop
nop
nop
nop
nop
nop
nop

/*
* Setup a stack for each mode
*/
msr CPSR_c, #ARM_MODE_UNDEF | I_BIT | F_BIT /* Undefined Instruction Mode */
ldr sp, =__stack_und_end

msr CPSR_c, #ARM_MODE_ABORT | I_BIT | F_BIT /* Abort Mode */
ldr sp, =__stack_abt_end

msr CPSR_c, #ARM_MODE_FIQ | I_BIT | F_BIT /* FIQ Mode */
ldr sp, =__stack_fiq_end

msr CPSR_c, #ARM_MODE_IRQ | I_BIT | F_BIT /* IRQ Mode */
ldr sp, =__stack_irq_end

msr CPSR_c, #ARM_MODE_SVC | I_BIT | F_BIT /* Supervisor Mode */
ldr sp, =__stack_svc_end
/*
* Clear .bss section
*/
ldr r1, =__bss_start
ldr r2, =__bss_end
ldr r3, =0
bss_clear_loop:
cmp r1, r2
strne r3, [r1], #+4
bne bss_clear_loop

/*
* Jump to main
*/
mrs r0, cpsr
bic r0, r0, #I_BIT | F_BIT /* Enable FIQ and IRQ interrupt */
msr cpsr, r0

mov r0, #0 /* No arguments */
mov r1, #0 /* No arguments */
ldr r2, =main
mov lr, pc
bx r2 /* And jump... */

ExitFunction:
nop
nop
nop
b ExitFunction

/****************************************************************************/
/* Default interrupt handler */
/****************************************************************************/

UndefHandler:
b UndefHandler

SWIHandler:
b SWIHandler

PAbortHandler:
b PAbortHandler

DAbortHandler:
b DAbortHandler

IRQHandler:
b IRQHandler

FIQHandler:
b FIQHandler

.weak ExitFunction
.weak UndefHandler, PAbortHandler, DAbortHandler
.weak IRQHandler, FIQHandler

.ltorg
/*** EOF ***/

I am using interrupts for Real time clock(RTC).
--- In l...@yahoogroups.com, "rtstofer" wrote:
>
> --- In l...@yahoogroups.com, "raju_nem" wrote:
> >
> > i am using only one isr_routine that is RTC,no other isr routines in my code.Even with this isr routine also,is not called.At this initialization part only struck up.I am posting the main and intialization of RTC function and at the end of the line it get strucku.
> It might be helpful if you posted the vectors portion of your startup code. Then we can see if you are properly handling the VIC. Also, it kind of matters which device you are using.
>
> Just before the startup code branches to main(), there should be a line like:
>
> MSR CPSR_c,#MODE_SVC /* enable interrupts */
>
> to enable interrupts.
>
> You might also post at least the shell of your interrupt handler. Depending on the compiler, the prototype might look like:
>
> void T0_ISR (void) __attribute__ ((interrupt));
>
> Obviously, this is for my timer interrupt and GCC.
>
> Richard
>

------------------------------------

______________________________
Stellaris® MCU Family: New Parts, New Package, New Price.


(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: interrupts of RTC - rtstofer - Nov 1 12:44:06 2009



--- In l...@yahoogroups.com, "raju_nem" wrote:
/****************************************************************************/
> /* Vector table and reset entry */
> /****************************************************************************/
> _vectors:
> ldr pc, ResetAddr /* Reset */
> ldr pc, UndefAddr /* Undefined instruction */
> ldr pc, SWIAddr /* Software interrupt */
> ldr pc, PAbortAddr /* Prefetch abort */
> ldr pc, DAbortAddr /* Data abort */
> .word 0xB8A06F60
> ldr pc, IRQAddr /* IRQ interrupt */
> ldr pc, FIQAddr /* FIQ interrupt */
> ResetAddr: .word ResetHandler
> UndefAddr: .word UndefHandler
> SWIAddr: .word SWIHandler
> PAbortAddr: .word PAbortHandler
> DAbortAddr: .word DAbortHandler
> ReservedAddr: .word 0
> IRQAddr: .word IRQHandler
> FIQAddr: .word FIQHandler
>
> .ltorg
> .section .init, "ax"
> .code 32
>
> .global ResetHandler
> .global ExitFunction
> .extern main
> /****************************************************************************/
> /* Default interrupt handler */
> /****************************************************************************/
>
> UndefHandler:
> b UndefHandler
>
> SWIHandler:
> b SWIHandler
>
> PAbortHandler:
> b PAbortHandler
>
> DAbortHandler:
> b DAbortHandler
>
> IRQHandler:
> b IRQHandler
>
> FIQHandler:
> b FIQHandler
>
> .weak ExitFunction
> .weak UndefHandler, PAbortHandler, DAbortHandler
> .weak IRQHandler, FIQHandler
>

I thought you were trying to use the VIC vectored interrupt scheme. Here you branch to IRQHandler and then just loop. You could have overridden IRQHandler elsewhere but I don't see it.

If you want to use vectored interrupts, your vectors need to look like:

vectors:
ldr PC, Reset_Addr
ldr PC, Undef_Addr
ldr PC, SWI_Addr
ldr PC, PAbt_Addr
ldr PC, DAbt_Addr
nop
ldr PC, [PC,#-0xFF0] <== this reads vector address from VIC
ldr PC, FIQ_Addr
That particular piece of code works for the LPC2148 due to some magic arithmetic related to the current PC and the address of the VIC Vector Address. Other variants use a different constant.

I don't know what chip you are using.

Short story: unless you have overridden IRQHandler somewhere else, the very first interrupt to come along puts the uC into a loop with interrupts disabled. It won't be coming back...

Now, there is another story about interrupts using GCC. They don't always nest properly. In fact, they don't always work correctly either.

So, I lot of folks change their startup code to provide a wrapper for interrupts and then write the interrupt functions as regular C functions with NO attributes.

The startup code (for an LPC2106) looks like this:

/* ***************************************************************************************************************

crt.s STARTUP ASSEMBLY CODE
-----------------------
Module includes the interrupt vectors and start-up code.

*************************************************************************************************************** */

/* Stack Sizes */
.set UND_STACK_SIZE, 0x00000020 /* stack for "undefined instruction" interrupts is 4 bytes */
.set ABT_STACK_SIZE, 0x00000020 /* stack for "abort" interrupts is 4 bytes */
.set FIQ_STACK_SIZE, 0x00000020 /* stack for "FIQ" interrupts is 4 bytes */
.set IRQ_STACK_SIZE, 0X00000020 /* stack for "IRQ" normal interrupts is 4 bytes */
.set SVC_STACK_SIZE, 0x00000020 /* stack for "SVC" supervisor mode is 4 bytes */

/* Standard definitions of Mode bits and Interrupt (I & F) flags in PSRs (program status registers) */
.set MODE_USR, 0x10 /* Normal User Mode */
.set MODE_FIQ, 0x11 /* FIQ Processing Fast Interrupts Mode */
.set MODE_IRQ, 0x12 /* IRQ Processing Standard Interrupts Mode */
.set MODE_SVC, 0x13 /* Supervisor Processing Software Interrupts Mode */
.set MODE_ABT, 0x17 /* Abort Processing memory Faults Mode */
.set MODE_UND, 0x1B /* Undefined Processing Undefined Instructions Mode */
.set MODE_SYS, 0x1F /* System Running Priviledged Operating System Tasks Mode */

.set I_BIT, 0x80 /* when I bit is set, IRQ is disabled (program status registers) */
.set F_BIT, 0x40 /* when F bit is set, FIQ is disabled (program status registers) */

.set VICVECTADDR, 0xFFFFF030

.text
.arm

.global Reset_Handler
.global _startup
.func _startup

_startup:

# Exception Vectors

_vectors: ldr PC, Reset_Addr
ldr PC, Undef_Addr
ldr PC, SWI_Addr
ldr PC, PAbt_Addr
ldr PC, DAbt_Addr
nop /* Reserved Vector (holds Philips ISP checksum) */
ldr PC, IRQ_Addr
ldr PC, FIQ_Addr

Reset_Addr: .word Reset_Handler /* defined in this module below */
Undef_Addr: .word UNDEF_Routine /* defined in interrupt.c */
SWI_Addr: .word SWI_Routine /* defined in interrupt.c */
PAbt_Addr: .word UNDEF_Routine /* defined in interrupt.c */
DAbt_Addr: .word UNDEF_Routine /* defined in interrupt.c */
IRQ_Addr: .word IRQ_Wrapper /* defined in this module below */
FIQ_Addr: .word FIQ_Routine /* defined in interrupt.c */
.word 0 /* rounds the vectors and ISR addresses to 64 bytes total */
# Reset Handler

Reset_Handler:

/* Setup a stack for each mode - note that this only sets up a usable stack
for User mode. Also each mode is setup with interrupts initially disabled. */

ldr r0, =_stack_end
msr CPSR_c, #MODE_UND|I_BIT|F_BIT /* Undefined Instruction Mode */
mov sp, r0
sub r0, r0, #UND_STACK_SIZE
msr CPSR_c, #MODE_ABT|I_BIT|F_BIT /* Abort Mode */
mov sp, r0
sub r0, r0, #ABT_STACK_SIZE
msr CPSR_c, #MODE_FIQ|I_BIT|F_BIT /* FIQ Mode */
mov sp, r0
sub r0, r0, #FIQ_STACK_SIZE
msr CPSR_c, #MODE_IRQ|I_BIT|F_BIT /* IRQ Mode */
mov sp, r0
sub r0, r0, #IRQ_STACK_SIZE
msr CPSR_c, #MODE_SVC|I_BIT|F_BIT /* Supervisor Mode */
mov sp, r0
sub r0, r0, #SVC_STACK_SIZE
msr CPSR_c, #MODE_SYS|I_BIT|F_BIT /* User Mode */
mov sp, r0

/* copy .data section (Copy from ROM to RAM) */
ldr R1, =_etext
ldr R2, =_data
ldr R3, =_edata
1: cmp R2, R3
ldrlo R0, [R1], #4
strlo R0, [R2], #4
blo 1b

/* Clear .bss section (Zero init) */
mov R0, #0
ldr R1, =_bss_start
ldr R2, =_bss_end
2: cmp R1, R2
strlo R0, [R1], #4
blo 2b

MSR CPSR_c,#MODE_SVC /* enable interrupts */

/* Enter the C code */
b main
IRQ_Wrapper:

stmfd sp!, { lr } /* save return address on IRQ stack */
mrs lr, spsr /* use lr to save spsr_irq */
stmfd sp!, { r4-r5, lr } /* save work regs & spsr on stack */

ldr r4, =VICVECTADDR /* get the ISR address from VIC */
ldr r5, [r4]

msr cpsr_c, #MODE_SVC|F_BIT /* supervisor mode, interrupts ON */

stmfd sp!, { r0-r3, r12, lr } /* save work regs & lr_svc on stack */
mov lr, pc /* set return to common exit of ISR */

mov pc, r5 /* go handle the interrupt */

ldmfd sp!, { r0-r3, r12, lr } /* restore regs & lr_svc */

/* IRQ mode, interrupts OFF */
msr cpsr_c, #MODE_IRQ|I_BIT|F_BIT

str lr, [r4] /* update VICVectAddr */

ldmfd sp!, { r4-r5, lr } /* restore work regs and spsr_irq */
msr spsr_cxsf, lr /* put back spsr_irq */
ldmfd sp!, { lr } /* restore return address */

subs pc, lr, #0x4 /* return, restoring CPSR from SPSR */
.endfunc

.end
Then the C code to set up Timer0 and the VIC looks like:

// set up Timer 0
TIMER0_TC = 0; // clear the timer count
TIMER0_PR = 1; // prescale divide by 2
TIMER0_MR0 = 14400; // divide by 14400 to get 2048 ints per second
TIMER0_MCR = 0x03; // interrupt on match, reset on match
TIMER0_TCR = 0x01; // start the timer

// set up VIC
VICVectCntl3 = 0x00000024; // set priority 3 for Timer 0
VICVectAddr3 = (unsigned long) T0_ISR;
VICIntEnable = (1 << T0_IntEnBit);

and the timer interrupt code looks like:

void T0_ISR(void)
{
ticks++;

if ((ticks & 0x03FF) == 0)
{
if (ticks & 0x0400)
IOSET = LED;
else
IOCLR = LED;
}

TIMER0_IR = 0x01;
}

Note that VicVectAddr is NOT updated inside T0_ISR. It is done in the wrapper.

Richard

------------------------------------

______________________________
Stellaris® MCU Family: New Parts, New Package, New Price.


(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: Re: interrupts of RTC - Raju N - Nov 5 2:49:30 2009

On Sun, Nov 1, 2009 at 11:13 PM, rtstofer wrote:

> Ya fine,The last line of the code " VICINTENABLE =3D0x02000; is
> excuted.But controller is not going in to isr function.i am posting the c=
ode
> bellow.help me,thanks in advance.
>

void readRTC_irq(void) __attribute__((interrupt("IRQ")));

void readRTC_irq()
{

ILR=3D0x1; /* Clearing Interrupt */

printf("\nTime is %d:%d:%d",HOUR,MIN,SEC); /* Printing the time on Serial
port */

VICVECTADDR=3D0x00000000;
}
void Initialize_RTC()
{

unsigned char tim[6],x;
int i;
Tx_string("D0 you want to set the time if yes press 'Y',if No say any
key\n"); //to print on the hyperterminal
x=3DRx_char();
if(x=3D=3D'Y')
{
Tx_string("Please enter the HOURS:MINUTES:SECONDS\n"); //to
print on the hyperterminal
for(i=3D0; i<6; i++)
{
tim[i]=3DRx_char(); //to receive the character from=
PC
}
CCR=3D0x12; /* Reset the clock */
ILR=3D0x3; /* Clear the Interrupt Location Register */
CIIR=3D0x01;
PREINT =3D 0x016D; //PREINT =3D int (PCLK / 32768) - 1.
PREFRAC =3D 0x01B00; //PREFRAC =3D PCLK - ((PREINT + 1) =D7 327=
68).

VICINTSELECT=3D0x00000000;
VICVECTADDR3=3D(unsigned long )readRTC_irq;
VICVECTCNTL3=3D0x2d;
VICINTENABLE =3D0x02000;

HOUR=3D((10*(tim[0]-0x30))+(tim[1]-0x30));

MIN =3D((10*(tim[2]-0x30))+(tim[3]-0x30));

SEC=3D((10*(tim[4]-0x30))+(tim[5]-0x30));

CCR=3D0x11; /* Start RTC */ //use the external clock=
to
run the RTC even when power is off

}
printf("\nTime is %d:%d:%d",HOUR,MIN,SEC);
}
int main()
{
PINSEL0=3D0x00000005;
InitUart0(); /* Initialize Serial port */
MAMCR =3D 0x00000000;
MAMTIM =3D 0x00000003;
MAMCR =3D 0x00000002;

Initialize_RTC(); /* Initialize System */

printf("\nTime is %d:%d:%d",HOUR,MIN,SEC);

while(1)
{
}

}

>
> --- In l...@yahoogroups.com , "raju_nem"
> wrote:
>
> /************************************************************************=
****/
> > /* Vector table and reset entry */
> >
> /************************************************************************=
****/
> > _vectors:
> > ldr pc, ResetAddr /* Reset */
> > ldr pc, UndefAddr /* Undefined instruction */
> > ldr pc, SWIAddr /* Software interrupt */
> > ldr pc, PAbortAddr /* Prefetch abort */
> > ldr pc, DAbortAddr /* Data abort */
> > .word 0xB8A06F60
> > ldr pc, IRQAddr /* IRQ interrupt */
> > ldr pc, FIQAddr /* FIQ interrupt */
> >
> >
> > ResetAddr: .word ResetHandler
> > UndefAddr: .word UndefHandler
> > SWIAddr: .word SWIHandler
> > PAbortAddr: .word PAbortHandler
> > DAbortAddr: .word DAbortHandler
> > ReservedAddr: .word 0
> > IRQAddr: .word IRQHandler
> > FIQAddr: .word FIQHandler
> >
> > .ltorg
> >
> >
> > .section .init, "ax"
> > .code 32
> >
> > .global ResetHandler
> > .global ExitFunction
> > .extern main
> >
> /************************************************************************=
****/
> > /* Default interrupt handler */
> >
> /************************************************************************=
****/
> >
> > UndefHandler:
> > b UndefHandler
> >
> > SWIHandler:
> > b SWIHandler
> >
> > PAbortHandler:
> > b PAbortHandler
> >
> > DAbortHandler:
> > b DAbortHandler
> >
> > IRQHandler:
> > b IRQHandler
> >
> > FIQHandler:
> > b FIQHandler
> >
> > .weak ExitFunction
> > .weak UndefHandler, PAbortHandler, DAbortHandler
> > .weak IRQHandler, FIQHandler
> > I thought you were trying to use the VIC vectored interrupt scheme. Here
> you branch to IRQHandler and then just loop. You could have overridden
> IRQHandler elsewhere but I don't see it.
>
> If you want to use vectored interrupts, your vectors need to look like:
>
> vectors:
> ldr PC, Reset_Addr
> ldr PC, Undef_Addr
> ldr PC, SWI_Addr
> ldr PC, PAbt_Addr
> ldr PC, DAbt_Addr
> nop
> ldr PC, [PC,#-0xFF0] <=3D=3D this reads vector address from VIC
> ldr PC, FIQ_Addr
>
> That particular piece of code works for the LPC2148 due to some magic
> arithmetic related to the current PC and the address of the VIC Vector
> Address. Other variants use a different constant.
>
> I don't know what chip you are using.
>
> Short story: unless you have overridden IRQHandler somewhere else, the ve=
ry
> first interrupt to come along puts the uC into a loop with interrupts
> disabled. It won't be coming back...
>
> Now, there is another story about interrupts using GCC. They don't always
> nest properly. In fact, they don't always work correctly either.
>
> So, I lot of folks change their startup code to provide a wrapper for
> interrupts and then write the interrupt functions as regular C functions
> with NO attributes.
>
> The startup code (for an LPC2106) looks like this:
>
> /*
> *************************************************************************=
**************************************
>
> crt.s STARTUP ASSEMBLY CODE
> -----------------------
>
> Module includes the interrupt vectors and start-up code.
>
> *************************************************************************=
**************************************
> */
>
> /* Stack Sizes */
> .set UND_STACK_SIZE, 0x00000020 /* stack for "undefined instruction"
> interrupts is 4 bytes */
> .set ABT_STACK_SIZE, 0x00000020 /* stack for "abort" interrupts is 4 byte=
s
> */
> .set FIQ_STACK_SIZE, 0x00000020 /* stack for "FIQ" interrupts is 4 bytes =
*/
> .set IRQ_STACK_SIZE, 0X00000020 /* stack for "IRQ" normal interrupts is 4
> bytes */
> .set SVC_STACK_SIZE, 0x00000020 /* stack for "SVC" supervisor mode is 4
> bytes */
>
> /* Standard definitions of Mode bits and Interrupt (I & F) flags in PSRs
> (program status registers) */
> .set MODE_USR, 0x10 /* Normal User Mode */
> .set MODE_FIQ, 0x11 /* FIQ Processing Fast Interrupts Mode */
> .set MODE_IRQ, 0x12 /* IRQ Processing Standard Interrupts Mode */
> .set MODE_SVC, 0x13 /* Supervisor Processing Software Interrupts Mode */
> .set MODE_ABT, 0x17 /* Abort Processing memory Faults Mode */
> .set MODE_UND, 0x1B /* Undefined Processing Undefined Instructions Mode *=
/
> .set MODE_SYS, 0x1F /* System Running Priviledged Operating System Tasks
> Mode */
>
> .set I_BIT, 0x80 /* when I bit is set, IRQ is disabled (program status
> registers) */
> .set F_BIT, 0x40 /* when F bit is set, FIQ is disabled (program status
> registers) */
>
> .set VICVECTADDR, 0xFFFFF030
>
> .text
> .arm
>
> .global Reset_Handler
> .global _startup
> .func _startup
>
> _startup:
>
> # Exception Vectors
>
> _vectors: ldr PC, Reset_Addr
> ldr PC, Undef_Addr
> ldr PC, SWI_Addr
> ldr PC, PAbt_Addr
> ldr PC, DAbt_Addr
> nop /* Reserved Vector (holds Philips ISP checksum) */
> ldr PC, IRQ_Addr
> ldr PC, FIQ_Addr
>
> Reset_Addr: .word Reset_Handler /* defined in this module below */
> Undef_Addr: .word UNDEF_Routine /* defined in interrupt.c */
> SWI_Addr: .word SWI_Routine /* defined in interrupt.c */
> PAbt_Addr: .word UNDEF_Routine /* defined in interrupt.c */
> DAbt_Addr: .word UNDEF_Routine /* defined in interrupt.c */
> IRQ_Addr: .word IRQ_Wrapper /* defined in this module below */
> FIQ_Addr: .word FIQ_Routine /* defined in interrupt.c */
> .word 0 /* rounds the vectors and ISR addresses to 64 bytes total */
>
> # Reset Handler
>
> Reset_Handler:
>
> /* Setup a stack for each mode - note that this only sets up a usable sta=
ck
> for User mode. Also each mode is setup with interrupts initially disabled=
.
> */
>
> ldr r0, =3D_stack_end
> msr CPSR_c, #MODE_UND|I_BIT|F_BIT /* Undefined Instruction Mode */
> mov sp, r0
> sub r0, r0, #UND_STACK_SIZE
> msr CPSR_c, #MODE_ABT|I_BIT|F_BIT /* Abort Mode */
> mov sp, r0
> sub r0, r0, #ABT_STACK_SIZE
> msr CPSR_c, #MODE_FIQ|I_BIT|F_BIT /* FIQ Mode */
> mov sp, r0
> sub r0, r0, #FIQ_STACK_SIZE
> msr CPSR_c, #MODE_IRQ|I_BIT|F_BIT /* IRQ Mode */
> mov sp, r0
> sub r0, r0, #IRQ_STACK_SIZE
> msr CPSR_c, #MODE_SVC|I_BIT|F_BIT /* Supervisor Mode */
> mov sp, r0
> sub r0, r0, #SVC_STACK_SIZE
> msr CPSR_c, #MODE_SYS|I_BIT|F_BIT /* User Mode */
> mov sp, r0
>
> /* copy .data section (Copy from ROM to RAM) */
> ldr R1, =3D_etext
> ldr R2, =3D_data
> ldr R3, =3D_edata
> 1: cmp R2, R3
> ldrlo R0, [R1], #4
> strlo R0, [R2], #4
> blo 1b
>
> /* Clear .bss section (Zero init) */
> mov R0, #0
> ldr R1, =3D_bss_start
> ldr R2, =3D_bss_end
> 2: cmp R1, R2
> strlo R0, [R1], #4
> blo 2b
> MSR CPSR_c,#MODE_SVC /* enable interrupts */
>
> /* Enter the C code */
> b main
>
> IRQ_Wrapper:
>
> stmfd sp!, { lr } /* save return address on IRQ stack */
> mrs lr, spsr /* use lr to save spsr_irq */
> stmfd sp!, { r4-r5, lr } /* save work regs & spsr on stack */
>
> ldr r4, =3DVICVECTADDR /* get the ISR address from VIC */
> ldr r5, [r4]
>
> msr cpsr_c, #MODE_SVC|F_BIT /* supervisor mode, interrupts ON */
>
> stmfd sp!, { r0-r3, r12, lr } /* save work regs & lr_svc on stack */
> mov lr, pc /* set return to common exit of ISR */
>
> mov pc, r5 /* go handle the interrupt */
>
> ldmfd sp!, { r0-r3, r12, lr } /* restore regs & lr_svc */
>
> /* IRQ mode, interrupts OFF */
> msr cpsr_c, #MODE_IRQ|I_BIT|F_BIT
>
> str lr, [r4] /* update VICVectAddr */
>
> ldmfd sp!, { r4-r5, lr } /* restore work regs and spsr_irq */
> msr spsr_cxsf, lr /* put back spsr_irq */
> ldmfd sp!, { lr } /* restore return address */
>
> subs pc, lr, #0x4 /* return, restoring CPSR from SPSR */
> .endfunc
>
> .end
>
> Then the C code to set up Timer0 and the VIC looks like:
>
> // set up Timer 0
> TIMER0_TC =3D 0; // clear the timer count
> TIMER0_PR =3D 1; // prescale divide by 2
> TIMER0_MR0 =3D 14400; // divide by 14400 to get 2048 ints per second
> TIMER0_MCR =3D 0x03; // interrupt on match, reset on match
> TIMER0_TCR =3D 0x01; // start the timer
>
> // set up VIC
> VICVectCntl3 =3D 0x00000024; // set priority 3 for Timer 0
> VICVectAddr3 =3D (unsigned long) T0_ISR;
> VICIntEnable =3D (1 << T0_IntEnBit);
>
> and the timer interrupt code looks like:
>
> void T0_ISR(void)
> {
> ticks++;
>
> if ((ticks & 0x03FF) =3D=3D 0)
> {
> if (ticks & 0x0400)
> IOSET =3D LED;
> else
> IOCLR =3D LED;
> }
>
> TIMER0_IR =3D 0x01;
> }
>
> Note that VicVectAddr is NOT updated inside T0_ISR. It is done in the
> wrapper.
>
> Richard
>
>=20=20
>

--=20
Raju Nalla
Application Engineer
Unistring Tech solution pvt Ltd
[Non-text portions of this message have been removed]

------------------------------------



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: interrupts of RTC - raju_nem - Nov 5 5:00:25 2009

On Sun, Nov 1, 2009 at 11:13 PM, rtstofer wrote:

Ya fine,The last line of the code " VICINTENABLE =3D0x02000; is=
excuted.But controller is not going in to isr function.i am posting the co=
de bellow.help me,thanks in advance.
void readRTC_irq(void) __attribute__((interrupt("IRQ")));
=20
void readRTC_irq()
{

ILR=3D0x1; /* Clearing Interrupt */

printf("\nTime is %d:%d:%d",HOUR,MIN,SEC); /* Printing the time on Serial p=
ort */

VICVECTADDR=3D0x00000000;
}
void Initialize_RTC()
{

unsigned char tim[6],x;
int i;
Tx_string("D0 you want to set the time if yes press 'Y',if No say any key\n=
"); //to print on the hyperterminal
x=3DRx_char();
if(x=3D=3D'Y')
{
Tx_string("Please enter the HOURS:MINUTES:SECONDS\n"); //to pri=
nt on the hyperterminal
for(i=3D0; i<6; i++)
{
tim[i]=3DRx_char(); //to receive the character from=
PC
}
CCR=3D0x12; /* Reset the clock */=20=20=20=20=20=20=20=20=20
ILR=3D0x3; /* Clear the Interrupt Location Register */
CIIR=3D0x01;
PREINT =3D 0x016D; //PREINT =3D int (PCLK / 32768) - 1.
PREFRAC =3D 0x01B00; //PREFRAC =3D PCLK - ((PREINT + 1) =C3=97 =
32768).=20=20=20=20=20=20=20
=20=20=20=20=20=20=20=20=20=20=20=20=20

VICINTSELECT=3D0x00000000;
VICVECTADDR3=3D(unsigned long )readRTC_irq;
VICVECTCNTL3=3D0x2d;
VICINTENABLE =3D0x02000;=20=20=20
=20
HOUR=3D((10*(tim[0]-0x30))+(tim[1]-0x30));
=20=20=20=20=20=20=20=20=20
MIN =3D((10*(tim[2]-0x30))+(tim[3]-0x30));
=20=20=20=20=20
SEC=3D((10*(tim[4]-0x30))+(tim[5]-0x30));
=20
CCR=3D0x11; /* Start RTC */ //use the external clock=
to run the RTC even when power is off
=20=20=20=20=20=20=20=20=20
}
printf("\nTime is %d:%d:%d",HOUR,MIN,SEC);
}
int main()
{=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20
PINSEL0=3D0x00000005;
InitUart0(); /* Initialize Serial port */
MAMCR =3D 0x00000000;
MAMTIM =3D 0x00000003;
MAMCR =3D 0x00000002;

Initialize_RTC(); /* Initialize System */

printf("\nTime is %d:%d:%d",HOUR,MIN,SEC);

while(1)
{
}

}
=20

--- In l...@yahoogroups.com, "rtstofer" wrote:
>
>=20
>=20
> --- In l...@yahoogroups.com, "raju_nem" wrote:
> /************************************************************************=
****/
> > /* Vector table and reset entry =
*/
> > /**********************************************************************=
******/
> > _vectors:
> > ldr pc, ResetAddr /* Reset */
> > ldr pc, UndefAddr /* Undefined instruction */
> > ldr pc, SWIAddr /* Software interrupt */
> > ldr pc, PAbortAddr /* Prefetch abort */
> > ldr pc, DAbortAddr /* Data abort */
> > .word 0xB8A06F60
> > ldr pc, IRQAddr /* IRQ interrupt */
> > ldr pc, FIQAddr /* FIQ interrupt */
> >=20
> >=20
> > ResetAddr: .word ResetHandler
> > UndefAddr: .word UndefHandler
> > SWIAddr: .word SWIHandler
> > PAbortAddr: .word PAbortHandler
> > DAbortAddr: .word DAbortHandler
> > ReservedAddr: .word 0
> > IRQAddr: .word IRQHandler
> > FIQAddr: .word FIQHandler
> >=20
> > .ltorg
> >=20
> >=20
> > .section .init, "ax"
> > .code 32
> >=20=20=20=20
> > .global ResetHandler
> > .global ExitFunction
> > .extern main
> > /**********************************************************************=
******/
> > /* Default interrupt handler =
*/
> > /**********************************************************************=
******/
> >=20
> > UndefHandler:
> > b UndefHandler
> >=20=20=20=20
> > SWIHandler:
> > b SWIHandler
> >=20
> > PAbortHandler:
> > b PAbortHandler
> >=20
> > DAbortHandler:
> > b DAbortHandler
> >=20=20=20=20
> > IRQHandler:
> > b IRQHandler
> >=20=20=20=20
> > FIQHandler:
> > b FIQHandler
> >=20=20=20=20
> > .weak ExitFunction
> > .weak UndefHandler, PAbortHandler, DAbortHandler
> > .weak IRQHandler, FIQHandler
> >=20=20=20=20
>=20
> I thought you were trying to use the VIC vectored interrupt scheme. Here=
you branch to IRQHandler and then just loop. You could have overridden IR=
QHandler elsewhere but I don't see it.
>=20
> If you want to use vectored interrupts, your vectors need to look like:
>=20
> vectors:
> ldr PC, Reset_Addr=20=20=20=20=20=20=20=20=20
> ldr PC, Undef_Addr
> ldr PC, SWI_Addr
> ldr PC, PAbt_Addr
> ldr PC, DAbt_Addr
> nop
> ldr PC, [PC,#-0xFF0] <=3D=3D this reads vector address from VIC
> ldr PC, FIQ_Addr
>=20
>=20
> That particular piece of code works for the LPC2148 due to some magic ari=
thmetic related to the current PC and the address of the VIC Vector Address=
. Other variants use a different constant.
>=20
> I don't know what chip you are using.
>=20
> Short story: unless you have overridden IRQHandler somewhere else, the ve=
ry first interrupt to come along puts the uC into a loop with interrupts di=
sabled. It won't be coming back...
>=20
> Now, there is another story about interrupts using GCC. They don't alway=
s nest properly. In fact, they don't always work correctly either.
>=20
> So, I lot of folks change their startup code to provide a wrapper for int=
errupts and then write the interrupt functions as regular C functions with =
NO attributes.
>=20
> The startup code (for an LPC2106) looks like this:
>=20
> /* **********************************************************************=
*****************************************
>=20
> crt.s STARTUP ASSEMBLY CODE
> -----------------------
>=20
>=20
> Module includes the interrupt vectors and start-up code.
>=20
> ***********************************************************************=
**************************************** */
>=20
> /* Stack Sizes */
> .set UND_STACK_SIZE, 0x00000020 /* stack for "undefined instruction" in=
terrupts is 4 bytes */
> .set ABT_STACK_SIZE, 0x00000020 /* stack for "abort" interrupts is 4 by=
tes */
> .set FIQ_STACK_SIZE, 0x00000020 /* stack for "FIQ" interrupts is 4 byt=
es */
> .set IRQ_STACK_SIZE, 0X00000020 /* stack for "IRQ" normal interrupts is=
4 bytes */
> .set SVC_STACK_SIZE, 0x00000020 /* stack for "SVC" supervisor mode is 4=
bytes */
>=20
>=20
>=20
> /* Standard definitions of Mode bits and Interrupt (I & F) flags in PSRs =
(program status registers) */
> .set MODE_USR, 0x10 /* Normal User Mode */
> .set MODE_FIQ, 0x11 /* FIQ Processing Fast Interrupts Mode =
*/
> .set MODE_IRQ, 0x12 /* IRQ Processing Standard Interrupts M=
ode */
> .set MODE_SVC, 0x13 /* Supervisor Processing Software Inter=
rupts Mode */
> .set MODE_ABT, 0x17 /* Abort Processing memory Faults Mode =
*/
> .set MODE_UND, 0x1B /* Undefined Processing Undefined Instr=
uctions Mode */
> .set MODE_SYS, 0x1F /* System Running Priviledged Operating=
System Tasks Mode */
>=20
> .set I_BIT, 0x80 /* when I bit is set, IRQ is disabled (=
program status registers) */
> .set F_BIT, 0x40 /* when F bit is set, FIQ is disabled (=
program status registers) */
>=20
> .set VICVECTADDR, 0xFFFFF030
>=20
> .text
> .arm
>=20
> .global Reset_Handler
> .global _startup
> .func _startup
>=20
> _startup:
>=20
> # Exception Vectors
>=20
> _vectors: ldr PC, Reset_Addr
> ldr PC, Undef_Addr
> ldr PC, SWI_Addr
> ldr PC, PAbt_Addr
> ldr PC, DAbt_Addr
> nop /* Reserved Vector (holds Philips ISP checksum)=
*/
> ldr PC, IRQ_Addr
> ldr PC, FIQ_Addr
>=20
> Reset_Addr: .word Reset_Handler /* defined in this module below *=
/
> Undef_Addr: .word UNDEF_Routine /* defined in interrupt.c */
> SWI_Addr: .word SWI_Routine /* defined in interrupt.c */
> PAbt_Addr: .word UNDEF_Routine /* defined in interrupt.c */
> DAbt_Addr: .word UNDEF_Routine /* defined in interrupt.c */
> IRQ_Addr: .word IRQ_Wrapper /* defined in this module below */
> FIQ_Addr: .word FIQ_Routine /* defined in interrupt.c */
> .word 0 /* rounds the vectors and ISR addresses to =
64 bytes total */
>=20
>=20
> # Reset Handler
>=20
> Reset_Handler:
>=20
> /* Setup a stack for each mode - note that this only sets up a usable=
stack
> for User mode. Also each mode is setup with interrupts initially di=
sabled. */
>=20
> ldr r0, =3D_stack_end
> msr CPSR_c, #MODE_UND|I_BIT|F_BIT /* Undefined Instruction Mode=
*/
> mov sp, r0
> sub r0, r0, #UND_STACK_SIZE
> msr CPSR_c, #MODE_ABT|I_BIT|F_BIT /* Abort Mode */
> mov sp, r0
> sub r0, r0, #ABT_STACK_SIZE
> msr CPSR_c, #MODE_FIQ|I_BIT|F_BIT /* FIQ Mode */
> mov sp, r0
> sub r0, r0, #FIQ_STACK_SIZE
> msr CPSR_c, #MODE_IRQ|I_BIT|F_BIT /* IRQ Mode */
> mov sp, r0
> sub r0, r0, #IRQ_STACK_SIZE
> msr CPSR_c, #MODE_SVC|I_BIT|F_BIT /* Supervisor Mode */
> mov sp, r0
> sub r0, r0, #SVC_STACK_SIZE
> msr CPSR_c, #MODE_SYS|I_BIT|F_BIT /* User Mode */
> mov sp, r0
>=20
> /* copy .data section (Copy from ROM to RAM) */
> ldr R1, =3D_etext
> ldr R2, =3D_data
> ldr R3, =3D_edata
> 1: cmp R2, R3
> ldrlo R0, [R1], #4
> strlo R0, [R2], #4
> blo 1b
>=20
> /* Clear .bss section (Zero init) */
> mov R0, #0
> ldr R1, =3D_bss_start
> ldr R2, =3D_bss_end
> 2: cmp R1, R2
> strlo R0, [R1], #4
> blo 2b
>=20
> MSR CPSR_c,#MODE_SVC /* enable interrupts */
>=20
> /* Enter the C code */
> b main
>=20
>=20
> IRQ_Wrapper:
>=20
> stmfd sp!, { lr } /* save return address on IRQ stack */
> mrs lr, spsr /* use lr to save spsr_irq */
> stmfd sp!, { r4-r5, lr } /* save work regs & spsr on stack */
>=20
> ldr r4, =3DVICVECTADDR /* get the ISR address from VIC */
> ldr r5, [r4]
>=20
> msr cpsr_c, #MODE_SVC|F_BIT /* supervisor mode, interrupts ON */
>=20
> stmfd sp!, { r0-r3, r12, lr } /* save work regs & lr_svc on stack */
> mov lr, pc /* set return to common exit of ISR */
>=20
> mov pc, r5 /* go handle the interrupt */
>=20
> ldmfd sp!, { r0-r3, r12, lr } /* restore regs & lr_svc */
>=20
> /* IRQ mode, interrupts OFF */
> msr cpsr_c, #MODE_IRQ|I_BIT|F_BIT
>=20
> str lr, [r4] /* update VICVectAddr */
>=20
> ldmfd sp!, { r4-r5, lr } /* restore work regs and spsr_irq */
> msr spsr_cxsf, lr /* put back spsr_irq */
> ldmfd sp!, { lr } /* restore return address */
>=20
> subs pc, lr, #0x4 /* return, restoring CPSR from SPSR */
> .endfunc
>=20
> .end
>=20
>=20
> Then the C code to set up Timer0 and the VIC looks like:
>=20
> // set up Timer 0
> TIMER0_TC =3D 0; // clear the timer count
> TIMER0_PR =3D 1; // prescale divide by 2
> TIMER0_MR0 =3D 14400; // divide by 14400 to get 2048 ints per second
> TIMER0_MCR =3D 0x03; // interrupt on match, reset on match
> TIMER0_TCR =3D 0x01; // start the timer
>=20
> // set up VIC
> VICVectCntl3 =3D 0x00000024; // set priority 3 for Timer 0
> VICVectAddr3 =3D (unsigned long) T0_ISR;
> VICIntEnable =3D (1 << T0_IntEnBit);
>=20
> and the timer interrupt code looks like:
>=20
> void T0_ISR(void)
> {
> ticks++;
>=20
> if ((ticks & 0x03FF) =3D=3D 0)
> {
> if (ticks & 0x0400)
> IOSET =3D LED;
> else
> IOCLR =3D LED;
> }
>=20
> TIMER0_IR =3D 0x01;
> }
>=20
> Note that VicVectAddr is NOT updated inside T0_ISR. It is done in the wr=
apper.
>=20
> Richard
>

------------------------------------



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: interrupts of RTC - rtstofer - Nov 5 8:51:22 2009



--- In l...@yahoogroups.com, "raju_nem" wrote:
>
> On Sun, Nov 1, 2009 at 11:13 PM, rtstofer wrote:
>
> Ya fine,The last line of the code " VICINTENABLE =0x02000; is excuted.But controller is not going in to isr function.i am posting the code bellow.help me,thanks in advance.
>
As I pointed out earlier, your interrupt vectors are (or were) not reading the VIC vector address. Instead, you were branching to a handler in the startup code that did nothing.

So, if you aren't getting at least one interrupt, look at the startup vectors to be certain you are reading from the VIC and make sure you are enabling interrupts before branching to main().

Richard

------------------------------------



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: interrupts of RTC - raju_nem - Nov 6 2:32:20 2009

Hi,rtstofer

Thank u,Can u post right startup code or crt.s file here.i am using GNU arm gcc comipler on windows operating system.I tried by keeping vector adress

Reset 0x00
undefined oxo4
SWI 0x08
Prefecth abort 0x0C
data abort 0x10
IRQ 0x18
FIQ 0x1c

It is not working.Help me thanks in advance.

--- In l...@yahoogroups.com, "rtstofer" wrote:
>
> --- In l...@yahoogroups.com, "raju_nem" wrote:
> >
> > On Sun, Nov 1, 2009 at 11:13 PM, rtstofer wrote:
> >
> > Ya fine,The last line of the code " VICINTENABLE =0x02000; is excuted.But controller is not going in to isr function.i am posting the code bellow.help me,thanks in advance.
> >
> As I pointed out earlier, your interrupt vectors are (or were) not reading the VIC vector address. Instead, you were branching to a handler in the startup code that did nothing.
>
> So, if you aren't getting at least one interrupt, look at the startup vectors to be certain you are reading from the VIC and make sure you are enabling interrupts before branching to main().
>
> Richard
>

------------------------------------



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: interrupts of RTC - rtstofer - Nov 6 8:52:55 2009



--- In l...@yahoogroups.com, "raju_nem" wrote:
>
> Hi,rtstofer
>
> Thank u,Can u post right startup code or crt.s file here.i am using GNU arm gcc comipler on windows operating system.I tried by keeping vector adress
>
> Reset 0x00
> undefined oxo4
> SWI 0x08
> Prefecth abort 0x0C
> data abort 0x10
> IRQ 0x18
> FIQ 0x1c
>
> It is not working.Help me thanks in advance.
>

I have no idea which processor you are using. If it is the LPC2148 (and other LPC21xx), the vectors look like this:

_vectors: ldr PC, Reset_Addr
ldr PC, Undef_Addr
ldr PC, SWI_Addr
ldr PC, PAbt_Addr
ldr PC, DAbt_Addr
nop /* Reserved Vector (holds Philips ISP checksum) */
ldr PC, [PC,#-0xFF0] /* see page 71 of "Insiders Guide to the Philips ARM7-Based Microcontrollers" by Trevor Martin */
ldr PC, FIQ_Addr

The important change is the instruction:

ldr PC, [PC,#-0xFF0]

Which, when an IRQ occurs, grabs the vector address from the VIC. This works by magic based on the contents of the PC and the constant to form the address of the VicVectAddr register. That's why it is important to know WHICH LPC you are using. They're not all the same.

You can get a perfectly adequate startup file from the Files section of this group. I have posted ARM2148Timer.zip which has such a file.

Look at the bottom of the file:

MSR CPSR_c,#MODE_SVC /* enable interrupts */
MSR CPSR_c,#MODE_USR
b main /* Enter the C code */

This is the code that enables the interrupt system. Delete the 2d MSR instruction, it is a mistake. It leave the processor in User mode and most embedded programs run in Supervisor mode (SVC).

Ignore the rest of the code. It is someone else's attempt at using a timer.

Richard

------------------------------------

______________________________
Stellaris® MCU Family: New Parts, New Package, New Price.


(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: interrupts of RTC - raju_nem - Nov 6 10:07:40 2009


Hi,rtstofer
Thank u,i am slowly getting commanding on the interrupts.i am using lpc2148.i copied the crt.s file from u r ARM2148rimer.zip file in to my folder.i removed the

MSR CPSR_c,#MODE_USR

instruction.then i tried for compilation.it is giving errors.

error 1:Undefined reference to _stack_end

error 1:Undefined reference to _etext
error 2:Undefined reference to =_data
error 3:Undefined reference to =_edata

error 4:Undefined reference to _bss_start
error 5:Undefined reference to _bss_end
error 6:Undefined reference to UNDEF_Routine

error 7:Undefined reference to SWI_Routine

error 8:Undefined reference to UNDEF_Routine

error 9:Undefined reference to UNDEF_Routine

error 10:Undefined reference to IRQ_Routine
error 11:Undefined reference to FIQ_Routine

i have seen the page 71 of that book what u mentioned,there it is given that,when IRQ occures,it controller goes to 0xffffff020 location.

How to rectify there errors?do u have any idea?help me, thanks in advance.
--- In l...@yahoogroups.com, "rtstofer" wrote:
>
> --- In l...@yahoogroups.com, "raju_nem" wrote:
> >
> > Hi,rtstofer
> >
> > Thank u,Can u post right startup code or crt.s file here.i am using GNU arm gcc comipler on windows operating system.I tried by keeping vector adress
> >
> > Reset 0x00
> > undefined oxo4
> > SWI 0x08
> > Prefecth abort 0x0C
> > data abort 0x10
> > IRQ 0x18
> > FIQ 0x1c
> >
> > It is not working.Help me thanks in advance.
> > I have no idea which processor you are using. If it is the LPC2148 (and other LPC21xx), the vectors look like this:
>
> _vectors: ldr PC, Reset_Addr
> ldr PC, Undef_Addr
> ldr PC, SWI_Addr
> ldr PC, PAbt_Addr
> ldr PC, DAbt_Addr
> nop /* Reserved Vector (holds Philips ISP checksum) */
> ldr PC, [PC,#-0xFF0] /* see page 71 of "Insiders Guide to the Philips ARM7-Based Microcontrollers" by Trevor Martin */
> ldr PC, FIQ_Addr
>
> The important change is the instruction:
>
> ldr PC, [PC,#-0xFF0]
>
> Which, when an IRQ occurs, grabs the vector address from the VIC. This works by magic based on the contents of the PC and the constant to form the address of the VicVectAddr register. That's why it is important to know WHICH LPC you are using. They're not all the same.
>
> You can get a perfectly adequate startup file from the Files section of this group. I have posted ARM2148Timer.zip which has such a file.
>
> Look at the bottom of the file:
>
> MSR CPSR_c,#MODE_SVC /* enable interrupts */
> MSR CPSR_c,#MODE_USR
> b main /* Enter the C code */
>
> This is the code that enables the interrupt system. Delete the 2d MSR instruction, it is a mistake. It leave the processor in User mode and most embedded programs run in Supervisor mode (SVC).
>
> Ignore the rest of the code. It is someone else's attempt at using a timer.
>
> Richard
>

------------------------------------



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: interrupts of RTC - rtstofer - Nov 6 10:18:13 2009



--- In l...@yahoogroups.com, "raju_nem" wrote:
> Hi,rtstofer
> Thank u,i am slowly getting commanding on the interrupts.i am using lpc2148.i copied the crt.s file from u r ARM2148rimer.zip file in to my folder.i removed the
>
> MSR CPSR_c,#MODE_USR
>
> instruction.then i tried for compilation.it is giving errors.
>
> error 1:Undefined reference to _stack_end
>
> error 1:Undefined reference to _etext
> error 2:Undefined reference to =_data
> error 3:Undefined reference to =_edata
>
> error 4:Undefined reference to _bss_start
> error 5:Undefined reference to _bss_end
> error 6:Undefined reference to UNDEF_Routine
>
> error 7:Undefined reference to SWI_Routine
>
> error 8:Undefined reference to UNDEF_Routine
>
> error 9:Undefined reference to UNDEF_Routine
>
> error 10:Undefined reference to IRQ_Routine
> error 11:Undefined reference to FIQ_Routine
>

OOPS! My bad! The undefined xxx_Routine are all in main.c They don't do anything, just loop. Copy them to your main.c and ignore them. Other people have these in their startup file. Your original file worked this way.

The _etext and similar errors are corrected when you use the linker script lpc2148-FLASH.ld These symbols are defined in the linker script and tell the startup code where certain areas of memory are located.

If you are using the GNU toolchain, you will need the linker script. The included Makefile handles all of this.

I don't recall which toolchain you are using.

Richard

------------------------------------



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: interrupts of RTC - rtstofer - Nov 6 13:07:16 2009



--- In l...@yahoogroups.com, "rtstofer" wrote:
>
> --- In l...@yahoogroups.com, "raju_nem" wrote:
> >
> >
> > Hi,rtstofer
> >
> >
> > Thank u,i am slowly getting commanding on the interrupts.i am using lpc2148.i copied the crt.s file from u r ARM2148rimer.zip file in to my folder.i removed the
> >
> > MSR CPSR_c,#MODE_USR
> >
> > instruction.then i tried for compilation.it is giving errors.
> >
> > error 1:Undefined reference to _stack_end
> >
> > error 1:Undefined reference to _etext
> > error 2:Undefined reference to =_data
> > error 3:Undefined reference to =_edata
> >
> > error 4:Undefined reference to _bss_start
> > error 5:Undefined reference to _bss_end
> >
> >
> > error 6:Undefined reference to UNDEF_Routine
> >
> > error 7:Undefined reference to SWI_Routine
> >
> > error 8:Undefined reference to UNDEF_Routine
> >
> > error 9:Undefined reference to UNDEF_Routine
> >
> > error 10:Undefined reference to IRQ_Routine
> >
> >
> > error 11:Undefined reference to FIQ_Routine
> > OOPS! My bad! The undefined xxx_Routine are all in main.c They don't do anything, just loop. Copy them to your main.c and ignore them. Other people have these in their startup file. Your original file worked this way.
>
> The _etext and similar errors are corrected when you use the linker script lpc2148-FLASH.ld These symbols are defined in the linker script and tell the startup code where certain areas of memory are located.
>
> If you are using the GNU toolchain, you will need the linker script. The included Makefile handles all of this.
>
> I don't recall which toolchain you are using.
>
> Richard
>

If you are using a different build environment, maybe you can just change that one instruction in your startup file. It would be easier than merging all the stuff from my project.

Richard

------------------------------------



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: interrupts of RTC - raju_nem - Nov 7 8:01:20 2009

Hi,rtstofer
Thank u,i copied the xxx_Routine and linker script lpc2148-FLASH.ld file in to my code.It is working fine. But one final problem occured.
int main()
{
PINSEL0=0x00000005;
InitUart0(); /* Initialize Serial port */
MAMCR = 0x00000000;
MAMTIM = 0x00000003;
MAMCR = 0x00000002;

Tx_string("serial port initialization is over\n");//to diaplay on PC
Initialize_RTC();

VICINTSELECT=0x00000000;
VICVECTADDR3=(unsigned long )readRTC_irq;
Tx_string("serial port initialization is over1\n");
VICVECTCNTL3=0x2d;
Tx_string("serial port initialization is over2\n");
VICINTENABLE =0x02000;
Tx_string("serial port initialization is over3\n");
while(1)
{

}
}

AS long as the nothing is doing in while loop in the above code(main function),if cpu getting interrupt, it is going to ISR and come back to the while loop.In this case, it is working fine.
BUT

When i am trying to do something (for example:printing using the Tx_string function)in the while loop,first time interrupt occures,it is going to isr(entire isr function is excuting properly) and it NOT come back to main while loop.ISR (readRTC_irq()) is given bellow.

void readRTC_irq()
{
Tx_string("\n I am in ISR\n");

printf("\nTime is %d:%d:%d",HOUR,MIN,SEC);

Tx_string("\nserial port initialization is over5\n");

ILR=0x1; /* Clearing Interrupt */

Tx_string("serial port initialization is over6\n");

Tx_string("serial port initialization is over7\n");

VICVECTADDR=0x00000000;
}

What may be reason?help me thanks in advance.
--- In l...@yahoogroups.com, "rtstofer" wrote:
>
> --- In l...@yahoogroups.com, "raju_nem" wrote:
> >
> >
> > Hi,rtstofer
> >
> >
> > Thank u,i am slowly getting commanding on the interrupts.i am using lpc2148.i copied the crt.s file from u r ARM2148rimer.zip file in to my folder.i removed the
> >
> > MSR CPSR_c,#MODE_USR
> >
> > instruction.then i tried for compilation.it is giving errors.
> >
> > error 1:Undefined reference to _stack_end
> >
> > error 1:Undefined reference to _etext
> > error 2:Undefined reference to =_data
> > error 3:Undefined reference to =_edata
> >
> > error 4:Undefined reference to _bss_start
> > error 5:Undefined reference to _bss_end
> >
> >
> > error 6:Undefined reference to UNDEF_Routine
> >
> > error 7:Undefined reference to SWI_Routine
> >
> > error 8:Undefined reference to UNDEF_Routine
> >
> > error 9:Undefined reference to UNDEF_Routine
> >
> > error 10:Undefined reference to IRQ_Routine
> >
> >
> > error 11:Undefined reference to FIQ_Routine
> > OOPS! My bad! The undefined xxx_Routine are all in main.c They don't do anything, just loop. Copy them to your main.c and ignore them. Other people have these in their startup file. Your original file worked this way.
>
> The _etext and similar errors are corrected when you use the linker script lpc2148-FLASH.ld These symbols are defined in the linker script and tell the startup code where certain areas of memory are located.
>
> If you are using the GNU toolchain, you will need the linker script. The included Makefile handles all of this.
>
> I don't recall which toolchain you are using.
>
> Richard
>

------------------------------------

______________________________
Stellaris® MCU Family: New Parts, New Package, New Price.


(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: interrupts of RTC - raju_nem - Nov 7 8:07:18 2009


Hi,rtstofer

void IRQ_Routine (void) {
while (1) ;
}

void FIQ_Routine (void) {
while (1) ;
}

void SWI_Routine (void) {
while (1) ;
}
void UNDEF_Routine (void) {
while (1) ;
}
in the above routines while(1) is there,is this creating problem?
--- In l...@yahoogroups.com, "raju_nem" wrote:
>
> Hi,rtstofer
> Thank u,i copied the xxx_Routine and linker script lpc2148-FLASH.ld file in to my code.It is working fine. But one final problem occured.
> int main()
> {
> PINSEL0=0x00000005;
> InitUart0(); /* Initialize Serial port */
> MAMCR = 0x00000000;
> MAMTIM = 0x00000003;
> MAMCR = 0x00000002;
>
> Tx_string("serial port initialization is over\n");//to diaplay on PC
> Initialize_RTC();
>
> VICINTSELECT=0x00000000;
> VICVECTADDR3=(unsigned long )readRTC_irq;
> Tx_string("serial port initialization is over1\n");
> VICVECTCNTL3=0x2d;
> Tx_string("serial port initialization is over2\n");
> VICINTENABLE =0x02000;
> Tx_string("serial port initialization is over3\n");
> while(1)
> {
>
>
> }
> }
>
> AS long as the nothing is doing in while loop in the above code(main function),if cpu getting interrupt, it is going to ISR and come back to the while loop.In this case, it is working fine.
> BUT
>
> When i am trying to do something (for example:printing using the Tx_string function)in the while loop,first time interrupt occures,it is going to isr(entire isr function is excuting properly) and it NOT come back to main while loop.ISR (readRTC_irq()) is given bellow.
>
> void readRTC_irq()
> {
> Tx_string("\n I am in ISR\n");
>
> printf("\nTime is %d:%d:%d",HOUR,MIN,SEC);
>
> Tx_string("\nserial port initialization is over5\n");
>
> ILR=0x1; /* Clearing Interrupt */
>
> Tx_string("serial port initialization is over6\n");
>
> Tx_string("serial port initialization is over7\n");
>
> VICVECTADDR=0x00000000;
> }
>
> What may be reason?help me thanks in advance.
> --- In l...@yahoogroups.com, "rtstofer" wrote:
> >
> >
> >
> > --- In l...@yahoogroups.com, "raju_nem" wrote:
> > >
> > >
> > > Hi,rtstofer
> > >
> > >
> > > Thank u,i am slowly getting commanding on the interrupts.i am using lpc2148.i copied the crt.s file from u r ARM2148rimer.zip file in to my folder.i removed the
> > >
> > > MSR CPSR_c,#MODE_USR
> > >
> > > instruction.then i tried for compilation.it is giving errors.
> > >
> > > error 1:Undefined reference to _stack_end
> > >
> > > error 1:Undefined reference to _etext
> > > error 2:Undefined reference to =_data
> > > error 3:Undefined reference to =_edata
> > >
> > > error 4:Undefined reference to _bss_start
> > > error 5:Undefined reference to _bss_end
> > >
> > >
> > > error 6:Undefined reference to UNDEF_Routine
> > >
> > > error 7:Undefined reference to SWI_Routine
> > >
> > > error 8:Undefined reference to UNDEF_Routine
> > >
> > > error 9:Undefined reference to UNDEF_Routine
> > >
> > > error 10:Undefined reference to IRQ_Routine
> > >
> > >
> > > error 11:Undefined reference to FIQ_Routine
> > >
> >
> > OOPS! My bad! The undefined xxx_Routine are all in main.c They don't do anything, just loop. Copy them to your main.c and ignore them. Other people have these in their startup file. Your original file worked this way.
> >
> > The _etext and similar errors are corrected when you use the linker script lpc2148-FLASH.ld These symbols are defined in the linker script and tell the startup code where certain areas of memory are located.
> >
> > If you are using the GNU toolchain, you will need the linker script. The included Makefile handles all of this.
> >
> > I don't recall which toolchain you are using.
> >
> > Richard
>

------------------------------------

______________________________
Stellaris® MCU Family: New Parts, New Package, New Price.


(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: interrupts of RTC - rtstofer - Nov 7 9:20:41 2009



--- In l...@yahoogroups.com, "raju_nem" wrote:
> Hi,rtstofer
>
> void IRQ_Routine (void) {
> while (1) ;
> }
>
> void FIQ_Routine (void) {
> while (1) ;
> }
>
> void SWI_Routine (void) {
> while (1) ;
> }
> void UNDEF_Routine (void) {
> while (1) ;
> }
> in the above routines while(1) is there,is this creating problem?
> --- In l...@yahoogroups.com, "raju_nem" wrote:
When the RTC interrupts, the VIC provides the address of the handler. That's why you modified the startup vectors. So, unless something else is going on (another interrupt), none of those interrupt routines are ever executed.

OTOH, none of those interrupt routines are valid without the proper prototype and I didn't provide those. I stuck the functions in this code just to get it to compile. The code, as given, never uses interrupts. IOW, these functions are both invalid and not used.

The prototypes would look like:

void IRQ_Routine (void) __attribute__ ((interrupt("IRQ")));
void FIQ_Routine (void) __attribute__ ((interrupt("FIQ")));
void SWI_Routine (void) __attribute__ ((interrupt("SWI")));
void UNDEF_Routine (void) __attribute__ ((interrupt("UNDEF")));

You can add these prototypes to the top of your file if you wish but it won't change anything. Since the functions never return and GCC doesn't handle nested interrupts, once one of these functions gets called, the chip will just loop forever.

The prototype for your RTC interrupt handler should look like:

void readRTC_irq (void) __attribute__ (( interrupt ));

I don't think people have been successful putting printf() calls inside of interrupt functions. At least it isn't really recommended.

There is another problem. GCC interrupt functions don't always work for every incantation of the compiler. Even then, they don't allow for nested interrupts (interrupts are disabled throughout the handler). So, whenever an interrupt function appears to fail, assume the problem is with GCC (or a particular version).

The solution is to get rid of the __attribute__ stuff entirely. This also makes the code somewhat more portable in that there are no GCC specific attributes.

In the Files folder there is a file ARM2106Timer.zip In the startup file, there is some code (IRQWrapper) that provides the proper entry and exit code for interrupt routines. It also allows priority nesting. Note that the IRQ vector is changed to branch indirectly to the IRQ wrapper.

Look at the prototype for void T0_ISR in interrupt.h:

void T0_ISR(void);

It doesn't get much cleaner than that!

Now that you have the interrupt working, it is time to clean up the code. Consider changing the startup code to include the wrapper and somehow moving the printf() calls outside the interrupt handler.

Richard

------------------------------------

______________________________
Stellaris® MCU Family: New Parts, New Package, New Price.


(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: interrupts of RTC - raju_nem - Nov 9 14:39:21 2009


HI rstofer
Thank u for u r information.i copied IRQ WRAPPER in to startup file and below statements also.

void IRQ_Routine (void) __attribute__ ((interrupt("IRQ")));
> void FIQ_Routine (void) __attribute__ ((interrupt("FIQ")));
> void SWI_Routine (void) __attribute__ ((interrupt("SWI")));
> void UNDEF_Routine (void) __attribute__ ((interrupt("UNDEF")));

Same thing is happening.i.e initially in the main while loop,whatever is there for printing,it is printing.Once interrupt occures,it is going to isr function,and this isr function is excuting infinetly,i.e it is not coming to main while loop at all.
What am doing is, for every sec rtc get interrupted and it going to isr,it is printing the correspond time for every sec in isr.but i when
i copied that IRQ WAPPER function in to start up file,the isr is excuting infinetly,it is printing same time mutliple times instead printing every sec.For example

RTC time is 11:01:1

RTC time is 11:01:1

RTC time is 11:01:1

RTC time is 11:01:1

RTC time is 11:01:1

RTC time is 11:01:2

RTC time is 11:01:2

RTC time is 11:01:2

RTC time is 11:01:2
RTC time is 11:01:2

.etc

u told that donot put printf calls inside the isr functions.just for testing purpose i am using the printf in rtc isr function.
what may be solution for above problem?Not coming to main function where it is interrupted,is this compiler problem? help me,thanks inadvance.

--- In l...@yahoogroups.com, "rtstofer" wrote:
>
> --- In l...@yahoogroups.com, "raju_nem" wrote:
> >
> >
> > Hi,rtstofer
> >
> > void IRQ_Routine (void) {
> > while (1) ;
> > }
> >
> > void FIQ_Routine (void) {
> > while (1) ;
> > }
> >
> > void SWI_Routine (void) {
> > while (1) ;
> > }
> >
> >
> > void UNDEF_Routine (void) {
> > while (1) ;
> > }
> >
> >
> > in the above routines while(1) is there,is this creating problem?
> > --- In l...@yahoogroups.com, "raju_nem" wrote:
> When the RTC interrupts, the VIC provides the address of the handler. That's why you modified the startup vectors. So, unless something else is going on (another interrupt), none of those interrupt routines are ever executed.
>
> OTOH, none of those interrupt routines are valid without the proper prototype and I didn't provide those. I stuck the functions in this code just to get it to compile. The code, as given, never uses interrupts. IOW, these functions are both invalid and not used.
>
> The prototypes would look like:
>
> void IRQ_Routine (void) __attribute__ ((interrupt("IRQ")));
> void FIQ_Routine (void) __attribute__ ((interrupt("FIQ")));
> void SWI_Routine (void) __attribute__ ((interrupt("SWI")));
> void UNDEF_Routine (void) __attribute__ ((interrupt("UNDEF")));
>
> You can add these prototypes to the top of your file if you wish but it won't change anything. Since the functions never return and GCC doesn't handle nested interrupts, once one of these functions gets called, the chip will just loop forever.
>
> The prototype for your RTC interrupt handler should look like:
>
> void readRTC_irq (void) __attribute__ (( interrupt ));
>
> I don't think people have been successful putting printf() calls inside of interrupt functions. At least it isn't really recommended.
>
> There is another problem. GCC interrupt functions don't always work for every incantation of the compiler. Even then, they don't allow for nested interrupts (interrupts are disabled throughout the handler). So, whenever an interrupt function appears to fail, assume the problem is with GCC (or a particular version).
>
> The solution is to get rid of the __attribute__ stuff entirely. This also makes the code somewhat more portable in that there are no GCC specific attributes.
>
> In the Files folder there is a file ARM2106Timer.zip In the startup file, there is some code (IRQWrapper) that provides the proper entry and exit code for interrupt routines. It also allows priority nesting. Note that the IRQ vector is changed to branch indirectly to the IRQ wrapper.
>
> Look at the prototype for void T0_ISR in interrupt.h:
>
> void T0_ISR(void);
>
> It doesn't get much cleaner than that!
>
> Now that you have the interrupt working, it is time to clean up the code. Consider changing the startup code to include the wrapper and somehow moving the printf() calls outside the interrupt handler.
>
> Richard
>

------------------------------------



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: interrupts of RTC - rtstofer - Nov 9 15:29:15 2009



--- In l...@yahoogroups.com, "raju_nem" wrote:
> HI rstofer
> Thank u for u r information.i copied IRQ WRAPPER in to startup file and below statements also.

> void IRQ_Routine (void) __attribute__ ((interrupt("IRQ")));

^^^^^ DELETE THIS PROTOTYPE AND THE RELATED FUNCTION ^^^^^

> > void FIQ_Routine (void) __attribute__ ((interrupt("FIQ")));
> > void SWI_Routine (void) __attribute__ ((interrupt("SWI")));
> > void UNDEF_Routine (void) __attribute__ ((interrupt("UNDEF")));

^^^^^ KEEP THESE PROTOTYPES AND RELATED FUNCTIONS ^^^^^
Look again at how the vectors need to be changed:
_vectors: ldr PC, Reset_Addr
ldr PC, Undef_Addr
ldr PC, SWI_Addr
ldr PC, PAbt_Addr
ldr PC, DAbt_Addr
nop ldr PC, IRQ_Addr <--- LOOK AT THIS!
ldr PC, FIQ_Addr

Reset_Addr: .word Reset_Handler
Undef_Addr: .word UNDEF_Routine
SWI_Addr: .word SWI_Routine
PAbt_Addr: .word UNDEF_Routine
DAbt_Addr: .word UNDEF_Routine
IRQ_Addr: .word IRQ_Wrapper <--- LOOK AT THIS!
FIQ_Addr: .word FIQ_Routine
.word 0

Note that the IRQ vector picks up the address of the IRQ_Wrapper stored in the word at IRQ_Addr

You already included this:

IRQ_Wrapper:
stmfd sp!, { lr }
mrs lr, spsr
stmfd sp!, { r4-r5, lr }
ldr r4, =VICVECTADDR
ldr r5, [r4]
msr cpsr_c, #MODE_SVC|F_BIT
stmfd sp!, { r0-r3, r12, lr }
mov lr, pc
mov pc, r5
ldmfd sp!, { r0-r3, r12, lr }
msr cpsr_c, #MODE_IRQ|I_BIT|F_BIT
str lr, [r4]
ldmfd sp!, { r4-r5, lr }
msr spsr_cxsf, lr
ldmfd sp!, { lr }
subs pc, lr, #0x4

Richard

------------------------------------



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: interrupts of RTC - rtstofer - Nov 9 15:51:57 2009

> _vectors:
ldr PC, Reset_Addr
ldr PC, Undef_Addr
ldr PC, SWI_Addr
ldr PC, PAbt_Addr
ldr PC, DAbt_Addr
nop
ldr PC, IRQ_Addr <--- LOOK AT THIS!
ldr PC, FIQ_Addr

Yahoo helped mess up the vectors by combining the nop (checksum) instructions with the ldr PC, IRQ_Addr

Richard

------------------------------------



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: interrupts of RTC - raju_nem - Nov 10 4:35:47 2009

Hi "rtstofer"
i did same thing what u have said,is follows.

_vectors: ldr PC, Reset_Addr
ldr PC, Undef_Addr
ldr PC, SWI_Addr
ldr PC, PAbt_Addr
ldr PC, DAbt_Addr
nop
ldr PC, IRQ_Addr
ldr PC, FIQ_Addr

Reset_Addr: .word Reset_Handler
Undef_Addr: .word UNDEF_Routine
SWI_Addr: .word SWI_Routine
PAbt_Addr: .word UNDEF_Routine
DAbt_Addr: .word UNDEF_Routine
IRQ_Addr: .word IRQ_Wrapper
FIQ_Addr: .word FIQ_Routine
.word 0

IRQ_Wrapper: stmfd sp!, { lr }
mrs lr, spsr

stmfd sp!, { r4-r5, lr }

ldr r4, =VICVECTADDR

ldr r5, [r4]

msr cpsr_c, #MODE_SVC|F_BIT

stmfd sp!, { r0-r3, r12, lr }
mov lr, pc
mov pc, r5

ldmfd sp!, { r0-r3, r12, lr }

msr cpsr_c, #MODE_IRQ|I_BIT|F_BIT

str lr, [r4]
ldmfd sp!, { r4-r5, lr }
msr spsr_cxsf, lr
ldmfd sp!, { lr }

subs pc, lr, #0x4
It is giving error that undefined reference to VICVECTADDR in IRQ_Wrapper. VICVECTADDR is same as in lpc2148.h file.still it giving error.what may be the reason?

--- In l...@yahoogroups.com, "rtstofer" wrote:
>
> > _vectors:
> ldr PC, Reset_Addr
> ldr PC, Undef_Addr
> ldr PC, SWI_Addr
> ldr PC, PAbt_Addr
> ldr PC, DAbt_Addr
> nop
> ldr PC, IRQ_Addr <--- LOOK AT THIS!
> ldr PC, FIQ_Addr
>
> Yahoo helped mess up the vectors by combining the nop (checksum) instructions with the ldr PC, IRQ_Addr
>
> Richard
>

------------------------------------



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: interrupts of RTC - rtstofer - Nov 10 8:50:36 2009



--- In l...@yahoogroups.com, "raju_nem" wrote:

> It is giving error that undefined reference to VICVECTADDR in IRQ_Wrapper. VICVECTADDR is same as in lpc2148.h file.still it giving error.what may be the reason?
Near the top of the startup file, add the line:

.set VICVECTADDR, 0xFFFFF030

This will define the VICVECTADDR.

Richard

------------------------------------



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: interrupts of RTC - raju_nem - Nov 10 14:37:20 2009


Hi richard,

No change in the output even i made the things which r suggested by u.I.e isr function is excuting infinetly.it is not coming to main function.still what are the modifications i need to be done to get the expected output?

--- In l...@yahoogroups.com, "rtstofer" wrote:
>
> --- In l...@yahoogroups.com, "raju_nem" wrote:
>
> > It is giving error that undefined reference to VICVECTADDR in IRQ_Wrapper. VICVECTADDR is same as in lpc2148.h file.still it giving error.what may be the reason?
> Near the top of the startup file, add the line:
>
> .set VICVECTADDR, 0xFFFFF030
>
> This will define the VICVECTADDR.
>
> Richard
>

------------------------------------

______________________________
Stellaris® MCU Family: New Parts, New Package, New Price.


(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: interrupts of RTC - capiman26061973 - Nov 10 14:56:30 2009



Hello Richard, hello Rajun,

would it not be easier if Rajun just zips the complete directory / project and upload it to files area ?

I think, there should already be a big thank you to Richard for the great support, not only to Rajun, but also to a lot others !

Regards,

Martin

--- In l...@yahoogroups.com, "raju_nem" wrote:
> Hi richard,
>
> No change in the output even i made the things which r suggested by u.I.e isr function is excuting infinetly.it is not coming to main function.still what are the modifications i need to be done to get the expected output?
>
> --- In l...@yahoogroups.com, "rtstofer" wrote:
> >
> >
> >
> > --- In l...@yahoogroups.com, "raju_nem" wrote:
> >
> > > It is giving error that undefined reference to VICVECTADDR in IRQ_Wrapper. VICVECTADDR is same as in lpc2148.h file.still it giving error.what may be the reason?
> >
> >
> > Near the top of the startup file, add the line:
> >
> > .set VICVECTADDR, 0xFFFFF030
> >
> > This will define the VICVECTADDR.
> >
> > Richard
>

------------------------------------



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: interrupts of RTC - rtstofer - Nov 10 16:26:44 2009



--- In l...@yahoogroups.com, "capiman26061973" wrote:
>
> Hello Richard, hello Rajun,
>
> would it not be easier if Rajun just zips the complete directory / project and upload it to files area ?
>
> I think, there should already be a big thank you to Richard for the great support, not only to Rajun, but also to a lot others !
>
> Regards,
>
> Martin

Sure, zipping it up and posting it is likely to result in a working sample a lot faster than it has been going.

The only reason I haven't posted a working RTC project is that I don't have one. I have never used the RTC.

I almost always recommend that folks check out the excellent code at www.jcwren.com/arm That's where I get a lot of my code and I have learned a lot about the overall strategy of building a large project from JC's code.

Richard

------------------------------------



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: interrupts of RTC - jcdmelo - Nov 11 7:23:19 2009



Richard,

You misread Martin's e-mail: it should be Rajun to zip and upload his files, not you. I aggree with him too that you've been a heck of a consultant on this issue of RTC interrupts. Why not give a chance to Rajun to sweat a little now?

Julio de Melo

--- In l...@yahoogroups.com, "rtstofer" wrote:
>
> --- In l...@yahoogroups.com, "capiman26061973" wrote:
> >
> >
> >
> > Hello Richard, hello Rajun,
> >
> > would it not be easier if Rajun just zips the complete directory / project and upload it to files area ?
> >
> > I think, there should already be a big thank you to Richard for the great support, not only to Rajun, but also to a lot others !
> >
> > Regards,
> >
> > Martin
>
> Sure, zipping it up and posting it is likely to result in a working sample a lot faster than it has been going.
>
> The only reason I haven't posted a working RTC project is that I don't have one. I have never used the RTC.
>
> I almost always recommend that folks check out the excellent code at www.jcwren.com/arm That's where I get a lot of my code and I have learned a lot about the overall strategy of building a large project from JC's code.
>
> Richard
>

------------------------------------



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: interrupts of RTC - raju_nem - Nov 11 9:51:14 2009


Hi richard,

As u said,i zipped my files and kept in the files section with name of folder is RTC(rtc interrupt).Can i know the mistake where it is done? Means after excuting the ISR function,it should return to main.It is not happening.It is there in isr infinetly.help thanks in advance.This helps when i go for other on chip peripherals interrupts also(PWM,External interrupt,UART interrupt,etc..).

i tried with the startup file which is given in below link also.
No improvement.

http://www.siwawi.arubi.uni-kl.de/avr_projects/arm_projects/lpc2k_bundle_port/index.html

it is great experiance with RTC and espesially with Strart up file.

--- In l...@yahoogroups.com, "jcdmelo" wrote:
>
> Richard,
>
> You misread Martin's e-mail: it should be Rajun to zip and upload his files, not you. I aggree with him too that you've been a heck of a consultant on this issue of RTC interrupts. Why not give a chance to Rajun to sweat a little now?
>
> Julio de Melo
>
> --- In l...@yahoogroups.com, "rtstofer" wrote:
> >
> >
> >
> > --- In l...@yahoogroups.com, "capiman26061973" wrote:
> > >
> > >
> > >
> > > Hello Richard, hello Rajun,
> > >
> > > would it not be easier if Rajun just zips the complete directory / project and upload it to files area ?
> > >
> > > I think, there should already be a big thank you to Richard for the great support, not only to Rajun, but also to a lot others !
> > >
> > > Regards,
> > >
> > > Martin
> >
> > Sure, zipping it up and posting it is likely to result in a working sample a lot faster than it has been going.
> >
> > The only reason I haven't posted a working RTC project is that I don't have one. I have never used the RTC.
> >
> > I almost always recommend that folks check out the excellent code at www.jcwren.com/arm That's where I get a lot of my code and I have learned a lot about the overall strategy of building a large project from JC's code.
> >
> > Richard
>

------------------------------------



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: interrupts of RTC - rtstofer - Nov 11 11:02:38 2009



--- In l...@yahoogroups.com, "raju_nem" wrote:
> Hi richard,
>
> As u said,i zipped my files and kept in the files section with name of folder is RTC(rtc interrupt).Can i know the mistake where it is done? Means after excuting the ISR function,it should return to main.It is not happening.It is there in isr infinetly.help thanks in advance.This helps when i go for other on chip peripherals interrupts also(PWM,External interrupt,UART interrupt,etc..).
>
> i tried with the startup file which is given in below link also.
> No improvement.
>
> http://www.siwawi.arubi.uni-kl.de/avr_projects/arm_projects/lpc2k_bundle_port/index.html
>
> it is great experiance with RTC and espesially with Strart up file.
>

It will be tomorrow afternoon at the earliest. The contractors will be here in a few minutes to start replacing all the windows. Tonight and tomorrow will be spent putting the house back together.

Richard

------------------------------------



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: interrupts of RTC - rtstofer - Nov 11 18:51:49 2009



--- In l...@yahoogroups.com, "raju_nem" wrote:
> Hi richard,
>
> As u said,i zipped my files and kept in the files section with name of folder is RTC(rtc interrupt).

Have you tried to download the file? I can't seem to get it.

As the owner, you have the ability to delete it and replace it with a filename that doesn't contain embedded spaces. rtc.zip comes to mind.

Richard

------------------------------------



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: interrupts of RTC - raju_nem - Nov 12 1:50:14 2009


Hi richard,
here i am able to download the zip file inside the Folder(folder name is RTC(rtc interrupt)).Have u installed "winrar" which can zip or unzip the files.

--- In l...@yahoogroups.com, "rtstofer" wrote:
>
> --- In l...@yahoogroups.com, "raju_nem" wrote:
> >
> >
> > Hi richard,
> >
> > As u said,i zipped my files and kept in the files section with name of folder is RTC(rtc interrupt).
>
> Have you tried to download the file? I can't seem to get it.
>
> As the owner, you have the ability to delete it and replace it with a filename that doesn't contain embedded spaces. rtc.zip comes to mind.
>
> Richard
>

------------------------------------



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: interrupts of RTC - rtstofer - Nov 12 14:11:13 2009

There is a new file in the RTC folder named ARM2148RTC.zip.

The RTC code itself is a hacked up version of JCWren's code (sorry for the hack, JC).

Remnants of the FreeRTOS stuff are removed and a couple of macros are created to enable and disable interrupts.

The RTC ISR does not print anything. You REALLY don't want to do this. Ever! It simply increments a counter. When you start nesting interrupts (and IRQ_Wrapper does this based on priority), you might need to disable/enable interrupts around the code that increments the counter.

The main code looks at the counter and, if it is non-zero, disables interrupts, reads the time, decrements the counter and re-enables interrupts. Finally, the main code prints the time using standard C kinds of stuff.

This is a really ugly hack! It is based on JC's code as I stated above but because we had a collision of lpc2xxx.h files, I removed a lot of macro constants. I spliced on IO routines from another project which means there is a lot more code than necessary. Printing IBMWords won't be necessary...

But it prints the time...

JC's code has a complete set of functions for dealing with the clock and alarm. It was worth incorporating the code because, sooner or later, the functions will be necessary.

The code uses the IRQ_Wrapper approach so interrupt handlers can be declared as standard C functions.

You should consider cutting the code down to size.

While I'm at it, I'll post the .hex file. There are a number of changes you may need to make so it might be useful to have a known-working version.

Richard

------------------------------------



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: interrupts of RTC - rtstofer - Nov 12 14:16:03 2009



--- In l...@yahoogroups.com, "raju_nem" wrote:
> Hi richard,
> here i am able to download the zip file inside the Folder(folder name is RTC(rtc interrupt)).Have u installed "winrar" which can zip or unzip the files.
Yahoo wouldn't serve the file. It wasn't a matter of being able to decompress it; I couldn't get it. It's fine today.

Richard

------------------------------------



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: interrupts of RTC - rtstofer - Nov 12 14:19:33 2009



--- In l...@yahoogroups.com, "rtstofer" wrote:

I had 3 choices for the RTC code:

1) write the project from scratch - too much work!
2) try to fix the provided code - I tried but failed, don't know why
3) hack something together that could be pared down.

I chose option 3 because I didn't have to write a bunch of code. I already had other LPC2148 projects for the usual overhead functions. All I had to do was splice in JC's code for the RTC and write main().

Richard

------------------------------------



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: interrupts of RTC - raju_nem - Nov 12 15:08:51 2009


Hi richard,

i am not able build a hex file with my tools which are i am using.i am using GNU arm gcc 4.1.0,yagartotool.it is giving error when i type make all and mak clean in cmd promt.
i have taken the screen shot of error. and i kept in the same folder name RTC,with error.jpg.

--- In l...@yahoogroups.com, "rtstofer" wrote:
>
> --- In l...@yahoogroups.com, "rtstofer" wrote:
>
> I had 3 choices for the RTC code:
>
> 1) write the project from scratch - too much work!
> 2) try to fix the provided code - I tried but failed, don't know why
> 3) hack something together that could be pared down.
>
> I chose option 3 because I didn't have to write a bunch of code. I already had other LPC2148 projects for the usual overhead functions. All I had to do was splice in JC's code for the RTC and write main().
>
> Richard
>

------------------------------------



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: interrupts of RTC - rtstofer - Nov 12 15:25:20 2009



--- In l...@yahoogroups.com, "raju_nem" wrote:
> Hi richard,
>
> i am not able build a hex file with my tools which are i am using.i am using GNU arm gcc 4.1.0,yagartotool.it is giving error when i type make all and mak clean in cmd promt.
> i have taken the screen shot of error. and i kept in the same folder name RTC,with error.jpg.
>

Well, 'make' can't find 'awk'. You may actually have awk in the YAGARTO tools subdirectory, I don't... I also don't use Windows for ARM development.

in the Makefile, remove 'depend' from the all: target. Leave the first line after all : blank - no dependencies.

Like this:

all :

make ${TARGET}.hex sizes list
Again in Makefile, remove the entire target for depend down at the bottom.

Delete all of this:

depend :
@cp Makefile Makefile.bak

@awk '/# .Id/,/^# DO NOT DELETE/' Makefile > Makefile.new

@${CC} ${CFLAGS} -MM ${SRCS} >> Makefile.new

@if ! diff Makefile Makefile.new > /dev/null 2>&1 ; then \

mv Makefile.new Makefile; \

else \

rm Makefile.new; \

rm Makefile.bak; \

fi
You can keep the dependencies.

Richard

------------------------------------



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: interrupts of RTC - rtstofer - Nov 12 15:27:32 2009



--- In l...@yahoogroups.com, "raju_nem" wrote:

And I set the baud rate to 115200 for UART0 and 38400 for UART1.

Richard

------------------------------------

______________________________
Stellaris® MCU Family: New Parts, New Package, New Price.


(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: interrupts of RTC - rtstofer - Nov 12 15:40:21 2009



--- In l...@yahoogroups.com, "rtstofer" wrote:

I tried the proposed changes to Makefile (given above) and changed the path to the toolchain. I built the .hex with YAGARTO and loaded it to the board.

It works fine!

Have you tried the .hex file I provided? It should work just as given. The only assumption it makes about hardware is the existence of the 32 kHz crystal and the serial port.

Richard

------------------------------------



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: interrupts of RTC - raju_nem - Nov 14 5:49:43 2009


Hi richard,

In the makefile, i need to give the location.Location means here,where we installed GNUARM or Yogarto tool or Project folder(ARM2148RTC.zip).

If it is tool chain loaction,then i need to give C:\Program Files\armtools

or
if it is project folder location means i need to give C:\Documents and Settings\raju\Desktop\ARM2148RTC.

which location i need to give?

I downloded the hex file.it is working fine.thank u.
--- In l...@yahoogroups.com, "rtstofer" wrote:
>
> --- In l...@yahoogroups.com, "rtstofer" wrote:
>
> I tried the proposed changes to Makefile (given above) and changed the path to the toolchain. I built the .hex with YAGARTO and loaded it to the board.
>
> It works fine!
>
> Have you tried the .hex file I provided? It should work just as given. The only assumption it makes about hardware is the existence of the 32 kHz crystal and the serial port.
>
> Richard
>

------------------------------------



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: interrupts of RTC - rtstofer - Nov 14 9:12:40 2009



--- In l...@yahoogroups.com, "raju_nem" wrote:
> Hi richard,
>
> In the makefile, i need to give the location.Location means here,where we installed GNUARM or Yogarto tool or Project folder(ARM2148RTC.zip).
>
> If it is tool chain loaction,then i need to give C:\Program Files\armtools
>
> or
> if it is project folder location means i need to give C:\Documents and Settings\raju\Desktop\ARM2148RTC.
>
> which location i need to give?
I changed LOCATION to:
LOCATION = "C:\Program Files\yagarto"
The double quotes are required due to the embedded space in Program Files.

You might need to change:
ARCHIVE2 = ${LOCATION}/lib/gcc/arm-elf/4.3.2
depending on which version of arm-elf you are using.

You need to remove:
VICVectAddr = (unsigned int) 0;
from the bottom of rtcISR.c

Richard

------------------------------------



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: interrupts of RTC - raju_nem - Nov 14 9:57:56 2009


Thank u so much for u information and patiency.

when i type make all or make clean it is giving error.Screen shot of that error i added in the same folder with name error1.jpg.What ever the crt.s,file u have given(in ARM2148RTC), Is it common for all the interrupts of on-chip peripherals( i mean for uart0 interrupt,external interrupt,timers interrupts e.t.c)? or shall we need to do modifications?(i think modification is not required).What do u say Mr.richard?
--- In l...@yahoogroups.com, "rtstofer" wrote:
>
> --- In l...@yahoogroups.com, "raju_nem" wrote:
> >
> >
> > Hi richard,
> >
> > In the makefile, i need to give the location.Location means here,where we installed GNUARM or Yogarto tool or Project folder(ARM2148RTC.zip).
> >
> > If it is tool chain loaction,then i need to give C:\Program Files\armtools
> >
> > or
> > if it is project folder location means i need to give C:\Documents and Settings\raju\Desktop\ARM2148RTC.
> >
> > which location i need to give?
> I changed LOCATION to:
> LOCATION = "C:\Program Files\yagarto"
> The double quotes are required due to the embedded space in Program Files.
>
> You might need to change:
> ARCHIVE2 = ${LOCATION}/lib/gcc/arm-elf/4.3.2
> depending on which version of arm-elf you are using.
>
> You need to remove:
> VICVectAddr = (unsigned int) 0;
> from the bottom of rtcISR.c
>
> Richard
>

------------------------------------



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: interrupts of RTC - rtstofer - Nov 14 10:47:53 2009



--- In l...@yahoogroups.com, "raju_nem" wrote:
> Thank u so much for u information and patiency.
>
> when i type make all or make clean it is giving error.Screen shot of that error i added in the same folder with name error1.jpg.What ever the crt.s,file u have given(in ARM2148RTC), Is it common for all the interrupts of on-chip peripherals( i mean for uart0 interrupt,external interrupt,timers interrupts e.t.c)? or shall we need to do modifications?(i think modification is not required).What do u say Mr.richard?
>

Make isn't on your PATH. In my case, it looks like I am using make from the WinAVR installation because the WinAVR toolchain is on my path. But I have about 20 different instances of 'make' so it's not really clear which one I am using. In any event, find a copy that works and add the path.

The crt.s file should work with all VECTORED interrupts. Those that get the interrupt handler address from the VIC. This is the usual approach so the wrapper should work. It doesn't handle FIQ interrupts because the FIQ vector points elsewhere. I'm not sure what to do about that. I'm not using FIQ interrupts.

I added a 1000 Hz Timer 0 interrupt and a bit of code to flash an LED while the RTC is also doing interrupts. Seems to work fine. The timer interrupt is a higher priority than the RTC so there is a potential for nesting.

I am not certain about the size requirements of the IRQ stack but 4 bytes seems too small. In crt.s change:

.set IRQ_STACK_SIZE, 0X00000100 /* stack for "IRQ" normal interrupts is 256 bytes */

We have plenty of memory and we don't need the IRQ stack overwriting the SVC stack.

We don't have to give any particular size to the SVC stack because we never use User mode. SVC stack is the only stack used for non-interrupt code.

crt.s is pretty common across a product series. Some of the stack details may change but the primary functions of a) vectors, b) stack initialization, c) .data initialization and d) clear .bss are all the same. The IRQ wrapper is different and is not often seen in startup files.

The linker file ???.ld is common for a particular device. Once the memory layout is known, there's no reason to do much to the linker script. However, you can do some pretty interesting things re: code placement. For most beginning users, these are not necessary.

The Makefile is usually a personal thing. My Makefile works for me but there are better ones around. There is also a much better approach to segmenting a project. www.jcwren.com/arm is far better. Each major gadget is in its own subdirectory and each subdirectory has its own Makefile. The top level Makefile simply recurses through a list of subdirectories and invokes 'make' in each.

Richard

------------------------------------



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: interrupts of RTC - raju_nem - Nov 15 14:26:17 2009

Hi richard,
i didnot get u.Still same problem which i got eariler in error1.jpg.

In the yagarto folder one make(.exe) file is there.shall i give the path of this make (.exe) file.
--- In l...@yahoogroups.com, "rtstofer" wrote:
>
> --- In l...@yahoogroups.com, "raju_nem" wrote:
> >
> >
> > Thank u so much for u information and patiency.
> >
> > when i type make all or make clean it is giving error.Screen shot of that error i added in the same folder with name error1.jpg.What ever the crt.s,file u have given(in ARM2148RTC), Is it common for all the interrupts of on-chip peripherals( i mean for uart0 interrupt,external interrupt,timers interrupts e.t.c)? or shall we need to do modifications?(i think modification is not required).What do u say Mr.richard?
> > Make isn't on your PATH. In my case, it looks like I am using make from the WinAVR installation because the WinAVR toolchain is on my path. But I have about 20 different instances of 'make' so it's not really clear which one I am using. In any event, find a copy that works and add the path.
>
> The crt.s file should work with all VECTORED interrupts. Those that get the interrupt handler address from the VIC. This is the usual approach so the wrapper should work. It doesn't handle FIQ interrupts because the FIQ vector points elsewhere. I'm not sure what to do about that. I'm not using FIQ interrupts.
>
> I added a 1000 Hz Timer 0 interrupt and a bit of code to flash an LED while the RTC is also doing interrupts. Seems to work fine. The timer interrupt is a higher priority than the RTC so there is a potential for nesting.
>
> I am not certain about the size requirements of the IRQ stack but 4 bytes seems too small. In crt.s change:
>
> .set IRQ_STACK_SIZE, 0X00000100 /* stack for "IRQ" normal interrupts is 256 bytes */
>
> We have plenty of memory and we don't need the IRQ stack overwriting the SVC stack.
>
> We don't have to give any particular size to the SVC stack because we never use User mode. SVC stack is the only stack used for non-interrupt code.
>
> crt.s is pretty common across a product series. Some of the stack details may change but the primary functions of a) vectors, b) stack initialization, c) .data initialization and d) clear .bss are all the same. The IRQ wrapper is different and is not often seen in startup files.
>
> The linker file ???.ld is common for a particular device. Once the memory layout is known, there's no reason to do much to the linker script. However, you can do some pretty interesting things re: code placement. For most beginning users, these are not necessary.
>
> The Makefile is usually a personal thing. My Makefile works for me but there are better ones around. There is also a much better approach to segmenting a project. www.jcwren.com/arm is far better. Each major gadget is in its own subdirectory and each subdirectory has its own Makefile. The top level Makefile simply recurses through a list of subdirectories and invokes 'make' in each.
>
> Richard
>

------------------------------------

______________________________
Stellaris® MCU Family: New Parts, New Package, New Price.


(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: interrupts of RTC - rtstofer - Nov 15 14:47:05 2009



--- In l...@yahoogroups.com, "raju_nem" wrote:
>
> Hi richard,
> i didnot get u.Still same problem which i got eariler in error1.jpg.
>
> In the yagarto folder one make(.exe) file is there.shall i give the path of this make (.exe) file.
You need to add the path to the executable to you Windows Path environment variable.

See: http://www.computerhope.com/issues/ch000549.htm

If make is in a different directory than the rest of the toolchain, add both paths to your environment.

It may turn out that you can dump the LOCATION macro from the Makefile if the toolchain is on your path because it already knows where the libraries should be located (I think). I don't do this because I might have a couple of version of arm-elf- in different directories.

Richard

------------------------------------



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: interrupts of RTC - raju_nem - Nov 15 16:00:41 2009

AS u said ,You need to add the path to the executable to you Windows Path environment variable.
>
> See: http://www.computerhope.com/issues/ch000549.htm
When we install the softwares(GNUARM,yagarto here),automatically paths related to these softwares will be included in the windows environment variables.No need to set manually.

--- In l...@yahoogroups.com, "rtstofer" wrote:
>
> --- In l...@yahoogroups.com, "raju_nem" wrote:
> >
> > Hi richard,
> > i didnot get u.Still same problem which i got eariler in error1.jpg.
> >
> > In the yagarto folder one make(.exe) file is there.shall i give the path of this make (.exe) file.
> You need to add the path to the executable to you Windows Path environment variable.
>
> See: http://www.computerhope.com/issues/ch000549.htm
>
> If make is in a different directory than the rest of the toolchain, add both paths to your environment.
>
> It may turn out that you can dump the LOCATION macro from the Makefile if the toolchain is on your path because it already knows where the libraries should be located (I think). I don't do this because I might have a couple of version of arm-elf- in different directories.
>
> Richard
>

------------------------------------



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: interrupts of RTC - rtstofer - Nov 15 20:14:45 2009



--- In l...@yahoogroups.com, "raju_nem" wrote:
>
> AS u said ,You need to add the path to the executable to you Windows Path environment variable.
> >
> > See: http://www.computerhope.com/issues/ch000549.htm
> When we install the softwares(GNUARM,yagarto here),automatically paths related to these softwares will be included in the windows environment variables.No need to set manually.
If Windows says it can't find 'make' then the directory containing make is not on the path.

My Yagarto doesn't even have make. It looks like I didn't download the Yagarto tools. However, I have 20 other 'make's so it doesn't matter.

Richard

------------------------------------

______________________________
Stellaris® MCU Family: New Parts, New Package, New Price.


(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )