Yahoo Groups archive

Lpc2000

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

Message

Re: [lpc2000] Re: How to declare RAM functions in GCC

2005-01-17 by Richard

C syntax portion is easy:

void (*func)(void) = (void (*)())0x40000000;

(*func)();

At 04:17 PM 1/16/2005, sig5534 wrote:



> > 1) Try turning off the MAM to eliminate
> > this from the set of variable.
>
>Already using MAM_OFF.
>
> > 2) Are you using Thumb code? If so, perhaps the .data assignment is
> > throwing away the thumb attributes.
>
>Nope, 32b code.
>
> > 3) A Prefetch Abort means that there is no memory available at the
> > address you specify (like a data abort, but for instructions).
> >
> > The code
> >
> >     LDR  PC,[R5,#0]
> >
> > should be loading the pointer from this address
> > (ie. R5 + #0 should be a 32-bit value that is the pointer
> > to the code).
> >
> > Check that the address actually contains the **pointer**
> > to the code you want to execute and not the actual code itself.
>
>Now we're getting somewhere.  I think this is the problem.  I want it
>to jump to and execute at the 0x4000000 adr.  There is no pointer
>there.
>
> > Perhaps try
> >
> > static const (*fnptr)(void) = IAP_Test;
> >  ...
> >  *fnptr();
>
>That gives a compiler error:
>
>main.c:107: error: invalid type argument of `unary *'
>D:\GNUARM\bin\make: *** [main.o] Error 1
>
> > which should put the pointer in the literal pool and generate
> > different code.
>
>Yeh I think this is on the right track.  I need to get my C syntax
>correct here to generate a long jump directly rather than loading a
>pointer.  The function is at 0x40000000 not a pointer to it.
>
>If you have any other ideas for this, please pass them on.  Meanwhile
>I check my C books to try to figure out the needed syntax.
>
>Chris.
>
>
>
>
>
>
>Yahoo! Groups Links
>
>
>
>

// richard (This email is for mailing lists. To reach me directly, please 
use richard at imagecraft.com)

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.