EmbeddedRelated.com
Forums

LPC2106 GNU CodeSourcery Toolchain: How to enable nested interrupts

Started by voltz56 April 22, 2010
Im using the GNU codesourcery toolchain with keil. I need to use
nested interrupts, I think something has to be changed in the startup
file but exactly what Im unsure.

Regards,
J

Timer interrupt init functions
http://pastebin.com/i75W8K jE


Startup.s
http://pastebin.com/QEfj7hps

An Engineer's Guide to the LPC2100 Series

--- In l..., "voltz56" wrote:
>
> Im using the GNU codesourcery toolchain with keil. I need to use
> nested interrupts, I think something has to be changed in the startup
> file but exactly what Im unsure.
>
> Regards,
> J
>
> Timer interrupt init functions
> http://pastebin.com/i75W8K jE
> Startup.s
> http://pastebin.com/QEfj7hps
Look at crt.s in the Files folder. We just talked about this yesterday. Thumb back a few posts...

Richard

--- In l..., "rtstofer" wrote:
>
> --- In l..., "voltz56" wrote:
> >
> > Im using the GNU codesourcery toolchain with keil. I need to use
> > nested interrupts, I think something has to be changed in the startup
> > file but exactly what Im unsure.
> >
> > Regards,
> > J
> >
> > Timer interrupt init functions
> > http://pastebin.com/i75W8K jE
> >
> >
> > Startup.s
> > http://pastebin.com/QEfj7hps
> > Look at crt.s in the Files folder. We just talked about this yesterday. Thumb back a few posts...
>
> Richard
>

Thanks, I just looked at that. Im not sure how I would go about integrting it into my startup... . Looks like I would have to rewrite my whole startup file. By any chance is there linker file to go with Crt.s.

Regards,
J

--- In l..., "voltz56" wrote:

> Thanks, I just looked at that. Im not sure how I would go about integrting it into my startup... . Looks like I would have to rewrite my whole startup file. By any chance is there linker file to go with Crt.s.
>
> Regards,
> J
>

It isn't going to be much of a rewrite! For your startup code:
1) uncomment line 191
2) comment line 192
3) line 201 - change IRQ_Handler to IRQ_Wrapper
4) stuff the IRQ_Wrapper code after line 240
5) add the following statement around line 40 (AFTER steps 1..4)

.set VICVECTADDR, 0xFFFFF030

I posted lpc2106_FLASH.ld as a sample linker file. It comes from the James Lynch Tutorial. Why are you changing your linker script?

The startup code and the linker scripts are tied together because symbols used in the startup code are often defined in the linker script.

Richard

--- In l..., "rtstofer" wrote:
>
> --- In l..., "voltz56" vltzzzzzzz@ wrote:
>
> > Thanks, I just looked at that. Im not sure how I would go about
integrting it into my startup... . Looks like I would have to rewrite my
whole startup file. By any chance is there linker file to go with Crt.s.
> >
> > Regards,
> > J
> > It isn't going to be much of a rewrite! For your startup code:
> 1) uncomment line 191
> 2) comment line 192
> 3) line 201 - change IRQ_Handler to IRQ_Wrapper
> 4) stuff the IRQ_Wrapper code after line 240
> 5) add the following statement around line 40 (AFTER steps 1..4)
>
> .set VICVECTADDR, 0xFFFFF030
>
> I posted lpc2106_FLASH.ld as a sample linker file. It comes from the
James Lynch Tutorial. Why are you changing your linker script?
>
> The startup code and the linker scripts are tied together because
symbols used in the startup code are often defined in the linker script.
>
> Richard
>

Thanks that was easy, everything compiled fine, but when I tried to run
it on the board I got no output, I then tried running it in the keil
software debugger and it appears to hang once it reach's the timer_init
function, seems like it is getting stuck in the isr as variables in the
there are getting continually updated.

The only reason I was going to change the linker script is for the
reason you highlighted. I thought it would be easier just to use the
crt.s that you uploaded only to find out when I tried that the linker
was missing definitions from the other...

Here is the updated version of the startup file -I followed what you
said so I presume everything is fine.

http://pastebin.com/zgcRDKbq

Regards,
J
--- In l..., "voltz56" wrote:

> Thanks that was easy, everything compiled fine, but when I tried to run
> it on the board I got no output, I then tried running it in the keil
> software debugger and it appears to hang once it reach's the timer_init
> function, seems like it is getting stuck in the isr as variables in the
> there are getting continually updated.
>
> The only reason I was going to change the linker script is for the
> reason you highlighted. I thought it would be easier just to use the
> crt.s that you uploaded only to find out when I tried that the linker
> was missing definitions from the other...
>
> Here is the updated version of the startup file -I followed what you
> said so I presume everything is fine.
>
> http://pastebin.com/zgcRDKbq Regards,
> J
>

The startup file looks ok and do the two timer init functions although I didn't really try to figure out what they are doing.

You haven't posted the code for your two interrupt handlers. In which ISR is the code getting stuck?

I have never used the Keil debugger.

You are right, it is better to swap out both the startup and linker files as a set. There's no reason not to do that.

Richard

