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.

[参考译文] 编译器/MSP430F5529:TI CC3100 Getting Started_With _WLAN_station 示例给出了链接器错误

Guru**** 2540720 points
Other Parts Discussed in Thread: CC3100, MSP430F5529, CC3100SDK

请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/586000/compiler-msp430f5529-ti-cc3100-getting_started_with_wlan_station-example-gives-linker-error

器件型号:MSP430F5529
Thread 中讨论的其他部件:CC3100CC3100SDK

工具/软件:TI C/C++编译器

我正在尝试使用 CC3100将通过 MSP430F5529端口上的 ADC 读取的一些传感器值发送到接入点。 我从 CC3100SDK_1.2.0中获取了 getting_started_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);
}

请建议我在中断初始化中缺少的内容、这似乎是问题所在。 或者我是否缺少其他东西?

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    Deepak、您好!

    该错误告诉您、您有一个中断矢量、该矢量在 main.c 和 board.c 中的2个位置定义 只需从 board.c 中的"catch all isr"中删除 ADC12_vector 即可、这样您就可以:

    /*捕获未初始化的中断矢量。 //
    #ifdef __ccs__
    #pragma vector=WDT_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);
    } 

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    您好、Cameron、

    非常感谢您的快速响应。 这对我来说很有用!

    此致、
    Deepak