Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: [lpc2000] Re: Getting lnewlib-lpc (Ver 5a) uart1 interrupts to work with WINARM

2006-04-29 by Robert Adsett

At 04:50 AM 4/29/06 +0000, ocnek1 wrote:
>Below are the crt0 and the .ld files that I am currently using.  So if
>you spot any problems or what I would need to add that would be great!!
<snip>

>         .equ  I_BIT, 0x80               // when I bit is set, IRQ is disabled
>         .equ  F_BIT, 0x40               // when F bit is set, FIQ is disabled

<snip>

>// Runtime Interrupt Vectors
>// -------------------------
>Vectors:
>         b     _start                    // reset - _start
>         ldr   pc,_undf                  // undefined - _undf
>         ldr   pc,_swi                   // SWI - _swi
>         ldr   pc,_pabt                  // program abort - _pabt
>         ldr   pc,_dabt                  // data abort - _dabt
>         nop                             // reserved
>         ldr   pc,[pc,#-0xFF0]           // IRQ - read the VIC
>         ldr   pc,_fiq                   // FIQ - _fiq

The fiq will need modifying if you ever use it.

<snip>
>// Initialize Interrupt System
>// - Set stack location for each mode
>// - Leave in System Mode with Interrupts Disabled

The above comment is key

>// -----------------------------------------------
>         ldr   r0,=_stack
>         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 // System Mode
>         mov   sp,r0

The interrupts are being left disabled.


You have to turn on the interrupts.  A couple of possibilities.

         Write an interrupt enable routine and enable interrupts in your 
program
         Modify the startup so you enter system mode with interrupts 
enabled.  This may the easiest, from the look of the code all you have to 
do is remove the bits that disable interrupts.
         Use the startup code supplied with newlib.

I think the second option is probably your best.

Robert

" 'Freedom' has no meaning of itself.  There are always restrictions,   be 
they legal, genetic, or physical.  If you don't believe me, try to chew a 
radio signal. "  -- Kelvin Throop, III
http://www.aeolusdevelopment.com/

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.