EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

Startup code working with lpc214x and not with lpc2468

Started by urjust2oocool October 27, 2008
Hello everyone,
I 'm able to work the GNU compiler provided with keil on LPC 214x.
I used the staup code provided with the gnu examples of keil. There
was no issues.
I tried running a small application on LPC 2468. After compiling when
i try to debug it in debug mode it ends up in an infinite loop within
this 3 lines shown below.

0x0000007C E5903008 LDR R3,[R0,#0x0008]
0x00000080 E2133B01 ANDS R3,R3,#0x00000400
0x00000084 0AFFFFFC BEQ 0x0000007C

This doesn't happen with the other lpc 214x series. Can anyone please
tell me why this happens.

An Engineer's Guide to the LPC2100 Series

--- In l..., "urjust2oocool" wrote:
>
> Hello everyone,
> I 'm able to work the GNU compiler provided with keil on LPC 214x.
> I used the staup code provided with the gnu examples of keil. There
> was no issues.
> I tried running a small application on LPC 2468. After compiling when
> i try to debug it in debug mode it ends up in an infinite loop within
> this 3 lines shown below.
>
> 0x0000007C E5903008 LDR R3,[R0,#0x0008]
> 0x00000080 E2133B01 ANDS R3,R3,#0x00000400
> 0x00000084 0AFFFFFC BEQ 0x0000007C
>
> This doesn't happen with the other lpc 214x series. Can anyone please
> tell me why this happens.
>

Register values?

Bit 10 at the location pointed to by [R0 plus 8]is not getting set.
What is [R0 plus 8] pointing at on the 214x? What is [R0 plus 8]
pointing at on the 2468?

Rgds,
Martin

dear james,

This is the assembly code that generates.

0x00000000 E59FF018 LDR PC,[PC,#0x0018]
0x00000004 E59FF018 LDR PC,[PC,#0x0018]
0x00000008 E59FF018 LDR PC,[PC,#0x0018]
0x0000000C E59FF018 LDR PC,[PC,#0x0018]
0x00000010 E59FF018 LDR PC,[PC,#0x0018]
0x00000014 E1A00000 NOP
0x00000018 E51FFFF0 LDR PC,[PC,#-0x0FF0]
0x0000001C E59FF018 LDR PC,[PC,#0x0018]
0x00000020 00000058 ANDEQ R0,R0,R8,ASR R0
0x00000024 00000040 ANDEQ R0,R0,R0,ASR #32
0x00000028 00000044 ANDEQ R0,R0,R4,ASR #32
0x0000002C 00000048 ANDEQ R0,R0,R8,ASR #32
0x00000030 0000004C ANDEQ R0,R0,R12,ASR #32
0x00000034 00000000 ANDEQ R0,R0,R0
0x00000038 00000050 ANDEQ R0,R0,R0,ASR R0
0x0000003C 00000054 ANDEQ R0,R0,R4,ASR R0
0x00000040 EAFFFFFE B 0x00000040
0x00000044 EAFFFFFE B 0x00000044
0x00000048 EAFFFFFE B 0x00000048
0x0000004C EAFFFFFE B 0x0000004C
0x00000050 EAFFFFFE B 0x00000050
0x00000054 EAFFFFFE B 0x00000054
0x00000058 E59F00D0 LDR R0,[PC,#0x00D0]
0x0000005C E3A010AA MOV R1,#0x000000AA
0x00000060 E3A02055 MOV R2,#0x00000055
0x00000064 E3A03024 MOV R3,#0x00000024
0x00000068 E5803004 STR R3,[R0,#0x0004]
0x0000006C E3A03001 MOV R3,#0x00000001
0x00000070 E5803000 STR R3,[R0]
0x00000074 E580100C STR R1,[R0,#0x000C]
0x00000078 E580200C STR R2,[R0,#0x000C]
0x0000007C E5903008 LDR R3,[R0,#0x0008]
0x00000080 E2133B01 ANDS R3,R3,#0x00000400
0x00000084 0AFFFFFC BEQ 0x0000007C

Raj

--- On Mon, 10/27/08, mjames_doveridge wrote:
From: mjames_doveridge
Subject: [lpc2000] Re: Startup code working with lpc214x and not with lpc2468
To: l...
Date: Monday, October 27, 2008, 11:22 AM


--- In lpc2000@yahoogroups .com, "urjust2oocool" wrote:

>

> Hello everyone,

> I 'm able to work the GNU compiler provided with keil on LPC 214x.

> I used the staup code provided with the gnu examples of keil. There

> was no issues.

> I tried running a small application on LPC 2468. After compiling when

> i try to debug it in debug mode it ends up in an infinite loop within

> this 3 lines shown below.

>

> 0x0000007C E5903008 LDR R3,[R0,#0x0008]

> 0x00000080 E2133B01 ANDS R3,R3,#0x00000400

> 0x00000084 0AFFFFFC BEQ 0x0000007C

>

> This doesn't happen with the other lpc 214x series. Can anyone please

> tell me why this happens.

>

Register values?

Bit 10 at the location pointed to by [R0 plus 8]is not getting set.

What is [R0 plus 8] pointing at on the 214x? What is [R0 plus 8]

pointing at on the 2468?

Rgds,

Martin
















--- In l..., Cool Dude wrote:
>
> dear james,
>
> This is the assembly code that generates.
>

Register values?

Bit 10 at the location pointed to by [R0 plus 8]is not getting set.
What is [R0 plus 8] pointing at on the 214x? What is [R0 plus 8]
pointing at on the 2468?

Read the above again. Then get the register values, esp. R0. Compare
the R0 value against the register map of both processors in the user
manuals. You might want to start with the section on the PLL.
Rgds,
Martin

>
> Read the above again. Then get the register values, esp. R0. Compare
> the R0 value against the register map of both processors in the user
> manuals. You might want to start with the section on the PLL.
>

Oh, and look at your startup code *source listing*, (not the
disassembly), where the purpose of the loop should be commented.

Rgds,
Martin

Dear martin,
I cannot watch the execution taking place in startup code. It goes direct to the disassembly window. Maybe because I'm using GNU compile not sure.

Raj

--- On Mon, 10/27/08, mjames_doveridge wrote:
From: mjames_doveridge
Subject: [lpc2000] Re: Startup code working with lpc214x and not with lpc2468
To: l...
Date: Monday, October 27, 2008, 1:36 PM

>

> Read the above again. Then get the register values, esp. R0. Compare

> the R0 value against the register map of both processors in the user

> manuals. You might want to start with the section on the PLL.

>

Oh, and look at your startup code *source listing*, (not the

disassembly) , where the purpose of the loop should be commented.

Rgds,

Martin


DEAR MARTIN,
There is a change in R0 value at point of time. It is mention against the code below. Please check
0x00000000 E59FF018 LDR PC,[PC,#0x0018]
0x00000004 E59FF018 LDR PC,[PC,#0x0018]
0x00000008 E59FF018 LDR PC,[PC,#0x0018]
0x0000000C E59FF018 LDR PC,[PC,#0x0018]
0x00000010 E59FF018 LDR PC,[PC,#0x0018]
0x00000014 E1A00000 NOP
0x00000018 E51FFFF0 LDR PC,[PC,#-0x0FF0]
0x0000001C E59FF018 LDR PC,[PC,#0x0018]
0x00000020 00000058 ANDEQ R0,R0,R8,ASR R0
0x00000024 00000040 ANDEQ R0,R0,R0,ASR #32
0x00000028 00000044 ANDEQ R0,R0,R4,ASR #32
0x0000002C 00000048 ANDEQ R0,R0,R8,ASR #32
0x00000030 0000004C ANDEQ R0,R0,R12,ASR #32
0x00000034 00000000 ANDEQ R0,R0,R0
0x00000038 00000050 ANDEQ R0,R0,R0,ASR R0
0x0000003C 00000054 ANDEQ R0,R0,R4,ASR R0
0x00000040 EAFFFFFE B 0x00000040
0x00000044 EAFFFFFE B 0x00000044
0x00000048 EAFFFFFE B 0x00000048
0x0000004C EAFFFFFE B 0x0000004C
0x00000050 EAFFFFFE B 0x00000050
0x00000054 EAFFFFFE B 0x00000054
0x00000058 E59F00D0 LDR R0,[PC,#0x00D0]
0x0000005C E3A010AA MOV R1,#0x000000AA
0x00000060 E3A02055 MOV R2,#0x00000055
0x00000064 E3A03024 MOV R3,#0x00000024
0x00000068 E5803004 STR R3,[R0,#0x0004]
0x0000006C E3A03001 MOV R3,#0x00000001
0x00000070 E5803000 STR R3,[R0]
0x00000074 E580100C STR R1,[R0,#0x000C]
0x00000078 E580200C STR R2,[R0,#0x000C]

0x0000007C E5903008 LDR R3,[R0,#0x0008] /*At this point the value of R0 in LPC214x is 0x524 and for LPC2468 is 0x5000024.

0x00000080 E2133B01 ANDS R3,R3,#0x00000400
0x00000084 0AFFFFFC BEQ 0x0000007C
0x00000088 E3A03003 MOV R3,#0x00000003

Why is there a change like tht

Raj

--- On Mon, 10/27/08, mjames_doveridge wrote:
From: mjames_doveridge
Subject: [lpc2000] Re: Startup code working with lpc214x and not with lpc2468
To: l...
Date: Monday, October 27, 2008, 1:33 PM


--- In lpc2000@yahoogroups .com, Cool Dude wrote:

>

> dear james,

>

> This is the assembly code that generates.

>

Register values?

Bit 10 at the location pointed to by [R0 plus 8]is not getting set.

What is [R0 plus 8] pointing at on the 214x? What is [R0 plus 8]

pointing at on the 2468?

Read the above again. Then get the register values, esp. R0. Compare

the R0 value against the register map of both processors in the user

manuals. You might want to start with the section on the PLL.

Rgds,

Martin
















--- In l..., Cool Dude wrote:
>
> DEAR MARTIN,
> There is a change in R0 value at point of time. It is mention
against the code below. Please check

Neither value makes any sense.

I would expect a different value, 0xE01FC080, say - it has to be a
hardware register base address since the loop continually reads {r0+8]
waiting for bit to clear.

How are you reading the R0 value?

Did you read the user manual or look at the startup source code?

Rgds,
Martin

> waiting for bit to clear.

Should have been 'waiting for bit to get set':

0x0000007C E5903008 LDR R3,[R0,#0x0008] // read some register
0x00000080 E2133B01 ANDS R3,R3,#0x00000400 // examine bit 10
0x00000084 0AFFFFFC BEQ 0x0000007C // loop if result zero
Sorry,
Martin

Are you using lpc214x startup code on an lpc2468? Thats not gonna work.
it needs a slightly different method of setting up the clock.

--Ray

urjust2oocool wrote:
>
> Hello everyone,
> I 'm able to work the GNU compiler provided with keil on LPC 214x.
> I used the staup code provided with the gnu examples of keil. There
> was no issues.
> I tried running a small application on LPC 2468. After compiling when
> i try to debug it in debug mode it ends up in an infinite loop within
> this 3 lines shown below.
>
> 0x0000007C E5903008 LDR R3,[R0,#0x0008]
> 0x00000080 E2133B01 ANDS R3,R3,#0x00000400
> 0x00000084 0AFFFFFC BEQ 0x0000007C
>
> This doesn't happen with the other lpc 214x series. Can anyone please
> tell me why this happens.
>
>


The 2024 Embedded Online Conference