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

标签 c msp430 texas-instruments code-composer

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

关于c - TI CC3100 getting_started_with_wlan_station 示例给出链接器错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43184857/

相关文章:

c - 原始 LWIP 将 TCP 传输发送到静态 IP

c结构问题

c - 从 DSP C6748 的 Matlab-Simulink 模型生成 C 代码

basic - 如何在 TI-Basic Editor 中在程序中间添加一行?

c - 谜题:谁赢得了比赛?

c - 使用 OpenSSL RSA_private_decrypt() 函数时出错

c - msp430g2452 无法从开关捕获中断

c - Timer a在msp430中高级编译优化模式下的使用

c - 调试器关闭后的 MSP430 中断问题

linux - 使用 TI sitara am335x devkit 编译器通过 Yocto 创建自定义 Linux 镜像