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.

linking error entry variable

Other Parts Discussed in Thread: MSP-EXP430FR5739, MSP430FR5739

I'm Juan Pedro, I work with msp-exp430fr5739 and cc3000, over IAR 6.20.

Now I have a linking error:  

Error[e27]: Entry "uart_have_cmd" in module dispatcher ( F:\Documents and Settings\Juan Pedro\Escritorio\16.04.2015\

I asked an entry, but that entry???

attached file dispatcher.c

#include "dispatcher.h"


#include <msp430fr5739.h>

///////////////////////////////////////////////////////////////////////////////////////////////////////////
//__no_init is used to prevent varible's initialize. ///
//for every IDE, exist different syntax: 1. __CCS__ for CCS v5 ///
// 2. __IAR_SYSTEMS_ICC__ for IAR Embedded Workbench ///
// *CCS does not initialize variables - therefore, __no_init is not needed. ///
///////////////////////////////////////////////////////////////////////////////////////////////////////////
#ifdef __CCS__

unsigned char g_ucUARTBuffer[UART_IF_BUFFER];
unsigned char g_ucLength;

#elif __IAR_SYSTEMS_ICC__

__no_init unsigned char g_ucUARTBuffer[UART_IF_BUFFER];
__no_init unsigned char g_ucLength;

#endif

extern int uart_have_cmd = 0;

//*****************************************************************************
//
//! UARTIntHandler
//!
//! \param buffer
//!
//! \return none
//!
//! \brief Handles RX and TX interrupts
//
//*****************************************************************************
#pragma vector=USCI_A0_VECTOR
__interrupt void USCI_A0_ISR(void)
{

switch(__even_in_range(UCA0IV,0x08))
{
case 0:break; // Vector 0 - no interrupt
case 2: // Vector 2 - RXIFG
g_ucUARTBuffer[g_ucLength] = UCA0RXBUF;
if (g_ucUARTBuffer[g_ucLength] == 0x0D)
{
g_ucLength = 0;
uart_have_cmd = 1;
__bic_SR_register_on_exit(LPM3_bits);
__no_operation();
}
else
{
g_ucLength ++;
}
break;
case 4:break; // Vector 4 - TXIFG
default: break;
}
}


//*****************************************************************************
//
//! DispatcherUartSendPacket
//!
//! \param inBuff pointer to the UART input buffer
//! \param usLength buffer length
//!
//! \return none
//!
//! \brief The function sends to UART a buffer of given length
//
//*****************************************************************************
void
DispatcherUartSendPacket(unsigned char *inBuff, unsigned short usLength)
{
while (usLength)
{
while (!(UCA0IFG&UCTXIFG));
UCA0TXBUF = *inBuff;
usLength--;
inBuff++;
}
}

thanks for your time

JP

  • The word "Entry" does not have much of a meaning here.

    Show the complete error message.

    But I guess that you never define that variable. ("extern" tells the compiler that it's defined in some other source file.)

  • Hi Clemens and rest de world too

    This is the complete error:

    Building configuration: cachivache - Debug
    Updating build tree...
    dispatcher.c
    Linking
    Error[e27]: Entry "uart_have_cmd" in module dispatcher ( F:\Documents and Settings\Juan Pedro\Escritorio\16.04.2015\
    Debug\Obj\dispatcher.r43 ) redefined in module main ( F:\Documents and Settings\Juan Pedro\Escritorio\16.04.2015\
    Debug\Obj\main.r43 )
    Error while running Linker

    Total number of errors: 1
    Total number of warnings: 0

    The file module dispatcher, I already send it, into is define the variable. also the variable is define in the main and due are int , no extern., but the are'nt the problems. I modifique the variable to extern int  and the result is the same.

    Into the dispatcher only is here:

    define the variable:

    int uart_have_cmd = 0;

    subrutine:

    //*****************************************************************************
    //
    //! UARTIntHandler
    //!
    //! \param buffer
    //!
    //! \return none
    //!
    //! \brief Handles RX and TX interrupts
    //
    //*****************************************************************************
    #pragma vector=USCI_A0_VECTOR
    __interrupt void USCI_A0_ISR(void)
    {

    switch(__even_in_range(UCA0IV,0x08))
    {
    case 0:break; // Vector 0 - no interrupt
    case 2: // Vector 2 - RXIFG
    g_ucUARTBuffer[g_ucLength] = UCA0RXBUF;
    if (g_ucUARTBuffer[g_ucLength] == 0x0D)
    {
    g_ucLength = 0;
    uart_have_cmd = 1;

    into de main:

    define the variable:

    int uart_have_cmd=0;

    into de process, 2 times:

    if (uart_have_cmd)
    {
    //poner timer x si n hay dats para recibir
    //Process the cmd in RX buffer
    DemoHandleUartCommand(g_ucUARTBuffer);
    uart_have_cmd = 0;
    memset(g_ucUARTBuffer, 0xFF, UART_IF_BUFFER);

    }

    I don't understand, ever have valuer,

    th for your time.

    JP

  • How you use this variable does not matter.

    Show all places where you declare or define it.

  • user3889415 said:
    Error[e27]: Entry "uart_have_cmd" in module dispatcher ( F:\Documents and Settings\Juan Pedro\Escritorio\16.04.2015\
    Debug\Obj\dispatcher.r43 ) redefined in module main ( F:\Documents and Settings\Juan Pedro\Escritorio\16.04.2015\

    It’s declared in ‘dispatcher’ and in ‘main’, also visual in the code.

    At one place (source file) you should prefix ‘int uart_have_cmd = 0’ with ‘extern’ to ‘extern int uart_have_cmd’ without ‘= 0’.

  • Hi all

    I solved the error. I was mixing variables, in summary :

    It define only once in the file.c and the others files is included in the files.h as extern.

    Simple but I was wrong

    thank you all. for your time

    JP

  • "It define only once in the file.c and the others files is included in the files.h as extern."

    The problem wasn't where you declared and defined it, but how:

    "extern int uart_have_cmd = 0;"

    this is wrong. I wonder why the compiler hasn't thrown an error here. Maybe it tried to be smart - and this caused a linking error later. Didn't you get at least a warning like '"extern keyword ignored"?
    'extern' means 'somewhere else this is defined'. But "=0' means 'I define it here'.
    You can't declare a variable as extern and at the same time initialize (define) it.

**Attention** This is a public forum