Yahoo Groups archive

Lpc2000

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

Message

Re: [lpc2000] Re: LPC2138FBD64 - not possible to run from Flash and use IAP?

2005-10-29 by Karl Olsen

---- Original Message ----
From: "Guillermo Prandi" <yahoo.messenger@...>
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

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.