TI CC3100 getting_started_with_wlan_station 示例给出链接器错误

TI CC3100 getting_started_with_wlan_station example gives linker error

我正在尝试使用 CC3100 将通过 MSP430F5529 端口上的 ADC 读取的一些传感器值发送到接入点。 我从 CC3100SDK_1.2.0 中获取了 getting_started_with_wlan_station 示例,并添加了 slac300i.

中的 MSP430F55xx_adc_01.c 代码

它是这样的: 此函数配置 ADC

static void read_adc(void){
    ADC12CTL0 = ADC12SHT02 + ADC12ON;         // Sampling time, ADC12 on
    ADC12CTL1 = ADC12SHP;                     // Use sampling timer
    ADC12IE = 0x01;                           // Enable interrupt
    ADC12CTL0 |= ADC12ENC;
    P6SEL |= 0x01;                            // P6.0 ADC option select
    P1DIR |= 0x01;                            // P1.0 output
}

主要功能有

read_adc();
while(1){
    /* Read ADC values*/
    ADC12CTL0 |= ADC12SC;                   // Start sampling/conversion
    adc_values = ADC12MEM0 & 0x0FFF; // keep only low 12 bits
    CLI_Write((_u8 *) adc_values);
    CLI_Write((_u8 *)"\n");
    __bis_SR_register(LPM0_bits + GIE);     // LPM0, ADC12_ISR will force exit
    __no_operation();                       // For debugger
}

在构建项目时,出现链接器错误

<Linking>
error #10056: symbol "__TI_int54" redefined: first defined in "./main.obj"; redefined in "./board/board.obj"
error #10010: errors encountered during linking; "getting_started_with_wlan_station.out" not built

>> Compilation failure
makefile:165: recipe for target 'getting_started_with_wlan_station.out' failed
gmake: *** [getting_started_with_wlan_station.out] Error 1
gmake: Target 'all' not remade because of errors.

出现此错误是因为在代码中添加了以下部分,该部分也取自slac300i

#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector = ADC12_VECTOR
__interrupt void ADC12_ISR(void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(ADC12_VECTOR))) ADC12_ISR (void)
#else
#error Compiler not supported!
#endif
{
    switch(__even_in_range(ADC12IV,34))
    {
    case  0: break;                           // Vector  0:  No interrupt
    case  2: break;                           // Vector  2:  ADC overflow
    case  4: break;                           // Vector  4:  ADC timing overflow
    case  6:                                  // Vector  6:  ADC12IFG0
        if (ADC12MEM0 >= 0x7ff)                 // ADC12MEM = A0 > 0.5AVcc?
            P1OUT |= BIT0;                        // P1.0 = 1
        else
            P1OUT &= ~BIT0;                       // P1.0 = 0

        __bic_SR_register_on_exit(LPM0_bits);   // Exit active CPU
    case  8: break;                           // Vector  8:  ADC12IFG1
    case 10: break;                           // Vector 10:  ADC12IFG2
    case 12: break;                           // Vector 12:  ADC12IFG3
    case 14: break;                           // Vector 14:  ADC12IFG4
    case 16: break;                           // Vector 16:  ADC12IFG5
    case 18: break;                           // Vector 18:  ADC12IFG6
    case 20: break;                           // Vector 20:  ADC12IFG7
    case 22: break;                           // Vector 22:  ADC12IFG8
    case 24: break;                           // Vector 24:  ADC12IFG9
    case 26: break;                           // Vector 26:  ADC12IFG10
    case 28: break;                           // Vector 28:  ADC12IFG11
    case 30: break;                           // Vector 30:  ADC12IFG12
    case 32: break;                           // Vector 32:  ADC12IFG13
    case 34: break;                           // Vector 34:  ADC12IFG14
    default: break;
    }
}

但是,如果我将其注释掉,调试器会卡在 board.c 文件的以下部分的无限循环中,出现在项目中

/* Catch interrupt vectors that are not initialized. */
#ifdef __CCS__
#pragma vector=WDT_VECTOR, ADC12_VECTOR, USCI_B1_VECTOR, \
    TIMER1_A1_VECTOR, TIMER0_A1_VECTOR, \
    TIMER2_A1_VECTOR, COMP_B_VECTOR, USB_UBM_VECTOR, UNMI_VECTOR,DMA_VECTOR, \
    TIMER0_B0_VECTOR, TIMER0_B1_VECTOR,SYSNMI_VECTOR, USCI_B0_VECTOR, RTC_VECTOR
__interrupt void Trap_ISR(void)
{
    while(1);
}

请指点我在中断的初始化中缺少什么,这似乎是问题所在。还是我漏掉了什么?

__TI_int54是存储ADC12中断处理程序地址的内存字

您正在尝试为同一个中断定义两个中断处理程序,ADC12_ISR()Trap_ISR()。后者仅用于捕获不存在实际处理程序的中断,因此您必须从其列表中删除 ADC12_VECTOR