At 12:49 AM 3/14/2006 +0000, Rebekah Moser wrote:
>--- In lpc2000@lpc2..., "Rebekah Moser"
<moserr@...> wrote:
> > I disassembled the code it jumps to for _start,
> > which looks like so:
> >
> > 0x00000258 E3A00016 MOV R0,#0x00000016
> > 0x0000025C E28F10E8 ADD R1,PC,#0x000000E8
> > 0x00000260 EF123456 SWI 0x00123456
>
>More info on this - this code comes from crt0.o. It appears that gcc
>version 4.0.2 has several crt0 options: crt0.o, rdimon-crt0.o,
>rdpmon-crt0.o, and redboot-crt0.o. Not all of them have the offending
>SWI instruction in them. What is the difference between these?
Those are all for different boards (some with built-in monitors) and since
you are asking in an LPC group it's likely that none are appropriate. You
need startup specific to the LPC to deal with its memory map and any other
init you want to occur before the main C code, just as you would for any
other microcontroller.
There are multiple examples around. I think there are some in the groups
files section. Also take a look at the newlib-lpc stuff at
http://www.aeolusdevelopment.com/Articles/download.html although that's set
up for newlib and the distribution you are using appears to be using a
different library. You might also want to take a look at the WINARM
distribution which includes the newlib-lpc stuff. There is also the
Crossworks distribution which includes a number of other items.
Robert
At 12:49 AM 3/14/2006 +0000, Rebekah Moser wrote:
>--- In lpc2000@lpc2..., "Rebekah Moser"
<moserr@...> wrote:
> > I disassembled the code it jumps to for _start,
> > which looks like so:
> >
> > 0x00000258 E3A00016 MOV R0,#0x00000016
> > 0x0000025C E28F10E8 ADD R1,PC,#0x000000E8
> > 0x00000260 EF123456 SWI 0x00123456
>
>More info on this - this code comes from crt0.o. It appears that gcc
>version 4.0.2 has several crt0 options: crt0.o, rdimon-crt0.o,
>rdpmon-crt0.o, and redboot-crt0.o. Not all of them have the offending
>SWI instruction in them. What is the difference between these?
Those are all for different boards (some with built-in monitors) and since
you are asking in an LPC group it\'s likely that none are appropriate. You
need startup specific to the LPC to deal with its memory map and any other
init you want to occur before the main C code, just as you would for any
other microcontroller.
There are multiple examples around. I think there are some in the groups
files section. Also take a look at the newlib-lpc stuff at
http://www.aeolusdevelopment.com/Articles/download.html although that\'s
set
up for newlib and the distribution you are using appears to be using a
different library. You might also want to take a look at the WINARM
distribution which includes the newlib-lpc stuff. There is also the
Crossworks distribution which includes a number of other items.
Robert
Reply by Robert Adsett●March 13, 20062006-03-13
At 12:49 AM 3/14/2006 +0000, Rebekah Moser wrote:
>--- In lpc2000@lpc2..., "Rebekah Moser"
<moserr@...> wrote:
> > I disassembled the code it jumps to for _start,
> > which looks like so:
> >
> > 0x00000258 E3A00016 MOV R0,#0x00000016
> > 0x0000025C E28F10E8 ADD R1,PC,#0x000000E8
> > 0x00000260 EF123456 SWI 0x00123456
>
>More info on this - this code comes from crt0.o. It appears that gcc
>version 4.0.2 has several crt0 options: crt0.o, rdimon-crt0.o,
>rdpmon-crt0.o, and redboot-crt0.o. Not all of them have the offending
>SWI instruction in them. What is the difference between these?
Those are all for different boards (some with built-in monitors) and since
you are asking in an LPC group it\\\'s likely that none are appropriate.
You
need startup specific to the LPC to deal with its memory map and any other
init you want to occur before the main C code, just as you would for any
other microcontroller.
There are multiple examples around. I think there are some in the groups
files section. Also take a look at the newlib-lpc stuff at
http://www.aeolusdevelopment.com/Articles/download.html although that\\\'s
set
up for newlib and the distribution you are using appears to be using a
different library. You might also want to take a look at the WINARM
distribution which includes the newlib-lpc stuff. There is also the
Crossworks distribution which includes a number of other items.
Robert
Reply by Rebekah Moser●March 13, 20062006-03-13
--- In lpc2000@lpc2..., "Rebekah Moser" <moserr@...> wrote:
> I disassembled the code it jumps to for _start,
> which looks like so:
>
> 0x00000258 E3A00016 MOV R0,#0x00000016
> 0x0000025C E28F10E8 ADD R1,PC,#0x000000E8
> 0x00000260 EF123456 SWI 0x00123456
More info on this - this code comes from crt0.o. It appears that gcc
version 4.0.2 has several crt0 options: crt0.o, rdimon-crt0.o,
rdpmon-crt0.o, and redboot-crt0.o. Not all of them have the offending
SWI instruction in them. What is the difference between these?
Thanks,
Rebekah
Reply by Tom Walsh●March 12, 20062006-03-12
Rebekah Moser wrote:
>I am using the Keil uVision development environment
with the GNU tools
>for a Philips LPC2148. Using the version of GCC currently being
>shipped with the debugger (3.3.1 or some such thing - it's 2.5 yrs
>old) I stepped through the branch to _start at the end of my startup
>assembly file that sets exception vectors, stacks, etc. It bounced
>around a bit then hit a SWI instruction and decided that was
>undefined. I loaded up gcc-4.0.2 and now I am seeing SWI
>as the third instruction of _start. Furthermore, it is SWI 0x00123456
>which is really weird. I checked the linker map to verify that it was
>getting the library from the right place, and things looked reasonable
>there. In the Keil tools I am using support for calls between ARM and
>THUMB, compiling THUMB code, and enabling ARM/THUMB interworking. I
>did not give the linker any additional include path or commands beyond
>what the Keil tool sets up. I have also tried turning off all the
>THUMB stuff to do a straight ARM system, but it didn't help. Any
>suggestions on where to go from here would be greatly appreciated.
>
>
>
Reading your post, one assumes that the processor is being caught right
at startup by the JTAG debugger. However, this reminds me of a problem
I ran into very early in development. I had a bad situation where the
program would ABORT, I tried to use the JTAG to find the problem but the
JTAG would only connect me to an aborted processor.
The problem was this, the JTAG (BDI2000) would reset the CPU, then delay
for a short interval and then go through the process of stopping the CPU
via the JTAG chain. During the time between the reset inactive and when
the JTAG finally "caught" the processor, the CPU had run through a
large
number of instructions and hit the abort point.
This was solved by placing a delay loop in the crt0.S file which forces
the CPU to configure the secondary JTAG (LPC2106), then delay. The
delay allows the Abatron BDI2000 time to "catch" the CPU via the JTAG.
This a snippet of my LPC2106 startup, and representative of the same
thing in the LPC2138 which I also use:
============= begin crt0.S ==============...
...
JTAG2:
.word 0x55400000
PINSELREG:
.word 0xe002c004
.size _boot, . - _boot
.endfunc
// Setup the operating mode & stack.
// ---------------------------------
.global _start, start, _mainCRTStartup
.func _start
_start:
start:
_mainCRTStartup:
;
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.
;
ldr r0,=_stack
msr CPSR_c,#MODE_UND|I_BIT|F_BIT // Undefined Instruction Mode
============== snip ================== TomW
--
Tom Walsh - WN3L - Embedded Systems Consultant
http://openhardware.net,http://cyberiansoftware.com
"Windows? No thanks, I have work to do..."
----------------
Reply by Rebekah Moser●March 12, 20062006-03-12
I am using the Keil uVision development environment with the GNU tools
for a Philips LPC2148. Using the version of GCC currently being
shipped with the debugger (3.3.1 or some such thing - it's 2.5 yrs
old) I stepped through the branch to _start at the end of my startup
assembly file that sets exception vectors, stacks, etc. It bounced
around a bit then hit a SWI instruction and decided that was
undefined. I loaded up gcc-4.0.2 and now I am seeing SWI
as the third instruction of _start. Furthermore, it is SWI 0x00123456
which is really weird. I checked the linker map to verify that it was
getting the library from the right place, and things looked reasonable
there. In the Keil tools I am using support for calls between ARM and
THUMB, compiling THUMB code, and enabling ARM/THUMB interworking. I
did not give the linker any additional include path or commands beyond
what the Keil tool sets up. I have also tried turning off all the
THUMB stuff to do a straight ARM system, but it didn't help. Any
suggestions on where to go from here would be greatly appreciated.
Rebekah