I thought that using the msb to switch between ARM/Thumb was common
to BL and BX. Now I see it's not. Thanks a lot, Karl, because I was
about to run into that very pit myself!
Guille
--- In lpc2000@yahoogroups.com, "Karl Olsen" <kro@p...> wrote:
>
> ---- Original Message ----
> From: "Guillermo Prandi" <yahoo.messenger@m...>
> To: <lpc2000@yahoogroups.com>
> Sent: Saturday, October 29, 2005 2:22 AM
> Subject: [lpc2000] Re: LPC2138FBD64 - not possible to run from Flash
> and use IAP?
>
> > Karl, I'm an LPC newbie so please excuse my silly question but,
why
> > not just...?
> >
> > void (*CallIAP)(unsigned int *cmd, unsigned int *resp) =
0x7ffffff1;
> >
> > void My Func()
> > {
> > .
> > .
> > CallIAP(cmd, resp);
> > .
> > .
> > }
> >
> > What does the assembler routine you wrote do different from this?
>
> The above works when you have enabled interworking. I think that
Keil
> always uses interworking. GCC only uses it when you enable it
> by -mthumb-interwork.
>
> With interworking, the compiler always uses the mode-switching BX
> instruction for returns and indirect calls. (For direct calls it
uses a
> normal BL, and when the caller and callee are different mode, the
linker
> then inserts a small piece of code between them that switches
mode). Using
> BX for returning often produces less efficient code.
>
> Using the CallIAP assembler routine means that you can avoid
> -mthumb-interwork, and only use BX in the single place it is
needed, i.e.
> when calling the IAP entry point (assuming that the whole program
is in ARM
> mode).
>
> Karl Olsen
>Message
Re: LPC2138FBD64 - not possible to run from Flash and use IAP?
2005-10-29 by Guillermo Prandi
Attachments
- No local attachments were found for this message.