Moin zusammen,
ich quäl mich gerade mit einem LPC2148 rum.
Compiler ist IAR EWARM 5.4 mit Segger J-Link.
Und zwar bin ich momentan am UART. Senden (gepollt) funktioniert, nun
will
ich den Empfang per IRQ lösen. Vermutlich habe ich die Interruptstruktur
des ARM7
noch nicht so ganz geschnallt, daher hier mal ein Auszug aus dem
cstartup.s von IAR:
1 | ; The module in this file are included in the libraries, and may be
|
2 | ; replaced by any user-defined modules that define the PUBLIC symbol
|
3 | ; __iar_program_start or a user defined start symbol.
|
4 | ;
|
5 | ; To override the cstartup defined in the library, simply add your
|
6 | ; modified version to the workbench project.
|
7 |
|
8 | SECTION .intvec:CODE:NOROOT(2)
|
9 |
|
10 | PUBLIC __vector
|
11 | PUBLIC __vector_0x14
|
12 | PUBLIC __iar_program_start
|
13 | EXTERN irq_handler,fiq_handler
|
14 |
|
15 | ARM
|
16 | __vector:
|
17 | ;;
|
18 | ldr pc,[pc,#+24] ;; Reset
|
19 | B . ;; Undefined instructions
|
20 | B . ;; Software interrupt (SWI/SVC)
|
21 | B . ;; Prefetch abort
|
22 | B . ;; Data abort
|
23 | __vector_0x14:
|
24 | DC32 0 ;; RESERVED
|
25 | ldr pc,[pc,#+24] ;; IRQ
|
26 | ldr pc,[pc,#+24] ;; FIQ
|
27 |
|
28 | DC32 __iar_program_start ;; Reset
|
29 | DC32 0 ;; Undefined instructions
|
30 | DC32 0 ;; Software interrupt (SWI/SVC)
|
31 | DC32 0 ;; Prefetch abort
|
32 | DC32 0 ;; Data abort
|
33 | DC32 0 ;; RESERVED
|
34 | DC32 irq_handler ;; IRQ
|
35 | DC32 fiq_handler ;; FIQ
|
Das sollte der interessante Teil in cstartup.s sein (sonst wird es zu
lang.
__iar_program_start ist weiter unten definiert (MAM-Init usw.)
In main habe ich:
1 | /*************************************************************************
|
2 | * Function Name: irq_handler
|
3 | * Parameters: void
|
4 | * Return: void
|
5 | *
|
6 | * Description: IRQ subroutine
|
7 | *
|
8 | *************************************************************************/
|
9 | __irq __arm extern void irq_handler (void)
|
10 | {
|
11 | void (*interrupt_function)();
|
12 | uint32 vector;
|
13 |
|
14 | vector = VICVectAddr; /* Get interrupt vector. */
|
15 | interrupt_function = (void(*)())vector;
|
16 | (*interrupt_function)(); /* Call vectored interrupt function. */
|
17 | VICVectAddr = 0;
|
18 | }
|
19 |
|
20 | /*************************************************************************
|
21 | * Function Name: fiq_handler
|
22 | * Parameters: void
|
23 | * Return: void
|
24 | *
|
25 | * Description: FIQ subroutine
|
26 | *
|
27 | *************************************************************************/
|
28 | __fiq __arm extern void fiq_handler (void)
|
29 | {
|
30 | void (*interrupt_function)();
|
31 | uint32 vector;
|
32 |
|
33 | vector = VICVectAddr; /* Get interrupt vector. */
|
34 | interrupt_function = (void(*)())vector;
|
35 | (*interrupt_function)(); /* Call vectored interrupt function. */
|
36 | VICVectAddr = 0;
|
37 | }
|
Damit ich nicht zuviel wirres Zeug schreibe, mal die beiden Screenshots
der Register für VIC und UART anbei. Die ISR für UART 0 liegt bei
0x000008c8 (lt Mapfile). In CPSR sind I-Bit und F-Bit 0.
Habe in irq_handler() einen Breakpoint gestellt und er läuft nicht
drauf, wenn ich über TeraTerm Zeichen sende (9600 8N1).
Any idea?
thanx, Arne