EmbeddedRelated.com
Forums

Segment Control Directives of ISRs using IAR

Started by "Henderson, Jennifer" April 19, 2007
I'm working on a program with the MSP430F417 using IAR. The program has
two ISR's - one for a software defined UART using TimerA and the other a
RTC using the BT. For both of these programs I used the sample code
provided by TI to get me going and they both work fine - individually.
The problem I'm having is when you combine the two programs I get a
linker error saying " Error[e124]: Segment conflict for segment INTVEC.
In module "RTC_BT" there is a segment part that is of type RELOCATABLE,
while in module "msp430_uart" there is a segment part that is of type
COMMON". This is easy enough to 'fix' by just changing the REG to
COMMON in the RTC assembly code.

What I was hoping is that someone could explain to me why you would put
INTVEC into RSEG in the first place. (I have a ticket with TI about
this since they wrote the code, but I'm not getting any response).
Having to change TI's 'golden' code in this manner signifies to me that
I don't understand it well enough and I'll probably get bit later due to
my ignorance. Thus, I'm looking for some clarification on this.

In the IAR Assembler Guide (pg 47 - 50) is suggests that COMMON be used
for ISRs. I didn't find anything else in IAR's reference guides
(Compiler, IDE, and Assembly guides) that shed any more light on this.
I haven't found google to be much help here either... If there is any
other documentation I could be pointed to, that would be greatly
appreciated.

As for the code specifics:

The code for the UART is in C and the compiler puts the ISR directly
into COMMON (as I would expect).

The code for the RTC is in assembly and expressly calls to put the ISR
in RESEG.
(code exerpt taken from TI's slaa290 RTC_BT.s43 - note this was written
for the 1xx not the 4xx, though I couldn't see any reason why it
wouldn't work for the 4xx, so I'm using it)
;-----------------------------------
------
; Interrupt Vectors Used MSP430x13x/14x/15x/16x
;-----------------------------------
------
RSEG INTVEC
ORG BASICTIMER_VECTOR ; BT Vector
DW BT_ISR ;
END

Thanks!

Jen

Beginning Microcontrollers with the MSP430

Hi Jennifer!

The trouble is that you can do the layout of the interrupt vector in
many different ways. Typically, as long as you stick to either RSEG:s or
entries in a COMMON block it will work.

In your case you're mixin two models, which is why it fails. So, maybe
the important question is "Which technique should you use?"

Well, since you're using the IAR tools, and the C compiler can generate
entries in the interrupt vector table, it's best to be compatible with
that model, which is the COMMON segment model. (You can verify this by
studying the compiler assembler output.)

The TI examples do a great job exemplifying processor-related issues.
However, you should not use them as the definitive reference when it
comes to compiler runtime-model related issues...

-- Anders Lindgren, IAR Systems, Author of the MSP430 Compiler
> I'm working on a program with the MSP430F417 using IAR. The program has
> two ISR's - one for a software defined UART using TimerA and the other a
> RTC using the BT. For both of these programs I used the sample code
> provided by TI to get me going and they both work fine - individually.
> The problem I'm having is when you combine the two programs I get a
> linker error saying " Error[e124]: Segment conflict for segment INTVEC.
> In module "RTC_BT" there is a segment part that is of type RELOCATABLE,
> while in module "msp430_uart" there is a segment part that is of type
> COMMON". This is easy enough to 'fix' by just changing the REG to
> COMMON in the RTC assembly code.
>
> What I was hoping is that someone could explain to me why you would put
> INTVEC into RSEG in the first place. (I have a ticket with TI about
> this since they wrote the code, but I'm not getting any response).
> Having to change TI's 'golden' code in this manner signifies to me that
> I don't understand it well enough and I'll probably get bit later due to
> my ignorance. Thus, I'm looking for some clarification on this.
>
> In the IAR Assembler Guide (pg 47 - 50) is suggests that COMMON be used
> for ISRs. I didn't find anything else in IAR's reference guides
> (Compiler, IDE, and Assembly guides) that shed any more light on this.
> I haven't found google to be much help here either... If there is any
> other documentation I could be pointed to, that would be greatly
> appreciated.
>
> As for the code specifics:
>
> The code for the UART is in C and the compiler puts the ISR directly
> into COMMON (as I would expect).
>
> The code for the RTC is in assembly and expressly calls to put the ISR
> in RESEG.
> (code exerpt taken from TI's slaa290 RTC_BT.s43 - note this was written
> for the 1xx not the 4xx, though I couldn't see any reason why it
> wouldn't work for the 4xx, so I'm using it)
> ;----------------------
> ------
> ; Interrupt Vectors Used MSP430x13x/14x/15x/16x
> ;----------------------
> ------
> RSEG INTVEC
> ORG BASICTIMER_VECTOR ; BT Vector
> DW BT_ISR ;
> END

--
Disclaimer: Opinions expressed in this posting are strictly my own and
not necessarily those of my employer.