--- In l..., "rtstofer" wrote:
>
> --- In l..., "voltz56" wrote:
>
> > Thanks that was easy, everything compiled fine, but when I tried to run
> > it on the board I got no output, I then tried running it in the keil
> > software debugger and it appears to hang once it reach's the timer_init
> > function, seems like it is getting stuck in the isr as variables in the
> > there are getting continually updated.
> >
> > The only reason I was going to change the linker script is for the
> > reason you highlighted. I thought it would be easier just to use the
> > crt.s that you uploaded only to find out when I tried that the linker
> > was missing definitions from the other...
> >
> > Here is the updated version of the startup file -I followed what you
> > said so I presume everything is fine.
> >
> > http://pastebin.com/zgcRDKbq
> >
> > Regards,
> > J
> > The startup file looks ok and do the two timer init functions although I didn't really try to figure out what they are doing.
>
> You haven't posted the code for your two interrupt handlers. In which ISR is the code getting stuck?
>
> I have never used the Keil debugger.
>
> You are right, it is better to swap out both the startup and linker files as a set. There's no reason not to do that.
>
> Richard
>

Ive been debugging and thinking...
A variable in timer0 is altered every time the isr is run- this is still happening so it would appear that the isr is being reexcuted rather than been stuck in there.
Although once the first interrupt occurs no other code is executed after, and if single stepping through code, step, step over and run etc are greyed out, which suggests to me that is has hung.
The timer peripheral window (in the debugger ) show the timer to be both enabled and reset, so TC is stuck at 0, Timer0 is configured to interrupt on MR0.
Which ever timer interrupts first causes the problem.

isr's

http://pastebin.com/9cVi5nAk

I tried using the linker file you provide but I got some errors.

linker error msgs, using crt.s with lpc2106_FLASH.ld
http://pastebin.com/i2ygBjxp

Regards,
J

--- In l..., "voltz56" wrote:
>
> --- In l..., "rtstofer" wrote:
> >
> >
> >
> > --- In l..., "voltz56" wrote:
> >
> > > Thanks that was easy, everything compiled fine, but when I tried to run
> > > it on the board I got no output, I then tried running it in the keil
> > > software debugger and it appears to hang once it reach's the timer_init
> > > function, seems like it is getting stuck in the isr as variables in the
> > > there are getting continually updated.
> > >
> > > The only reason I was going to change the linker script is for the
> > > reason you highlighted. I thought it would be easier just to use the
> > > crt.s that you uploaded only to find out when I tried that the linker
> > > was missing definitions from the other...
> > >
> > > Here is the updated version of the startup file -I followed what you
> > > said so I presume everything is fine.
> > >
> > > http://pastebin.com/zgcRDKbq
> > >
> > > Regards,
> > > J
> > >
> >
> > The startup file looks ok and do the two timer init functions although I didn't really try to figure out what they are doing.
> >
> > You haven't posted the code for your two interrupt handlers. In which ISR is the code getting stuck?
> >
> > I have never used the Keil debugger.
> >
> > You are right, it is better to swap out both the startup and linker files as a set. There's no reason not to do that.
> >
> > Richard
> > Ive been debugging and thinking...
> A variable in timer0 is altered every time the isr is run- this is still happening so it would appear that the isr is being reexcuted rather than been stuck in there.
> Although once the first interrupt occurs no other code is executed after, and if single stepping through code, step, step over and run etc are greyed out, which suggests to me that is has hung.
> The timer peripheral window (in the debugger ) show the timer to be both enabled and reset, so TC is stuck at 0, Timer0 is configured to interrupt on MR0.
> Which ever timer interrupts first causes the problem.
>
> isr's
>
> http://pastebin.com/9cVi5nAk
>
> I tried using the linker file you provide but I got some errors.
>
> linker error msgs, using crt.s with lpc2106_FLASH.ld
> http://pastebin.com/i2ygBjxp
>
> Regards,
> J
>

I decided to comment out the init for timer0 and test just timer1, everything looks ok in the timer peripheral window in the debugger, TC is incrementing, and the timer is interrupting on match and on capture. The code in the isr is also doing its job as it should be. The problem still remains though that it doesn't execute any code after the timer init function (apart from the timer1 isr).

--- In l..., "voltz56" wrote:

> I decided to comment out the init for timer0 and test just timer1, everything looks ok in the timer peripheral window in the debugger, TC is incrementing, and the timer is interrupting on match and on capture. The code in the isr is also doing its job as it should be. The problem still remains though that it doesn't execute any code after the timer init function (apart from the timer1 isr).
>

So, everything about timer1 is ok and only timer0 is a problem? How about commenting out everyting about timer1 and testing timer0?

For whatever reason, I can't get to pastebin.

Richard

--- In l..., "rtstofer" wrote:
>
> --- In l..., "voltz56" vltzzzzzzz@ wrote:
>
> > I decided to comment out the init for timer0 and test just timer1,
everything looks ok in the timer peripheral window in the debugger, TC
is incrementing, and the timer is interrupting on match and on capture.
The code in the isr is also doing its job as it should be. The problem
still remains though that it doesn't execute any code after the timer
init function (apart from the timer1 isr).
> > So, everything about timer1 is ok and only timer0 is a problem? How
about commenting out everyting about timer1 and testing timer0?
>
> For whatever reason, I can't get to pastebin.
>
> Richard
>

I have already tested t0 like that and the outcome is the same. Timer 1
is also a problem as no code after the timer1 init function is
executed(except for the isr)

I cant connect to pastebin either...
This one works
http://paste.uni.cc/20618