Yahoo Groups archive

Lpc2000

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

Thread

Outputing the Link Regisister

Outputing the Link Regisister

2006-04-08 by fordp2002

I am doing development work on a PC that does not have a working
printer port  (that is another story). My wiggler is therfore useless
on this PC.

I am writing just using the Philips Flash wrting program.

I am getting on pretty well but I hit the Undef handler from time to
time. Which in my case flashes a LED with a noticable pattern.

What would be more useful is to know what code caused it so i though
if I put the contents of the Link Regitser out on a serial port I
already have then that would speed things up.

Does anybody know how to get the contents of the Link Register into a
32 bit C Varible.

Maybe I need a bit of inline assembeler ;)

Thanks in advance.

Re: [lpc2000] Outputing the Link Regisister

2006-04-08 by Richard Duits

In gcc you can define a variable like this:
register unsigned int return_address __asm("lr");

This also prevents gcc from using the LR register in that function.

The RealView compiler has a intrinsic function to access the return 
address (and also one for the stack pointer). I don't know the exact 
name and I don't have manual with me right now.

Regards,
Richard.




fordp2002 wrote:
Show quoted textHide quoted text
> I am doing development work on a PC that does not have a working
> printer port  (that is another story). My wiggler is therfore useless
> on this PC.
>
> I am writing just using the Philips Flash wrting program.
>
> I am getting on pretty well but I hit the Undef handler from time to
> time. Which in my case flashes a LED with a noticable pattern.
>
> What would be more useful is to know what code caused it so i though
> if I put the contents of the Link Regitser out on a serial port I
> already have then that would speed things up.
>
> Does anybody know how to get the contents of the Link Register into a
> 32 bit C Varible.
>
> Maybe I need a bit of inline assembeler ;)
>
> Thanks in advance.
>
>

Re: Outputing the Link Regisister

2006-04-08 by gert_vervoort

--- In lpc2000@yahoogroups.com, "fordp2002" <SimonEllwood@...> wrote:

> Does anybody know how to get the contents of the Link Register into a
> 32 bit C Varible.
> 
> Maybe I need a bit of inline assembeler ;)
> 


This should do the trick:


#include <stdio.h>

main()
{
        register unsigned int *lr_ptr asm("r14");

        printf("0x%X\n", lr_ptr);

        return 0;
}

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.