EmbDev.net

Forum: ARM programming with GCC/GNU tools Linker Problem lpc2138


von Sebastian (Guest)


Rate this post
useful
not useful
Hello,
I use the WinIDEA software and make a new projekt with the
lpc2138_uart0_irq projektfiles. I use the external make
\winarm\utils\bin\make.exe from the WinARM download files.
Now the Problem:
the linker doesn' t work in a correct way.
The funktions do not have the right adresses.
Where mußt I serge the problem? In the crt0.S, LPC2138-ROM.ld or in the
makefile?
Is it a problem of the linker?
Or is it a problem of the address room in the crt0.s file?

Thanks for your answers.

von Martin T. (mthomas) (Moderator)


Rate this post
useful
not useful
Sebastian wrote:
> Hello,
> I use the WinIDEA software and make a new projekt with the
> lpc2138_uart0_irq projektfiles. I use the external make
> \winarm\utils\bin\make.exe from the WinARM download files.

I have never used this IDE so I can only provide some hints.  I suggest
to ask the iSystems support.

> Now the Problem:
> the linker doesn' t work in a correct way.
> The funktions do not have the right adresses.
> Where mußt I serge the problem? In the crt0.S, LPC2138-ROM.ld or in the
> makefile?
> Is it a problem of the linker?
> Or is it a problem of the address room in the crt0.s file?

Can you build the project correctly from the command-line? Are you sure
the the correct makefile is used? Is there any output of the build
process shown? Which toolchain is used?

von Sebastian (Guest)


Rate this post
useful
not useful
Hi,
if I programm the code with your ISP Files it works great.
If I program your code in the IDEA with the external makefile it works
great too.( I do not wrote it before, sorry)
But if I modify the code and Init timer2 and start a Interrupt service
routine, the programm does not work any longer. I mean the problem is by
activating the ISR.
Now I think the problem is anyway in the crt0.s file.
The programm stopped in the last 6 lines in this part of the code:
(undefined, data abort, programm abort)

// 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

#if 0
// Use this group for production
_undf:  .word _reset                    // undefined - _reset
_swi:   .word _reset                    // SWI - _reset
_pabt:  .word _reset                    // program abort - _reset
_dabt:  .word _reset                    // data abort - _reset
_irq:   .word _reset                    // IRQ - _reset
_fiq:   .word _reset                    // FIQ - _reset

#else
// Use this group for development
_undf:  .word __undf                    // undefined
_swi:   .word __swi                     // SWI
_pabt:  .word __pabt                    // program abort
_dabt:  .word __dabt                    // data abort
_irq:   .word __irq                     // IRQ
_fiq:   .word __fiq                     // FIQ

__undf: b     .                         // undefined
__swi:  b     .                         // SWI
__pabt: b     .                         // program abort
__dabt: b     .                         // data abort
__irq:  b     .                         // IRQ
__fiq:  b     .                         // FIQ
#endif
        .size _boot, . - _boot
        .endfunc

What could it be?
Thanks a lot and a nice weekend.
Sebastian

von Martin T. (mthomas) (Moderator)


Rate this post
useful
not useful
Sebastian wrote:
> if I programm the code with your ISP Files it works great.
> If I program your code in the IDEA with the external makefile it works
> great too.( I do not wrote it before, sorry)
> But if I modify the code and Init timer2 and start a Interrupt service
> routine, the programm does not work any longer. I mean the problem is by
> activating the ISR.

In the default setup of the mentioned example UART0 is used in
"interrupt-mode". So if the UART ist working as expected the interrupt
setup in "core-level" should be correct.

I expect the problem is caused by your modifications and additional
functions (timer-init, timer-ISR). Difficult to help without looking at
your code. Make sure to follow the scheme of creating an ISR with
"exit/entry"-macros and "nacked"-attribut since this is the method used
in this example (see uartISR.h/.c armVIC.h/.c).

> Now I think the problem is anyway in the crt0.s file.

I don't think so but more information on you modifications is needed
first.

> The programm stopped in the last 6 lines in this part of the code:
> (undefined, data abort, programm abort)

In which of the "endless loops"?

>...

Martin Thomas

von Sebastian (Guest)


Rate this post
useful
not useful
Hello Martin Thomas,
hier der Code für den Timer:

// Setup für Timer1 Initialisierung
void Setup_Timer1(void)
   {
     T1IR = 0x000000FF;      // Interrupt Register
     T1TCR = 0x00000011;     // Timer Control Register
     T1TCR = 0x00000001;
     T1CTCR = 0x00000000;    // Count Control Register
     T1PR = 0x0000000E;      //Timer1 prescale   0x00000800 origin
     T1MR0 = 0x03E8;         //Timer1 match Reg 0
     T1MCR = 0x00000003;     //Reset and interrupt match
     T1EMR &= 0x00000000;
   }


// Setup für Timer Interrupts
void Setup_Timer1_Int(void)
   {
     VICSoftIntClear  = 0x00000020;
     VICSoftIntClear  = 0x00000000;

     VICIntSelect &= ~VIC_BIT(VIC_TIMER1);       // IRQ to timer1
     VICIntEnable = VIC_BIT(VIC_TIMER1);         //Timer0 interrupt
enable
     VICVectCntl3 = VIC_ENABLE | VIC_TIMER1;     //Interrupt source
5(Timer1)
     VICVectAddr3 = (unsigned)Int_Irq_Timer1;    // Address of the ISR
   }


and here the ISR:

 // Timer Interrupt Funktion
 void Int_Irq_Timer1(void)
   {

    ISR_ENTRY();   // armVIC.c

     T1IR = 0xFF;
     T1IR = 0;
     toggle++;

     time_counter++;        // interrupt counter

     VICVectAddr = 0x00000000;   //reset VIC
     ISR_EXIT();   // armVIC.c       // recover registers and return

   }

this Code is from an example from winIDEA. there it works without a
problem.
I didn't touch your code in any way.

>> The programm stopped in the last 6 lines in this part of the code:
>> (undefined, data abort, programm abort)
>
> In which of the "endless loops"?

The loop is:
__dabt: b     .     // data abort

I hope you can help me now.

von Sebastian (Guest)


Rate this post
useful
not useful
Hello,
I looked again and the programm stopped in several endless loops:

 In which of the "endless loops"?

 The loop is:
 __dabt: b     .     // data abort
 __undf: b     .      // undefined
__pabt: b     .      // program abort

MfG
Sebastian

von Martin T. (mthomas) (Moderator)


Rate this post
useful
not useful
add the "naked" function-attribute and give it a try:

void Int_Irq_Timer1(void) __attribute__((naked));
void Int_Irq_Timer1(void)
{
  ...

von Sebastian (Guest)


Rate this post
useful
not useful
Hello Martin Thomas,

thanks for your help, now it works.

what a little mistake.....

Sebastian

Thanks a lot!!!!

Martin Thomas wrote:
> add the "naked" function-attribute and give it a try:
>
> void Int_Irq_Timer1(void) __attribute__((naked));
> void Int_Irq_Timer1(void)
> {
>   ...

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.