This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Compiler/MSP430F5329: IAR Embedded Workbench 7.10.3 Interrupt Vectors

Part Number: MSP430F5329


Tool/software: TI C/C++ Compiler

I am having problems with getting the USCI_B1 interrupt to fire.

So I decided to see if I could get anything to run

I made a file called interrupt.c and put code in there for each and every interrupt.  

When I compiled I got a link error. 

Building configuration: RycherI2C - Debug
Updating build tree...
interrupt.c
Linking
Error[e16]: Segment RESET (size: 0x2 align: 0x1) is too long for segment definition. At least 0x2 more bytes needed. The problem occurred while processing the segment placement command "-Z(CODE)RESET=FFFE-FFFF", where at the
moment of placement the available memory ranges were "-none-"
Reserved ranges relevant to this placement:
ff80-ffff INTVEC
Error while running Linker

Total number of errors: 1
Total number of warnings: 0

So after playing around a little I discovered the following interrupt caused the error. 

#pragma vector=RESET_VECTOR
__interrupt void Reset_interrupt(void)
{
/* Interrupt Code here */
interrupt_count++;
}

Looking at the MSP430F5329.h file it defines reset vector as 

#define RESET_VECTOR        (63u * 2u) /* 0xFFFE Reset [Highest Priority] */

So if I can not use the vector then why have it?

Also I can not tell from the documentation if the value for the

#pragma vector=126  
which is (63u * 2u) 

or #pragma vector= 65534
which is 0xFFFE

I think it should be 0xFFFE but I am using RESET_VECTOR which is 126.


#include <msp430.h>
#include <stdint.h>
#include <intrinsics.h>

#if 0
/* this is how the vectors are defined in the MSP430F5329.h file. */
/* I put them here so I could reference the names */
#define RTC_VECTOR          (41u * 2u) /* 0xFFD2 RTC */
#define PORT2_VECTOR        (42u * 2u) /* 0xFFD4 Port 2 */
#define TIMER2_A1_VECTOR    (43u * 2u) /* 0xFFD6 Timer2_A5 CC1-4, TA */
#define TIMER2_A0_VECTOR    (44u * 2u) /* 0xFFD8 Timer2_A5 CC0 */
#define USCI_B1_VECTOR      (45u * 2u) /* 0xFFDA USCI B1 Receive/Transmit */
#define USCI_A1_VECTOR      (46u * 2u) /* 0xFFDC USCI A1 Receive/Transmit */
#define PORT1_VECTOR        (47u * 2u) /* 0xFFDE Port 1 */
#define TIMER1_A1_VECTOR    (48u * 2u) /* 0xFFE0 Timer1_A3 CC1-2, TA1 */
#define TIMER1_A0_VECTOR    (49u * 2u) /* 0xFFE2 Timer1_A3 CC0 */
#define DMA_VECTOR          (50u * 2u) /* 0xFFE4 DMA */
#define LDO_PWR_VECTOR      (51u * 2u) /* 0xFFE6 LDO Power Management event */
#define TIMER0_A1_VECTOR    (52u * 2u) /* 0xFFE8 Timer0_A5 CC1-4, TA */
#define TIMER0_A0_VECTOR    (53u * 2u) /* 0xFFEA Timer0_A5 CC0 */
#define ADC12_VECTOR        (54u * 2u) /* 0xFFEC ADC */
#define USCI_B0_VECTOR      (55u * 2u) /* 0xFFEE USCI B0 Receive/Transmit */
#define USCI_A0_VECTOR      (56u * 2u) /* 0xFFF0 USCI A0 Receive/Transmit */
#define WDT_VECTOR          (57u * 2u) /* 0xFFF2 Watchdog Timer */
#define TIMER0_B1_VECTOR    (58u * 2u) /* 0xFFF4 Timer0_B7 CC1-6, TB */
#define TIMER0_B0_VECTOR    (59u * 2u) /* 0xFFF6 Timer0_B7 CC0 */
#define COMP_B_VECTOR       (60u * 2u) /* 0xFFF8 Comparator B */
#define UNMI_VECTOR         (61u * 2u) /* 0xFFFA User Non-maskable */
#define SYSNMI_VECTOR       (62u * 2u) /* 0xFFFC System Non-maskable */
#define RESET_VECTOR        (63u * 2u) /* 0xFFFE Reset [Highest Priority] */
#endif

extern volatile uint16_t interrupt_count;

#if 0
#pragma vector=RTC_VECTOR
__interrupt void RTC_interrupt(void)
{
/* Interrupt Code here */
  interrupt_count++;
}

#pragma vector=PORT2_VECTOR
__interrupt void Port_2_interrupt(void)
{
/* Interrupt Code here */
  interrupt_count++;
}

#pragma vector=TIMER2_A1_VECTOR
__interrupt void Timer2_A5_CC1_4_TA_interrupt(void)
{
/* Interrupt Code here */
  interrupt_count++;
}

