Yahoo Groups archive

Lpc2000

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

Thread

newbie question - booting

newbie question - booting

2006-03-24 by kathy_wright_ca

I've been developing code for several months on the Keil 2130 board 
with a 2138 - no problems I haven't been able to figure out so far. 

Now I have my new board with 2136 and it doesn't appear to be booting.  
I've compiled with Keil target info set as 2136 and as 2138 and they 
both run on the demo board.  On the new board it gets through the first 
few LDR in the startup code, then gets stuck somewhere up in the boot 
sector.  I've also probed the flash memory contents  on both boards.  
The code is actually different at 0x00000000 but looks the same at the 
end. 

Do I need to set something else in the compiler?  Do I need to set 
something for the boot mode (I'll be reading up on that in the menn 
time).  Any hints/advice is appreciated.

Kathy

Re: newbie question - booting

2006-03-24 by roger_lynx

--- In lpc2000@yahoogroups.com, "kathy_wright_ca"
<kathy_wright_ca@...> wrote:
>
> I've been developing code for several months on the Keil 2130 board 
> with a 2138 - no problems I haven't been able to figure out so far. 
> 
> Now I have my new board with 2136 and it doesn't appear to be booting.  
> I've compiled with Keil target info set as 2136 and as 2138 and they 
> both run on the demo board.  On the new board it gets through the first 
> few LDR in the startup code, then gets stuck somewhere up in the boot 
> sector.  I've also probed the flash memory contents  on both boards.  

> The code is actually different at 0x00000000 but looks the same at
the end. 
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Hello Kathy,

Your observation might be worth looking more into. At reset, the
program counter, PC, is loaded with address 0x0000 0000  that contains
instruction which loads into PC the address of  the reset vector
(jumping over other entries in vector table), like this: 
            org 0x00
            ldr pc, [pc, #0x18]

When this instruction is executed, the PC is 8 bytes ahead (2 words),
so the PC=0x8+0x18 =0x20. 
At 0x20 there is an address of startup's "first" instruction.
It is really the third, but I mean this "first" from a programmer's
point of view, hm?  Two "hops" of the PC are given (0x0 -> 0x20 ->
your  first instruction)

BTW, using ldr pc, [pc, 0x18] makes the second hop to any address in 4
GB space, which is good, but in case of your board, not so good. The
code has to be *identical*, not "actually different at 0x0000000".  
This why the code beginnings have to match.

That is the theory, how do you load the program to FLASH? 
JTAG, UART/bootloader?
Can you you compare the HEX files? 

Good luck.

Best regards

Roger
Show quoted textHide quoted text
> 
> Do I need to set something else in the compiler?  Do I need to set 
> something for the boot mode (I'll be reading up on that in the menn 
> time).  Any hints/advice is appreciated.
> 
> Kathy
>

Re: [lpc2000] newbie question - booting

2006-03-24 by Tom Walsh

kathy_wright_ca wrote:

>I've been developing code for several months on the Keil 2130 board 
>with a 2138 - no problems I haven't been able to figure out so far. 
>
>  
>
Your best bet is to get some type of JTAG running so that you can debug 
the code.  Depending on your JTAG, you may need to place a loop at the 
startup entry label to give the processor some delay so the JTAG can 
reset the board and catch the processor before it starts to excute any 
code beyond the delay loop.  This is what I use on the LPC2106 to allow 
an Abatron BDI2000 to "catch" the processor:

============ begin crt0.S ================
_start:
start:
;
      ldr   r0, JTAG2
      ldr   r1, PINSELREG
      str   r0, [r1]       // activate secondary JTAG port.
;
      mov   r3, #0x10000
startdelay:
      subs  r3, r3, #1
      bne   startdelay     // give debugger time to catch us.
;

============== snip ===================

The above delay is needed on the LPC2106 as I am switching to the 
secondary JTAG and the BDI2000 has no control until that code executes.  
On the LPC2138, no loop is needed as it catches the processor nicely at 
the first opcode.  With a wiggler (lower speed JTAG device), you may 
still need a slight delay loop to catch the processor before it slams 
into whatever bad code you have.


Regards,

TomW


-- 
Tom Walsh - WN3L - Embedded Systems Consultant
http://openhardware.net, http://cyberiansoftware.com
"Windows? No thanks, I have work to do..."
----------------------------------------------------

Re: newbie question - booting

2006-03-24 by kathy_wright_ca

Thanks for your help.  The contents at 0x00000000 were different 
because it was in Bootloader mode instead of Flash mode.  This is 
because I left P0.14 open and its unintionally entering ISP mode on 
reset.  Should be an easy fix with a pullup, we'll see!

-- Kathy



--- In lpc2000@...m, Tom Walsh <tom@...> wrote:
>
> kathy_wright_ca wrote:
> 
> >I've been developing code for several months on the Keil 2130 
board 
> >with a 2138 - no problems I haven't been able to figure out so 
far. 
> >
> >  
> >
> Your best bet is to get some type of JTAG running so that you can 
debug 
> the code.  Depending on your JTAG, you may need to place a loop at 
the 
> startup entry label to give the processor some delay so the JTAG 
can 
> reset the board and catch the processor before it starts to excute 
any 
> code beyond the delay loop.  This is what I use on the LPC2106 to 
allow 
> an Abatron BDI2000 to "catch" the processor:
> 
> ============ begin crt0.S ================
> _start:
> start:
> ;
>       ldr   r0, JTAG2
>       ldr   r1, PINSELREG
>       str   r0, [r1]       // activate secondary JTAG port.
> ;
>       mov   r3, #0x10000
> startdelay:
>       subs  r3, r3, #1
>       bne   startdelay     // give debugger time to catch us.
> ;
> 
> ============== snip ===================
> 
> The above delay is needed on the LPC2106 as I am switching to the 
> secondary JTAG and the BDI2000 has no control until that code 
executes.  
> On the LPC2138, no loop is needed as it catches the processor 
nicely at 
> the first opcode.  With a wiggler (lower speed JTAG device), you 
may 
> still need a slight delay loop to catch the processor before it 
slams 
Show quoted textHide quoted text
> into whatever bad code you have.
> 
> 
> Regards,
> 
> TomW
> 
> 
> -- 
> Tom Walsh - WN3L - Embedded Systems Consultant
> http://openhardware.net, http://cyberiansoftware.com
> "Windows? No thanks, I have work to do..."
> ----------------------------------------------------
>

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.