EmbeddedRelated.com
Forums

LPC2294 GCC Start

Started by dimaissaev December 15, 2004

Hello all.

I try to use GCC with this this microprocessor. But it's don't work.
I'm use a Phytec board. Could anyone send me any examples, how-to use
gcc with this chip at all? Any example like "blink"?

I think that problem in a "user validation cheking" I have a NOP at
0x0000 0014 adress. I's did't looks like "2's complement of the check-
sum of the remaining interrupt vectors". Is this OK?



An Engineer's Guide to the LPC2100 Series


Hello.

I have found that if I (with Philips Utility) say "go from addres
0x50"

/*
.text 0x00000000 0x10c crt0.o
0x000000ec reset
0x00000000 _boot
0x00000050 _mainCRTStartup
0x000000ec abort
0x00000050 _start
0x000000ec _reset
0x000000ec exit
0x00000050 start
*/

everything ok. What the EC address? What that mean?

(I'm use "WinARM")
Why "go from 0x00 don't work"?



Looks like you just have the addresses of the handlers, rather than
instructions
to load the PC with the address. Here's a snippet of how mine (working)
looks:

.global _startup
.func _startup
_startup:
# Exception Vectors
# Mapped to Address 0.
# Absolute addressing mode must be used.
# Dummy Handlers are implemented as infinite loops which can be
modified.

Vectors: LDR PC, Reset_Addr
LDR PC, Undef_Addr
LDR PC, SWI_Addr
LDR PC, PAbt_Addr
LDR PC, DAbt_Addr
NOP /* Reserved
Vector */
LDR PC,[PC,#-0xFF0]
LDR PC, FIQ_Addr

Reset_Addr: .word Reset_Handler
Undef_Addr: .word Undef_Handler
SWI_Addr: .word SWI_Handler
PAbt_Addr: .word PAbt_Handler
DAbt_Addr: .word DAbt_Handler
.word 0 /* Reserved
Address */
IRQ_Addr: .word IRQ_Handler
FIQ_Addr: .word FIQ_Handler ...and the disassembly listing: FW.elf: file format elf32-littlearm

Disassembly of section .text:

00000000 <_startup>:
0: e59ff018 ldr pc, [pc, #24] ; 20 <Reset_Addr>
4: e59ff018 ldr pc, [pc, #24] ; 24 <Undef_Addr>
8: e59ff018 ldr pc, [pc, #24] ; 28 <SWI_Addr>
c: e59ff018 ldr pc, [pc, #24] ; 2c <PAbt_Addr>
10: e59ff018 ldr pc, [pc, #24] ; 30 <DAbt_Addr>
14: e1a00000 nop (mov r0,r0)
18: e51ffff0 ldr pc, [pc, #-4080] ; fffff030
<VPB_DIV_ADDR+0x1fe02f30>
1c: e59ff018 ldr pc, [pc, #24] ; 3c <FIQ_Addr>

00000020 <Reset_Addr>:
20: 000000a0 andeq r0, r0, r0, lsr #1

00000024 <Undef_Addr>:
24: 00000040 andeq r0, r0, r0, asr #32

00000028 <SWI_Addr>:
28: 00000050 andeq r0, r0, r0, asr r0

0000002c <PAbt_Addr>:
2c: 00000060 andeq r0, r0, r0, rrx

00000030 <DAbt_Addr>:
30: 00000070 andeq r0, r0, r0, ror r0
34: 00000000 andeq r0, r0, r0

00000038 <IRQ_Addr>:
38: 00000080 andeq r0, r0, r0, lsl #1

0000003c <FIQ_Addr>:
3c: 00000090 muleq r0, r0, r0 As an aside, this works with both Keil (windows) and gnu (linux) build
environments.

hth,

--rich

-----Original Message-----
From: dimaissaev [mailto:]
Sent: Wednesday, December 15, 2004 1:44 AM
To:
Subject: [lpc2000] LPC2294 GCC Start
Hello.

I have found that if I (with Philips Utility) say "go from
addres
0x50"

/*
.text 0x00000000 0x10c crt0.o
0x000000ec reset
0x00000000 _boot
0x00000050 _mainCRTStartup
0x000000ec abort
0x00000050 _start
0x000000ec _reset
0x000000ec exit
0x00000050 start
*/

everything ok. What the EC address? What that mean?

(I'm use "WinARM")
Why "go from 0x00 don't work"?
click here
<http://us.ard.yahoo.com/SIG9a1p115/M)4855.5468653.6549235.3001176/
D=groups/S06554205:HM/EXP03190260/A$55397/R=0/SIG9u9qmi7/*htt
p://smallbusiness.yahoo.com/domains/>

<http://us.adserver.yahoo.com/l?M)4855.5468653.6549235.3001176/D=group
s/S=:HM/A$55397/randd2678086 ________________________________

> .





--- In , "Richard Rauscher" <richard@m...>
wrote:
> Looks like you just have the addresses of the handlers, rather than
> instructions

Thank for replay. But it's don't work.

I have:

37 // Runtime Interrupt Vectors
38 // -------------------------
39 Vectors:
40 0000 18F09FE5 ldr pc, Reset_Addr
41 0004 18F09FE5 ldr pc, Undef_Addr
42 0008 18F09FE5 ldr pc, SWI_Addr
43 000c 18F09FE5 ldr pc, PAbt_Addr
44 0010 18F09FE5 ldr pc, DAbt_Addr
45 0014 0000A0E1 nop
46 0018 F0FF1FE5 ldr pc,[pc,#-0xFF0] // IRQ -
read the VIC
47 001c 18F09FE5 ldr pc,FIQ_Addr // FIQ -
_fiq
48
49 0020 44000000 Reset_Addr: .word Reset_Handler
50 0024 40000000 Undef_Addr: .word Undef_Handler
51 0028 40000000 SWI_Addr: .word SWI_Handler
52 002c 40000000 PAbt_Addr: .word PAbt_Handler
53 0030 40000000 DAbt_Addr: .word DAbt_Handler
54 0034 00000000 .word 0 /* Reserved Address */
55 0038 40000000 IRQ_Addr: .word IRQ_Handler
56 003c 40000000 FIQ_Addr: .word FIQ_Handler
57
58
59 Undef_Handler:
60 SWI_Handler:
61 PAbt_Handler:
62 DAbt_Handler:
63 IRQ_Handler:
64 FIQ_Handler:
65 0040 0E0000EA b . //
undefined
67 .endfunc
68
69
70 // Setup the operating mode & stack.
71 // ---------------------------------
72 .global _start, start, _mainCRTStartup
73 .func _start
74
75 _start:
76 start:
77 _mainCRTStartup:
78 Reset_Handler:
79
80 // Initialize Interrupt System
81 // - Set stack location for each mode
82 // - Leave in System Mode with Interrupts Disabled
83 // -----------
84 0044 98009FE5 ldr r0,=_stack
85 0048 DBF021E3 msr CPSR_c,#MODE_UND|I_BIT|F_BIT //
Undefined Instruction Mode
86 004c 00D0A0E1 mov sp,r0
...
...
...

If I run my program from 0x44 it's work.
If I run from 0 it's don't work.

BUT! If I run from 0x04 or 0x08 it's work! From 0x0C and 0x10 don't
work.

main.elf: file format elf32-littlearm

Disassembly of section .text:

00000000 <_boot>:
0: e59ff018 ldr pc, [pc, #24] ; 20 <Reset_Addr>
4: e59ff018 ldr pc, [pc, #24] ; 24 <Undef_Addr>
8: e59ff018 ldr pc, [pc, #24] ; 28 <SWI_Addr>
c: e59ff018 ldr pc, [pc, #24] ; 2c <PAbt_Addr>
10: e59ff018 ldr pc, [pc, #24] ; 30 <DAbt_Addr>
14: e1a00000 nop (mov r0,r0)
18: e51ffff0 ldr pc, [pc, #-4080] ; fffff030
<_stack+0xbfffeb30>
1c: e59ff018 ldr pc, [pc, #24] ; 3c <FIQ_Addr>

00000020 <Reset_Addr>:
20: 00000044 andeq r0, r0, r4, asr #32

00000024 <Undef_Addr>:
24: 00000040 andeq r0, r0, r0, asr #32

00000028 <SWI_Addr>:
28: 00000040 andeq r0, r0, r0, asr #32

0000002c <PAbt_Addr>:
2c: 00000040 andeq r0, r0, r0, asr #32

00000030 <DAbt_Addr>:
30: 00000040 andeq r0, r0, r0, asr #32
34: 00000000 andeq r0, r0, r0

00000038 <IRQ_Addr>:
38: 00000040 andeq r0, r0, r0, asr #32

0000003c <FIQ_Addr>:
3c: 00000040 andeq r0, r0, r0, asr #32

00000040 <DAbt_Handler>:
40: eafffffe b 40 <DAbt_Handler>

00000044 <_mainCRTStartup>:
44: e59f0098 ldr r0, [pc, #152] ; e4 <.text+0xe4>
48: e321f0db msr CPSR_c, #219 ; 0xdb
4c: e1a0d000 mov sp, r0
50: e2400004 sub r0, r0, #4 ; 0x4
54: e321f0d7 msr CPSR_c, #215 ; 0xd7
58: e1a0d000 mov sp, r0
5c: e2400004 sub r0, r0, #4 ; 0x4
60: e321f0d1 msr CPSR_c, #209 ; 0xd1
64: e1a0d000 mov sp, r0
68: e2400004 sub r0, r0, #4 ; 0x4
6c: e321f0d2 msr CPSR_c, #210 ; 0xd2
70: e1a0d000 mov sp, r0
74: e2400080 sub r0, r0, #128 ; 0x80
78: e321f0d3 msr CPSR_c, #211 ; 0xd3
7c: e1a0d000 mov sp, r0
80: e2400004 sub r0, r0, #4 ; 0x4
84: e321f0df msr CPSR_c, #223 ; 0xdf In simulator (mVision3) my program working.
> to load the PC with the address. Here's a snippet of how mine
(working)
> looks:
>
> .global _startup
> .func _startup
> _startup: >
> # Exception Vectors
> # Mapped to Address 0.
> # Absolute addressing mode must be used.
> # Dummy Handlers are implemented as infinite loops which can be
> modified.
>
> Vectors: LDR PC, Reset_Addr
> LDR PC, Undef_Addr
> LDR PC, SWI_Addr
> LDR PC, PAbt_Addr
> LDR PC, DAbt_Addr
> NOP /* Reserved
> Vector */
> LDR PC,[PC,#-0xFF0]
> LDR PC, FIQ_Addr
>
> Reset_Addr: .word Reset_Handler
> Undef_Addr: .word Undef_Handler
> SWI_Addr: .word SWI_Handler
> PAbt_Addr: .word PAbt_Handler
> DAbt_Addr: .word DAbt_Handler
> .word 0 /* Reserved
> Address */
> IRQ_Addr: .word IRQ_Handler
> FIQ_Addr: .word FIQ_Handler > ...and the disassembly listing: > FW.elf: file format elf32-littlearm
>
> Disassembly of section .text:
>
> 00000000 <_startup>:
> 0: e59ff018 ldr pc, [pc, #24] ; 20 <Reset_Addr>
> 4: e59ff018 ldr pc, [pc, #24] ; 24 <Undef_Addr>
> 8: e59ff018 ldr pc, [pc, #24] ; 28 <SWI_Addr>
> c: e59ff018 ldr pc, [pc, #24] ; 2c <PAbt_Addr>
> 10: e59ff018 ldr pc, [pc, #24] ; 30 <DAbt_Addr>
> 14: e1a00000 nop (mov r0,r0)
> 18: e51ffff0 ldr pc, [pc, #-4080] ; fffff030
> <VPB_DIV_ADDR+0x1fe02f30>
> 1c: e59ff018 ldr pc, [pc, #24] ; 3c <FIQ_Addr>
>
> 00000020 <Reset_Addr>:
> 20: 000000a0 andeq r0, r0, r0, lsr #1
>
> 00000024 <Undef_Addr>:
> 24: 00000040 andeq r0, r0, r0, asr #32
>
> 00000028 <SWI_Addr>:
> 28: 00000050 andeq r0, r0, r0, asr r0
>
> 0000002c <PAbt_Addr>:
> 2c: 00000060 andeq r0, r0, r0, rrx
>
> 00000030 <DAbt_Addr>:
> 30: 00000070 andeq r0, r0, r0, ror r0
> 34: 00000000 andeq r0, r0, r0
>
> 00000038 <IRQ_Addr>:
> 38: 00000080 andeq r0, r0, r0, lsl #1
>
> 0000003c <FIQ_Addr>:
> 3c: 00000090 muleq r0, r0, r0 > As an aside, this works with both Keil (windows) and gnu (linux)
build
> environments.
>
> hth,
>
> --rich
>
> -----Original Message-----
> From: dimaissaev [mailto:dimaissaev@y...]
> Sent: Wednesday, December 15, 2004 1:44 AM
> To:
> Subject: [lpc2000] LPC2294 GCC Start >
> Hello.
>
> I have found that if I (with Philips Utility) say "go from
> addres
> 0x50"
>
> /*
> .text 0x00000000 0x10c crt0.o
> 0x000000ec reset
> 0x00000000 _boot
> 0x00000050 _mainCRTStartup
> 0x000000ec abort
> 0x00000050 _start
> 0x000000ec _reset
> 0x000000ec exit
> 0x00000050 start
> */
>
> everything ok. What the EC address? What that mean?
>
> (I'm use "WinARM")
> Why "go from 0x00 don't work"? >
> click here
> <http://us.ard.yahoo.com/SIG9a1p115/M)4855.5468653.6549235.
3001176/
> D=groups/S06554205:HM/EXP03190260/A$55397/R=0/SIG9u9qmi7/
*htt
> p://smallbusiness.yahoo.com/domains/>
>
> <http://us.adserver.yahoo.com/l?M)4855.5468653.6549235.3001176/
D=group
> s/S=:HM/A$55397/randd2678086 > ________________________________
>
> > .





-----Original Message-----
From: dimaissaev [mailto:]
Sent: Wednesday, December 15, 2004 7:05 PM
To:
Subject: [lpc2000] Re: LPC2294 GCC Start

...

If I run my program from 0x44 it's work.
If I run from 0 it's don't work.

BUT! If I run from 0x04 or 0x08 it's work! From 0x0C and 0x10
don't
work.

Something does not seem correct in that behavior. I don't see
how any of 0x04 - 0x10 can be used as starting points, given
the nature of the corresponding "handler". How exactly, did you
load the code into the flash? Also, how are you verifying its
status (i.e. correct values)? Lastly, how are you running it from
the various addresses?

In simulator (mVision3) my program working.

I'm afraid I am not sure what you're claiming here; that it works
from reset (i.e. 0x0000)?

--rich




--- In , "Richard Rauscher" <richard@m...>
wrote:
>
>
> -----Original Message-----
> From: dimaissaev [mailto:dimaissaev@y...]
> Sent: Wednesday, December 15, 2004 7:05 PM
> To:
> Subject: [lpc2000] Re: LPC2294 GCC Start >
>
> ...
>
> If I run my program from 0x44 it's work.
> If I run from 0 it's don't work.
>
> BUT! If I run from 0x04 or 0x08 it's work! From 0x0C and 0x10
> don't
> work.
>
> Something does not seem correct in that behavior. I don't see
> how any of 0x04 - 0x10 can be used as starting points, given

I can't see too.

> the nature of the corresponding "handler". How exactly, did you
> load the code into the flash? Also, how are you verifying its

By Philips LPC2000 Flash Utility v.2.2.0

> status (i.e. correct values)? Lastly, how are you running it from
> the various addresses?

This utility have a "run from adres" in menu Buffer-> Flash Buffer
operation

>
> In simulator (mVision3) my program working.
>
> I'm afraid I am not sure what you're claiming here; that it works
> from reset (i.e. 0x0000)?

Yes! Of course not from 0x4!

>
> --rich >
>