Keil™, An ARM® Company

Discussion Forum

Program counter location

Next Thread | Thread List | Previous Thread Start a Thread | Settings

DetailsMessage
Read-Only
Author
Sendhilraj Thangaraj
Posted
14-Dec-2005 08:47 GMT
Toolset
ARM
New! Program counter location
Hi
i got a problem.I am giving the program aswell as how the program looks in the disassembly window.


	Area copy, code , readonly
		ENTRY
start           LDR r1,=srcstr; pointer to the first string
		LDR r0,=dststr; pointer to the second string
strcopy
		LDRB r2,[r1],#1	; Loads a byte and update the address
		strb r2, [r0],#1; stores a byte and update the address
		cmp r2,#0		; checks for zero terminator
		BNE strcopy

stop
		SWI 0x11		; terminate

		Area Strings, DATA, READWRITE
srcstr	DCB "ab",0
dststr  DCB "second string-destination",0
		END

As you can see the program is getting stored at location 0x00000010 .When i run the program the program starts executing at location 0x00000000 and it gives the error
*** error 65: access violation at 0x00000000 : no 'execute/read' permission

I would like to know how i could make my program execution to start at 0x00000010 .

0x00000000  00000000  ANDEQ     R0,R0,R0
0x00000004  00000000  ANDEQ     R0,R0,R0
0x00000008  00000000  ANDEQ     R0,R0,R0
0x0000000C  00000000  ANDEQ     R0,R0,R0
     3: start   LDR r1,=srcstr; pointer to the first string
0x00000010  E59F1014  LDR       R1,[PC,#0x0014]
     4:                 LDR r0,=dststr; pointer to the second string
     5: strcopy
0x00000014  E59F0014  LDR       R0,[PC,#0x0014]
     6:                 LDRB r2,[r1],#1 ; Loads a byte and update the address
0x00000018  E4D12001  LDRB      R2,[R1],#0x0001
     7:                 strb r2, [r0],#1; stores a byte and update the address
0x0000001C  E4C02001  STRB      R2,[R0],#0x0001
     8:                 cmp r2,#0              ; checks for zero terminator
0x00000020  E3520000  CMP       R2,#0x00000000
     9:                 BNE strcopy
    10:
    11: stop
0x00000024  1AFFFFFB  BNE       0x00000018
    12:                 SWI 0x11                ; terminate
0x00000028  EF000011  SWI       0x00000011


looking for your help
t.senthil
Read-Only
Author
Jon Ward
Posted
14-Dec-2005 12:54 GMT
Toolset
ARM
New! RE: Program counter location
I would like to know how i could make my program execution to start at 0x00000010.

After you load the program into the simulator, type $=0x10 in the command window. This sets the program counter address.

Jon
Read-Only
Author
Sendhilraj Thangaraj
Posted
15-Dec-2005 05:43 GMT
Toolset
ARM
New! RE: Program counter location- Thanks
Fine it works with the command prompt...

Well , Is there any file inside keil that i could change so that the program execution starts automatically at the location 0x00000010 when i run the program.

If so which file should i look into, to change the PC location?

Thanks for ur help Jon.
Read-Only
Author
Jon Ward
Posted
15-Dec-2005 14:08 GMT
Toolset
ARM
New! RE: Program counter location- Thanks
Well , Is there any file inside keil that i could change so that the program execution starts automatically at the location 0x00000010 when i run the program.

You can create a script file with whatever commands you want to run when the debugger starts (see the Debug tab on the project options dialog).

You can add

$=0x10
g

to this file.

Take a look at http://www.keil.com/support/docs/3156.htm for more details.

Jon

Next Thread | Thread List | Previous Thread Start a Thread | Settings