#pragma vector=TIMER2_A0_VECTOR
__interrupt void Timer2_A5_CC0_interrupt(void)
{
/* Interrupt Code here */
  interrupt_count++;
}


 //Moved to usi_i2c.c
#pragma vector=USCI_B1_VECTOR
__interrupt void USCI_B1_Receive_Transmit_interrupt(void)
{
    interrupt_count++;
}


#pragma vector=USCI_A1_VECTOR
__interrupt void USCI_A1_Receive_Transmit_interrupt(void)
{
/* Interrupt Code here */
  interrupt_count++;
}

#pragma vector=PORT1_VECTOR
__interrupt void Port_1_interrupt(void)
{
/* Interrupt Code here */
  interrupt_count++;
}

#pragma vector=TIMER1_A1_VECTOR
__interrupt void Timer1_A3_CC1_2_TA1_interrupt(void)
{
/* Interrupt Code here */
  interrupt_count++;
}

#pragma vector=TIMER1_A0_VECTOR
__interrupt void Timer1_A3_CC0_interrupt(void)
{
/* Interrupt Code here */
  interrupt_count++;
}

#pragma vector=DMA_VECTOR
__interrupt void DMA_interrupt(void)
{
/* Interrupt Code here */
  interrupt_count++;
}

#pragma vector=LDO_PWR_VECTOR
__interrupt void LDO_Power_Management_event_interrupt(void)
{
/* Interrupt Code here */
  interrupt_count++;
}

#pragma vector=TIMER0_A1_VECTOR
__interrupt void Timer0_A5_CC1_4_TA_interrupt(void)
{
/* Interrupt Code here */
  interrupt_count++;
}

#pragma vector=TIMER0_A0_VECTOR
__interrupt void Timer0_A5_CC0_interrupt(void)
{
/* Interrupt Code here */
  interrupt_count++;
}

#pragma vector=ADC12_VECTOR
__interrupt void ADC_interrupt(void)
{
/* Interrupt Code here */
  interrupt_count++;
}

#pragma vector=USCI_B0_VECTOR
__interrupt void USCI_B0_Receive_Transmit_interrupt(void)
{
/* Interrupt Code here */
  interrupt_count++;
}

#pragma vector=USCI_A0_VECTOR
__interrupt void USCI_A0_Receive_Transmit_interrupt(void)
{
/* Interrupt Code here */
  interrupt_count++;
}

#pragma vector=WDT_VECTOR
__interrupt void Watchdog_Timer_interrupt(void)
{
/* Interrupt Code here */
  interrupt_count++;
}

#pragma vector=TIMER0_B1_VECTOR
__interrupt void Timer0_B7_CC1_6_TB_interrupt(void)
{
/* Interrupt Code here */
  interrupt_count++;
}

#pragma vector=TIMER0_B0_VECTOR
__interrupt void Timer0_B7_CC0_interrupt(void)
{
/* Interrupt Code here */
  interrupt_count++;
}

#if 1
#pragma vector=COMP_B_VECTOR
__interrupt void Comparator_B_interrupt(void)
{
/* Interrupt Code here */
  interrupt_count++;
}
#endif

#pragma vector=UNMI_VECTOR
__interrupt void User_Non_maskable_interrupt(void)
{
/* Interrupt Code here */
  interrupt_count++;
}

#pragma vector=SYSNMI_VECTOR
__interrupt void System_Non_maskable_interrupt(void)
{
/* Interrupt Code here */
  interrupt_count++;
}
#endif

#if 1
#pragma vector=RESET_VECTOR
__interrupt void Reset_interrupt(void)
{
/* Interrupt Code here */
  interrupt_count++;
}
#endif


  • I meant this to go into the general MSP430 forum. Not this forum and I can not seem to delete it or move it. Are you not supporting the IAR compiler? IAR says TI wrote all the .h files. But there is no forum for IAR issues.

  • Hi Kipton, 

    Kipton Moravec said:

    Also I can not tell from the documentation if the value for the

    #pragma vector=126  
    which is (63u * 2u) 

    or #pragma vector= 65534
    which is 0xFFFE

    I think it should be 0xFFFE but I am using RESET_VECTOR which is 126.

    Think of the reset interrupt vector as a pointer. The address of the reset interrupt vector is 0xFFFE and it points to address (63u *2u). When the MSP430 starts execution it uses the reset vector to know where to begin executing code. By default the initialization code is placed at (63u *2u). You're receiving an error because the reset vector is already populated with the value (63u *2u) and there is no more room to populate it with the location of your user defined ISR. You can manually change where the reset vector points but doing this will cause the MSP430 to start execution in the ISR you've defined without initializing the stack, PC, etc. For your application, I don't recommend changing where the reset vector points and leaving it to the compiler to appropriately populate this vector. 

    Best regards, 

    Caleb Overbay

**Attention** This is a public forum