Forums

MSP430, gcc -> IAR

Started by Baxter June 30, 2005
I'm an experienced C/C++ programmer, but very new to Embedded programming.

I've bought the TI Flash developers kits that include the IAR compiler.  I
have some existing msp430gcc code, but there are some differences -
particularly in how interrupts are declared.

The issues I need to resolve:
  1) some of my interrupt routines are declared as "wakeup".  It's unclear
to me how to handle these in IAR.
  2) the IAR compiler can't find the _reset_vector__().  do I replace it
with "RESET_VECTOR" ?

-- 
-------------------------------------------------------------------------
Free software  - Baxter Codeworks  www.baxcode.com
-------------------------------------------------------------------------



In article <11c8imklb8rccb2@corp.supernews.com>, 
lbax02.spamguard@baxcode.com says...
> I'm an experienced C/C++ programmer, but very new to Embedded programming. > > I've bought the TI Flash developers kits that include the IAR compiler. I > have some existing msp430gcc code, but there are some differences - > particularly in how interrupts are declared. > > The issues I need to resolve: > 1) some of my interrupt routines are declared as "wakeup". It's unclear > to me how to handle these in IAR. > 2) the IAR compiler can't find the _reset_vector__(). do I replace it > with "RESET_VECTOR" ? > >
1) In IAR, insert the following in your interrupt handler: _BIC_SR_IRQ(LPMx_bits); This manipulates the copy of SR pushed on the stack; otherwise the previous LPM state is restored when the interrupt returns. LPMx_bits is the LPM mode you want to be in afterwards (i.e. LPM0_bits puts you in LPM0 mode (full power). I think they've improved the syntax in newer versions. 2) Indeed, you must use RESET_VECTOR. Refer to the \430\inc directory. The vectors supported by a particular variant can be found at the END of the appropriate MSP430xxxx.h file. --Gene
Thanks, this is what I was looking for.

From the sound of things, on #1, it doesn't matter where in my interrupt
handler that I put the _BIC_SR_IRQ(LPMx_bits) macro. (I'll have to look up
and see what it does.)

-- 
-------------------------------------------------------------------------
Free software  - Baxter Codeworks  www.baxcode.com
-------------------------------------------------------------------------


"Gene S. Berkowitz" <first.last@comcast.net> wrote in message
news:MPG.1d2e88f6a414ed47989681@newsgroups.comcast.net...
> In article <11c8imklb8rccb2@corp.supernews.com>, > lbax02.spamguard@baxcode.com says... > > I'm an experienced C/C++ programmer, but very new to Embedded
programming.
> > > > I've bought the TI Flash developers kits that include the IAR compiler.
I
> > have some existing msp430gcc code, but there are some differences - > > particularly in how interrupts are declared. > > > > The issues I need to resolve: > > 1) some of my interrupt routines are declared as "wakeup". It's
unclear
> > to me how to handle these in IAR. > > 2) the IAR compiler can't find the _reset_vector__(). do I replace it > > with "RESET_VECTOR" ? > > > > > > 1) In IAR, insert the following in your interrupt handler: > > _BIC_SR_IRQ(LPMx_bits); > > This manipulates the copy of SR pushed on the stack; otherwise the > previous LPM state is restored when the interrupt returns. LPMx_bits > is the LPM mode you want to be in afterwards (i.e. LPM0_bits puts you in > LPM0 mode (full power). I think they've improved the syntax in newer > versions. > > 2) Indeed, you must use RESET_VECTOR. Refer to the \430\inc directory. > The vectors supported by a particular variant can be found at the END > of the appropriate MSP430xxxx.h file. > > --Gene
In article <11c9k0h3gaqri29@corp.supernews.com>, 
lbax02.spamguard@baxcode.com says...
> Thanks, this is what I was looking for. > > From the sound of things, on #1, it doesn't matter where in my interrupt > handler that I put the _BIC_SR_IRQ(LPMx_bits) macro. (I'll have to look up > and see what it does.) > >
No, it should not matter, as long as you're not attempting to otherwise manipulate the stack in the ISR. It's an intrinsic function unique to the compiler; I don't THINK you can see the source, although it's easy enough to view the resulting assembler output. --Gene
I looked at the .h files - it looks like there's several different levels.
My guess is that I want LPM4_bits for "wakeup" (ie. restore everything to
active status - there's also a "LPM4_EXIT").  There's nowhere in my code
that explicitly sets the chip into low-power mode (at least not that I can
tell).

-- 
-------------------------------------------------------------------------
Free software  - Baxter Codeworks  www.baxcode.com
-------------------------------------------------------------------------


"Gene S. Berkowitz" <first.last@comcast.net> wrote in message
news:MPG.1d3072899d1b896b989682@newsgroups.comcast.net...
> In article <11c9k0h3gaqri29@corp.supernews.com>, > lbax02.spamguard@baxcode.com says... > > Thanks, this is what I was looking for. > > > > From the sound of things, on #1, it doesn't matter where in my interrupt > > handler that I put the _BIC_SR_IRQ(LPMx_bits) macro. (I'll have to look
up
> > and see what it does.) > > > > > > No, it should not matter, as long as you're not attempting to otherwise > manipulate the stack in the ISR. It's an intrinsic function unique to > the compiler; I don't THINK you can see the source, although it's easy > enough to view the resulting assembler output. > > --Gene
In article <11cdd3ho44vr544@corp.supernews.com>, 
lbax02.spamguard@baxcode.com says...
> I looked at the .h files - it looks like there's several different levels. > My guess is that I want LPM4_bits for "wakeup" (ie. restore everything to > active status - there's also a "LPM4_EXIT"). There's nowhere in my code > that explicitly sets the chip into low-power mode (at least not that I can > tell).
No, you've got them backwards. Inserting LPM4_EXIT into your ISR will put you in the LOWEST power mode (CPU Off, Oscillator Off) when the ISR exits. If you never use low power mode, then you never need to use the LPMx_EXIT feature anyway. --Gene
Good to know. I'm operating kind of blind here - and, as I indicated, I'm
completely new to Embedded programming (at least of this kind.)

-- 
-------------------------------------------------------------------------
Free software  - Baxter Codeworks  www.baxcode.com
-------------------------------------------------------------------------


"Gene S. Berkowitz" <first.last@comcast.net> wrote in message
news:MPG.1d3122f6e6f1413a989683@newsgroups.comcast.net...
> In article <11cdd3ho44vr544@corp.supernews.com>, > lbax02.spamguard@baxcode.com says... > > I looked at the .h files - it looks like there's several different
levels.
> > My guess is that I want LPM4_bits for "wakeup" (ie. restore everything
to
> > active status - there's also a "LPM4_EXIT"). There's nowhere in my code > > that explicitly sets the chip into low-power mode (at least not that I
can
> > tell). > > No, you've got them backwards. Inserting LPM4_EXIT into your > ISR will put you in the LOWEST power mode (CPU Off, Oscillator Off) when > the ISR exits. > If you never use low power mode, then you never need to use the > LPMx_EXIT feature anyway. > > --Gene