TI CC3100 getting_started_with_wlan_station示例提供链接器错误

时间:2017-04-03 12:36:10

标签: c msp430 texas-instruments code-composer

我正在尝试使用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);
}

请建议我在中断初始化时遗漏的内容,这似乎是问题所在。或者我错过了其他什么?

1 个答案:

答案 0 :(得分:0)

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

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