Yahoo Groups archive

Lpc2000

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

Message

Re: Philip Aps. - Stack Issue - Not???

2005-07-07 by dsidlauskas1

I got tired of waiting for Philips so I wrote my own simple program to
investigate this stack problem. I used Keil.  The code below first
fills the stack area so that the contents of the stack is equal to the
stack address. This makes it easier to see what's being popped. 

With a break at the POP {R4}, SP=0x40000180, PC=0x0180. When the POP
is executed R4 ends up with the correct value of 0x40000180, so I
don't experience the problem. I've tried this both with MAM on and off.

Could this be a JTAG debug problem?

Dave S.

// Investigate POP R4 error in case where all byte high byte of SP and
PC are the same.

#include <LPC213x.H>                       

void main (void) {
__asm {
	// Fill the stack area *stack++ = stack
	MOV	R1, PC
	LDR	R2, =0X40000012
	ADD	R1, R2
	LDR     R2, =4
	LDR	R3, =10
LOOP:
	STR R1, [R1]
	ADD	R1, R2
	SUB	R3, #1
	BNE LOOP

   // Set up conditions for SP = PC + 0x40000000 and POP R4
	NOP			;Stack must be 4 byte alligned
	MOV	SP,PC
	LDR     R2,=0x40000002
	ADD	SP,R2

	POP {R4}
	}
}

Attachments

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.