Address Traps

General discussion on mikroPascal PRO for dsPIC30/33 and PIC24.
Post Reply
Author
Message
JimKueneman
Posts: 417
Joined: 10 Jan 2009 22:03

Address Traps

#1 Post by JimKueneman » 05 Oct 2012 16:26

I have an error that throws an Address Trap. I am reading the stack to see where the Program Counter was before the trap was called. The PC was at 0x204C. What does that mean in the listing below? It occurred on the return of the _ReadConfiguration function call?

Code: Select all

;NMRAnetStateMachine.mpas,774 :: 		DatagramBuffer^.iByteCount := DatagramBuffer^.iByteCount + ConfigurationRead(Node, @DataBytes[i], BaseBuffer^.Tag, 1);
0x202A	0x90080E  	MOV	[W14+16], W0
0x202C	0x40006C  	ADD	W0, #12, W0
0x202E	0x980F60  	MOV	W0, [W14+28]
0x2030	0x980F50  	MOV	W0, [W14+26]
0x2032	0x4700E0  	ADD	W14, #0, W1
0x2034	0x980F41  	MOV	W1, [W14+24]
0x2036	0x470068  	ADD	W14, #8, W0
0x2038	0x408090  	ADD	W1, [W0], W1
0x203A	0x90006E  	MOV	[W14+12], W0
0x203C	0x40006A  	ADD	W0, #10, W0
0x203E	0xBE9F8A  	PUSH.D	W10
0x2040	0x780610  	MOV	[W0], W12
0x2042	0xEB0680  	CLR	W13
0x2044	0x780581  	MOV	W1, W11
0x2046	0x200010  	MOV	#1, W0
0x2048	0x781F80  	PUSH	W0
0x204A	0x07F330  	RCALL	_ConfigurationRead
0x204C	0xB1002F  	SUB	#2, W15
0x204C	0xB1002F  	SUB	#2, W15
0x204E	0xBE054F  	POP.D	W10
0x2050	0x9008DE  	MOV	[W14+26], W1
ReadConfiguration looks like this:

Code: Select all

_ConfigurationRead:
0x06AC	0xFA0000  	LNK	#0
;NMRAnetAppDefines.mpas,415 :: 		begin
;NMRAnetAppDefines.mpas,416 :: 		while _25AAxxxx_Busy(EEPROM_BANK_0) do
; MaxCount start address is: 4 (W2)
0x06AE	0x97F90E  	MOV.B	[W14-8], W2
; MaxCount end address is: 4 (W2)
L__ConfigurationRead10:
; MaxCount start address is: 4 (W2)
0x06B0	0x781F8A  	PUSH	W10
0x06B2	0xEF2014  	CLR	W10
0x06B4	0x07FE7C  	RCALL	__25AAxxxx_Busy
0x06B6	0x78054F  	POP	W10
0x06B8	0xE20000  	CP0	W0
0x06BA	0x320006  	BRA Z	L__ConfigurationRead11
L__ConfigurationRead28:
;NMRAnetAppDefines.mpas,417 :: 		Delay_us(10);
0x06BC	0x200427  	MOV	#66, W7
L__ConfigurationRead14:
0x06BE	0xED200E  	DEC	W7
0x06C0	0x3AFFFE  	BRA NZ	L__ConfigurationRead14
0x06C2	0x000000  	NOP
0x06C4	0x000000  	NOP
0x06C6	0x37FFF4  	BRA	L__ConfigurationRead10
L__ConfigurationRead11:
;NMRAnetAppDefines.mpas,419 :: 		Result := MaxCount;
; Result start address is: 2 (W1)
0x06C8	0x784082  	MOV.B	W2, W1
; MaxCount end address is: 4 (W2)
;NMRAnetAppDefines.mpas,421 :: 		end;
0x06CA	0x784001  	MOV.B	W1, W0
; Result end address is: 2 (W1)
L_end_ConfigurationRead:
0x06CC	0xFA8000  	ULNK
0x06CE	0x060000  	RETURN
Anyone have any thoughts?

Thanks,
Jim

JimKueneman
Posts: 417
Joined: 10 Jan 2009 22:03

Re: Address Traps

#2 Post by JimKueneman » 06 Oct 2012 00:46

I was accessing a bad pointer, problem solved.

Jim

Post Reply

Return to “mikroPascal PRO for dsPIC30/33 and PIC24 General”