Linking errors with IAR

Joined
Feb 3, 2015
Messages
2
Reaction score
0
Hi,
I have a large embedded ARM program in C, run with IAR Workbench.
I modified one of the files by adding 3 power supply control I2C functions, all internal within the file.
While the file compiles clean and nice, when building the program I get linking errors for the 3 new functions.
To the best of my knowledge (forgot C for many years...), I did all that is needed: Added prototypes, and declared the variables.
Despite all, I get the following error messages: (removed part of the path)

In addition, there is a:" #if 0 " in the middle, which I can not figure out what it does, but removing it will cause file compilation errors.

Error messages:
Linking
Error[Li005]: no definition for "SetPowerRemoteOn" [referenced from C:\Users\..........\Debug\Obj\Tester.o]
Error[Li005]: no definition for "SetPowerSupplyVoltage" [referenced from C:\Users\.....\Debug\Obj\Tester.o]
Error[Li005]: no definition for" SetPowerSupplyPower" [referenced from C:\Users\.......\Debug\Obj\Tester.o]

Error while running Linker

Total number of errors:3
End of errors
=====================================================================


The code: (removed all comments)

Code:
#include "Tester.h"
#include <stdbool.h>
//vars
#define Tester_BUF_SIZE    8
#define POWER_SUPPLY_ADDRESS    0x54
uint8_t Tester_Buffer[Tester_BUF_SIZE];

//private prototypes
Status Tester_WriteBuff(uint8_t uiAddress, uint8_t *uiBuffer, uint8_t uiLength);
Status SetPowerRemoteOn(bool);
Status SetPowerSupplyVoltage(double);  //Defaults to 15 V (in header)
Status SetPowerSupplyPower(uint8_t);

uint8_t PS_Current_Set = 0;
double PS_Volts_Set = 15;
bool PS_State_Set = true;

uint8_t RxTester_Buffer[Tester_BUF_SIZE];

/**********************************************************************/

Status Tester_WriteBuff(uint8_t uiAddress, uint8_t *uiBuffer, uint8_t uiLength)
{
    Status statWrite =  SUCCESS  ;

    I2C_M_SETUP_Type TransferSetup;
    TransferSetup.sl_addr7bit = uiAddress;
    TransferSetup.tx_data = uiBuffer;
    TransferSetup.tx_length = (uint32_t)uiLength;

    TransferSetup.rx_data = RxTester_Buffer;
    TransferSetup.rx_length = uiLength;

    TransferSetup.rx_data = NULL;
    TransferSetup.rx_length = 0;

    TransferSetup.retransmissions_max = 3;

    statWrite = I2C_MasterTransferData(Tester_I2C_PORT, &TransferSetup, I2C_TRANSFER_POLLING);

    return statWrite ;
}

/*********************************************************************//**
Status Tester_Init(void)
{
    Status retval;

    if(!TF_BSP_Initialized) return 0;

    //load init register values into buffer
    Tester_Buffer[0] = Tester_OUT0; //reg start address
    Tester_Buffer[1] = 0x00; //preset A
    Tester_Buffer[2] = 0x00; //preset B
    retval = Tester_WriteBuff(Tester_I2C_ADDRESS, Tester_Buffer, 3);

    //load init register values into buffer
    Tester_Buffer[0] = Tester_CONFIG0; //reg start address
    Tester_Buffer[1] = 0x00; //dir A
    Tester_Buffer[2] = 0xFF; //dir B
    retval = Tester_WriteBuff(Tester_I2C_ADDRESS, Tester_Buffer, 3);

return retval;

}

/*********************************************************************/

