EmbeddedRelated.com
Forums

IAR assembler question

Started by Jonathan Kirwan March 10, 2004
I'd like to develop a macro in IAR assembly which switches to a
different relocatable segment by "pushing" the current one,
switching to a specific named segment, assembling some code or
data, and then returning to the 'current' one, without knowing
it's name.  The macro should be usable from any module and
segment type, including absolute I suppose, and should be able
to change the segment for the purposes of the macro but not
change it in the source code after the place where it was
invoked.

I've played with the IAR assembler before, as a toy, but now I'm
working on a serious hobby project.

Suggested syntax?

Jon

P.S.  As a sidebar, which isn't important but about which I am
curious:  Do the other compiler toolsets use their own
assemblers?  And if so, how compatible are they and what are
their various tradeoffs?

Beginning Microcontrollers with the MSP430

Jonathan Kirwan wrote:

> I'd like to develop a macro in IAR assembly
which switches to a
> different relocatable segment by "pushing" the current one,
> switching to a specific named segment, assembling some code or
> data, and then returning to the 'current' one, without knowing
> it's name.  The macro should be usable from any module and
> segment type, including absolute I suppose, and should be able
> to change the segment for the purposes of the macro but not
> change it in the source code after the place where it was
> invoked.

heh, i never used macros in assembler, i rather use C ;-)

...

> P.S.  As a sidebar, which isn't important but
about which I am
> curious:  Do the other compiler toolsets use their own
> assemblers?  And if so, how compatible are they and what are
> their various tradeoffs?

the gnu assembler that comes with mspgcc uses the same memnonics and
syntax for arguments but has different control commands. it uses e.g.
".text" ".data" ".org" instead of "RSEG
CODE" "RSEG UDATA0" "ORG" etc.
more like the original TI assembler for the MSP430. i dont know about
the others.

chris



On Thu, 11 Mar 2004 01:18:10 +0100, you wrote:

>Jonathan Kirwan wrote:
>
>> I'd like to develop a macro in IAR assembly which switches to a
>> different relocatable segment by "pushing" the current one,
>> switching to a specific named segment, assembling some code or
>> data, and then returning to the 'current' one, without
knowing
>> it's name.  The macro should be usable from any module and
>> segment type, including absolute I suppose, and should be able
>> to change the segment for the purposes of the macro but not
>> change it in the source code after the place where it was
>> invoked.
>
>heh, i never used macros in assembler, i rather use C ;-)

I like C as much as the next person.  But it's not an option.
My question was very specific and not open to suggestions such
as "use C."  ;)

>...
>
>> P.S.  As a sidebar, which isn't important but about which I am
>> curious:  Do the other compiler toolsets use their own
>> assemblers?  And if so, how compatible are they and what are
>> their various tradeoffs?
>
>the gnu assembler that comes with mspgcc uses the same memnonics and
>syntax for arguments but has different control commands. it uses e.g.
>".text" ".data" ".org" instead of "RSEG
CODE" "RSEG UDATA0" "ORG" etc.
>more like the original TI assembler for the MSP430. i dont know about
>the others.

Thanks for trying to push me into C or gnu, but no thanks.  I am
already aware of and somewhat familiar with gas.  And it is, by
definition, "different."  The options for linking are wonderful,
but I'm not using that tool, either.  I'm using IAR assembler
for this project.  Period.  The side bar question is only out of
curiousity.  gas is not an option for use.

Jon