Yahoo Groups archive

Lpc2000

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

Message

Re: Strange data abort problem

2005-10-11 by embeddedjanitor

Apart from what others have written about better ways to do this 
(using the AIC), I think there is also a problem in the way you have 
written the assembler code.

Unfortunately one of the Philips app notes is written this way, but it 
is wrong. 
 
> @@@@@@@@@@@
> .section .startup,"ax"
> .code 32
> .align 0
> 
> b start
> b irqVector0
> b irqVector0
> b irqVector0
> b irqVector0
> b irqVector0
> b irqVector1
> b irqVector1
> 
> @@@@@@@@@@@@@@@@
> 
> @ create a variable to hold a C function pointer to be
> called on IRQ
> 
> .global irqVector0
> irqVector0:
> .word 0 @ this should be set to a C function
> 
> .global irqVector1
> irqVector1:
> .word 0 @ this should be set to a C function

  b xxx expects xxx to be actual code, not a "pointer to code"


If you want to use a pointer to code, then you should be doing

  ldr pc,irqVector

That will load the pc with the pointer, essentially a jump to the 
code.

As an example of this, consider the code I use for my vectors which 
looks like:


	    ldr   pc,v0	 	 	@ reset vector
            ldr   pc,v1	  		@ Undefined Instruction
            ldr   pc,v2	 	 	@ Software Interrupt
            ldr   pc,v3	  		@ Prefetch Abort
            ldr   pc,v4		  	@ Data Abort
            ldr   pc,v5		  	@ reserved
	    ldr   pc,[pc,#-0xF20]	@ IRQ : read the AIC
	    ldr   pc,[pc,#-0xF24]	@ FIQ : read the AIC
v0:	    .long start
v1:	    .long undef_handler
v2:         .long swi_handler
v3:         .long prefetch_abort_handler
v4:	    .long data_abort_handler
v5:	    .long reserved_handler

Here the vectors v0..v5 are predefined constants, but they could 
equally well be variable pointers.

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.