Status Tester_Write(uint8_t powerValue)  //0-255, every PID interrupt
{
    Status retval;

    if(!TF_BSP_Initialized) return 0;

#ifdef NEW_POWER_SUPPLY

SetPowerRemoteOn(PS_State_Set);
SetPowerSupplyVoltage(PS_Volts_Set);  //Defaults to 15 V (in header)
SetPowerSupplyPower(PS_Current_Set);   //Setting the power current

retval = SUCCESS;

        Tester_Buffer[0] = Tester_OUT0; //reg start address
    Tester_Buffer[1] = (uint8_t) powerValue;
    Tester_Buffer[2] = 0x00;
    retval = Tester_WriteBuff(Tester_I2C_ADDRESS, Tester_Buffer, 3);

    return retval;
}
/**********************************************************************/
uint8_t Tester_Read(void)
{

  return Tester_Buffer[1];
}
#if 0

/**********************************************************************/

Status SetPowerSupplyVoltage(double PS_Volts_Set)
{
    Status retval;

    if(O_Tester_OVEN_ENABLE == ON)   /
        {
        Tester_Buffer[0] = 0x70; //voltage register start address
    Tester_Buffer[1] = (int)(PS_Volts_Set * 100) & 0xFF; //low byte
    Tester_Buffer[2] = (int)(PS_Volts_Set * 100) >> 8 ; //high byte
    retval = Tester_WriteBuff(POWER_SUPPLY_ADDRESS, Tester_Buffer, 3);

    //Activates the voltage settings while reassuring remote power is On
    Tester_Buffer[0] = 0x7C; //reg start address
    Tester_Buffer[1] = 0x85; //bits 2 must be on to activate the voltage settings
    retval = Tester_WriteBuff(POWER_SUPPLY_ADDRESS, Tester_Buffer, 2);
        }
      else SetPowerRemoteOn(false);

      return retval ;
}

Status SetPowerRemoteOn(int PS_State_Set)
{
    Status retval;

    if (PS_State_Set == true)
    {
         Tester_Buffer[0] = 0x7C; //reg start address
        Tester_Buffer[1] = 0x81; //Bit 7 1 = Remote 0 = Local
        retval = Tester_WriteBuff(POWER_SUPPLY_ADDRESS, Tester_Buffer, 2);
    }
    else
    {
        //Set Power to local and off - will disable the heater power supply
        Tester_Buffer[0] = 0x7C; //reg start address
        Tester_Buffer[1] = 0x00; //Bit 0 1 = Power On 0 = Power Off
        retval = Tester_WriteBuff(POWER_SUPPLY_ADDRESS, Tester_Buffer, 2);
    }
    return retval ;
}

Status SetPowerSupplyPower(bool PS_Current_Set)   //from PID,
{
  retval = SUCCESS ;
    double paramValue = PS_Current_Set * 100 / 255;
.
    int iValue = (int)(paramValue * 100) ;
    if (iValue > 10000)   iValue = 10000 ;

    if(O_Tester_OVEN_ENABLE == ON)
        {

        Tester_Buffer[0] = 0x72; //reg start address
    Tester_Buffer[1] = (iValue & 0xFF) ;
    Tester_Buffer[2] = ((iValue >> 8) & 0xFF) ;
    retval = Tester_WriteBuff(POWER_SUPPLY_ADDRESS, Tester_Buffer, 3);

    //Activates the current settings
    Tester_Buffer[0] = 0x7C; //reg start address
    Tester_Buffer[1] = 0x85; //bits 2 must be on to activate the voltage settings
    retval = Tester_WriteBuff(POWER_SUPPLY_ADDRESS, Tester_Buffer, 2);
    }
    else        {
        //Set Power to local and off - will disable the heater power supply
        Tester_Buffer[0] = 0x7C; //reg start address
        Tester_Buffer[1] = 0x00; //Bit 0 1 = Power On 0 = Power Off
        retval = Tester_WriteBuff(POWER_SUPPLY_ADDRESS, Tester_Buffer, 2);
    }

  return retval;
}
#endif


/*********************************************************************************
                           End Of File
*********************************************************************************/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,045
Latest member
DRCM

Latest Threads

Top