This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
Re: Question of ARM and thumb mode switch in vectors.S
- From: Gary Thomas <gary at mlbassoc dot com>
- To: Frank Wu <qiongwu23 at gmail dot com>
- Cc: ecos-discuss <ecos-discuss at ecos dot sourceware dot org>
- Date: Mon, 27 Nov 2006 16:50:59 -0700
- Subject: Re: [ECOS] Question of ARM and thumb mode switch in vectors.S
- References: <591a86200611271323v211756fdxd6b01d300e6cd0e@mail.gmail.com>
Frank Wu wrote:
I have a question about the mode switch macro, which I listed below,
in vectors.S.
What is ## mean in
ldr _r_,=_l_ ## f ?
Is f a constant or _f_? Thanks,
Frank
// Call thumb function from ARM mode, return to ARM
// mode afterwards
#define THUMB_CALL(_r_, _l_, _f_) \
ldr _r_,=_f_+1 ;\
mov lr,pc ;\
bx _r_ ;\
.pool ;\
.code 16 ;\
.thumb_func ;\
ldr _r_,=_l_ ## f ;\
bx _r_ ;\
.pool ;\
.code 32 ;\
_l_:
This is the standard C pre-processor concatenation operator.
Thus in a call like
THUMB_CALL(r1,10,func)
that line gets turned into
ldr r1,=10f
which corresponds to the local label 10 defined a few lines later.
--
------------------------------------------------------------
Gary Thomas | Consulting for the
MLB Associates | Embedded world
------------------------------------------------------------
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss