I just started using Code Composer Studio V4, and ran into difficulties trying to define an interrupt handler. I'm using an MSP430F1611, and the MSP430x16x.h file defines a macro called ISR_VECTOR(func,offset). It looks like I should just be able to put
interrupt void my_isr(void);
ISR_VECTOR(my_isr,PORT1_VECTOR)
in my code and then define the function, and it should work. It doesn't. I tracked it down, and it turns out there are two problems in the header file. First, the ISR_VECTOR macro relies on other macros, which rely on others, and so on. Unfortunately, the rules for when macros are expanded are a bit tricky, and they don't get expanded properly here. So I expanded this manually, and got:
interrupt void my_isr(void);
void (* const my_isr_ptr)(void) =
&my_isr;
#pragma DATA_SECTION(my_isr_ptr,PORT1_VECTOR)
This solves the replacement problem, but unfortunately it still doesn't work right. It turns out that PORT1_VECTOR is defined as ".int4", whereas the section defined in lnk_msp_430f1611.cmd is defined as ".int04". Rewriting the last line to
#pragma DATA_SECTION(my_isr_ptr,".int04")
solved this problem, and then I was off and running. I hope others with these issues will find this helpful.