MSP430, gcc -> IAR

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
 Click to see the full signature
Reply to
Baxter
Loading thread data ...

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

Reply to
Gene S. Berkowitz

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
 Click to see the full signature
Reply to
Baxter

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

Reply to
Gene S. Berkowitz

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
 Click to see the full signature
Reply to
Baxter

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

Reply to
Gene S. Berkowitz

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
 Click to see the full signature
Reply to
Baxter

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.