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.

编译遇到#10010错误



在跑一个ti工程师给的pwm的程序。新建一个rtos的empty工程,导入后遇到以下错误。

Description Resource Path Location Type
#10010 errors encountered during linking; "12345.out" not built 12345 C/C++ Problem
<a href="file:/c:/ti/ccsv6/tools/compiler/dmed/HTML/10234.html">#10234-D</a> unresolved symbols remain 12345 C/C++ Problem
unresolved symbol heartBeatFxn, first referenced in C:\workspace_v6_1\12345\Debug\configPkg\package\cfg\main_pem3.oem3 12345 C/C++ Problem
unresolved symbol PWM_open, first referenced in ./main.obj 12345 C/C++ Problem
unresolved symbol PWM_Params_init, first referenced in ./main.obj 12345 C/C++ Problem
unresolved symbol PWM_setDuty, first referenced in ./main.obj 12345 C/C++ Problem
unresolved symbol PWM_start, first referenced in ./main.obj 12345 C/C++ Problem
#10229-D output section ".data" refers to load symbol "heartBeatFxn" and hence cannot be compressed; compression "rle" is ignored 12345 C/C++ Problem

  • 工程设置的问题,缺少头文件或者源码(库)。因为没有找到定义那几个PWM_xxxx变量的头文件。你找找

  • 如果你是刚开始使用TI的MCU,建议你不要自己新建项目,会有很多设置需要配置。 简单的方式是打开任何一个已经有的历程,把原来的主程序换成你自己要试的代码。这样不容易出现各种配置问题。

  • 我把pwm的fxn部分插入sensortag中Hum中的fxn中,出现#10010错误。

    #include "gatt.h"
    #include "gattservapp.h"
    #include "Board.h"
    #include "string.h"
    
    #include "humidityservice.h"
    #include "SensorTag_Hum.h"
    #include "sensor_hdc1000.h"
    #include "sensortag.h"
    #include "sensor.h"
    
    #include <ti/sysbios/knl/Semaphore.h>
    #include <ti/sysbios/knl/Task.h>
    
    //20160106
    
    #include <ti/sysbios/knl/Clock.h>
    
    #include <xdc/runtime/Log.h>
    
    #include <ti/drivers/PIN.h>
    #include <ti/drivers/PWM2.h>
    
    #include <ti/drivers/Board1.h>
    
    
    
    PWM_Handle hPWM0, hPWM1;
    
    #define PERIOD_US 1000
    
    /* e^sin(x) lookup table, 8 bits */
    const uint8_t sine_lut[] =
    {
    96, 99, 102, 105, 108, 111, 114, 117, 120, 125, 128, 131, 135, 138, 141, 145,
    147, 151, 154, 158, 161, 165, 167, 171, 175, 178, 181, 184, 188, 191, 193, 197,
    200, 203, 206, 208, 211, 214, 217, 220, 223, 224, 227, 230, 231, 234, 236, 237,
    241, 242, 244, 245, 247, 248, 248, 250, 251, 251, 253, 253, 253, 255, 255, 255,
    255, 255, 255, 255, 253, 253, 251, 251, 250, 250, 248, 247, 245, 244, 242, 241,
    239, 237, 234, 233, 230, 228, 226, 224, 221, 218, 215, 213, 210, 207, 204, 201,
    199, 196, 192, 189, 185, 183, 179, 176, 172, 170, 166, 163, 159, 156, 153, 149,
    146, 142, 139, 136, 132, 129, 126, 123, 119, 116, 113, 110, 106, 103, 100, 97,
    94, 91, 89, 86, 82, 80, 77, 74, 72, 69, 66, 64, 61, 59, 57, 54, 52, 49, 47, 46,
    43, 41, 39, 37, 35, 34, 32, 30, 28, 27, 25, 23, 22, 21, 19, 18, 17, 15, 14, 13,
    12, 11, 10, 9, 8, 7, 6, 5, 5, 4, 4, 3, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 4, 4, 5, 6, 7, 7, 8, 9, 10, 12, 12, 14, 15, 16,
    17, 19, 20, 21, 23, 24, 26, 27, 29, 31, 32, 35, 36, 38, 40, 42, 44, 46, 49, 51,
    53, 55, 57, 60, 62, 65, 67, 70, 73, 76, 79, 81, 84, 87, 90, 92, 96
    };
    
    #define SINELUT_SIZE sizeof(sine_lut) / sizeof(sine_lut[0])
    #define SINELUT_MAX  0xFF
    //20160106
    
    /*********************************************************************
     * MACROS
     */
    
    /*********************************************************************
     * CONSTANTS
     */
    
    // How often to perform sensor reads (milliseconds)
    #define SENSOR_DEFAULT_PERIOD   1000
    
    // Time start measurement and data ready
    #define HUM_DELAY_PERIOD          15
    
    // Length of the data for this sensor
    #define SENSOR_DATA_LEN         HUMIDITY_DATA_LEN
    
    // Task configuration
    #define SENSOR_TASK_PRIORITY    1
    #define SENSOR_TASK_STACK_SIZE  600
    
    /*********************************************************************
     * TYPEDEFS
     */
    
    /*********************************************************************
     * GLOBAL VARIABLES
     */
    
    /*********************************************************************
     * EXTERNAL VARIABLES
     */
    
    /*********************************************************************
     * EXTERNAL FUNCTIONS
     */
    
    /*********************************************************************
     * LOCAL VARIABLES
     */
    
    // Entity ID globally used to check for source and/or destination of messages
    static ICall_EntityID sensorSelfEntity;
    
    // Semaphore globally used to post events to the application thread
    static ICall_Semaphore sensorSem;
    
    // Task setup
    static Task_Struct sensorTask;
    static Char sensorTaskStack[SENSOR_TASK_STACK_SIZE];
    
    // Parameters
    static uint8_t sensorConfig;
    static uint16_t sensorPeriod;
    
    /*********************************************************************
     * LOCAL FUNCTIONS
     */
    static void sensorTaskFxn(UArg a0, UArg a1);
    static void sensorConfigChangeCB( uint8_t paramID);
    static void initCharacteristicValue( uint8_t paramID, uint8_t value,
                                        uint8_t paramLen);
    
    /*********************************************************************
     * PROFILE CALLBACKS
     */
    static sensorCBs_t sensorCallbacks =
    {
      sensorConfigChangeCB,  // Characteristic value change callback
    };
    
    
    /*********************************************************************
     * PUBLIC FUNCTIONS
     */
    /*********************************************************************
     * @fn      SensorTagHum_createTask
     *
     * @brief   Task creation function for the SensorTag
     *
     * @param   none
     *
     * @return  none
     */
    void SensorTagHum_createTask(void)
    {
      Task_Params taskParames;
    
      // Create the task for the state machine
      Task_Params_init(&taskParames);
      taskParames.stack = sensorTaskStack;
      taskParames.stackSize = SENSOR_TASK_STACK_SIZE;
      taskParames.priority = SENSOR_TASK_PRIORITY;
    
      Task_construct(&sensorTask, sensorTaskFxn, &taskParames, NULL);
    }
    
    /*********************************************************************
     * @fn      SensorTagHum_processCharChangeEvt
     *
     * @brief   SensorTag Humidity event handling
     *
     */
    void SensorTagHum_processCharChangeEvt(uint8_t paramID)
    {
      uint8_t newValue;
    
      switch (paramID)
      {
      case  SENSOR_CONF:
        if ((sensorTestResult() & ST_HUMIDITY) == 0 )
        {
          sensorConfig = ST_CFG_ERROR;
        }
    
        if (sensorConfig != ST_CFG_ERROR)
        {
          Humidity_getParameter( SENSOR_CONF, &newValue);
    
          if (newValue == ST_CFG_SENSOR_DISABLE)
          {
            // Reset characteristics
            initCharacteristicValue(SENSOR_DATA, 0, SENSOR_DATA_LEN);
    
            // Deactivate task
            Task_setPri(Task_handle(&sensorTask), -1);
          }
          else
          {
            // Activate task
            Task_setPri(Task_handle(&sensorTask), SENSOR_TASK_PRIORITY);
          }
    
          sensorConfig = newValue;
        }
        else
        {
          // Make sure the previous characteristics value is restored
          initCharacteristicValue(SENSOR_CONF, sensorConfig, sizeof ( uint8_t ));
        }
        break;
    
      case SENSOR_PERI:
        Humidity_getParameter( SENSOR_PERI, &newValue);
        sensorPeriod = newValue * SENSOR_PERIOD_RESOLUTION;
        break;
    
      default:
        // Should not get here
        break;
      }
    }
    
    /*********************************************************************
     * @fn      SensorTagHum_reset
     *
     * @brief   Reset characteristics
     *
     * @param   none
     *
     * @return  none
     */
    void SensorTagHum_reset (void)
    {
      sensorConfig = ST_CFG_SENSOR_DISABLE;
      initCharacteristicValue(SENSOR_DATA, 0, SENSOR_DATA_LEN);
      initCharacteristicValue(SENSOR_CONF, ST_CFG_SENSOR_DISABLE, sizeof(uint8_t));
    }
    
    /*********************************************************************
    * Private functions
    */
    
    /*********************************************************************
     * @fn      sensorTaskInit
     *
     * @brief   Initialization function for the SensorTag humidity sensor
     *
     */
    static void sensorTaskInit(void)
    {
      // Register task with BLE stack
      ICall_registerApp(&sensorSelfEntity, &sensorSem);
    
      // Add service
      Humidity_addService();
    
      // Register callbacks with profile
      Humidity_registerAppCBs(&sensorCallbacks);
    
      // Initialize the module state variables
      sensorPeriod = SENSOR_DEFAULT_PERIOD;
      SensorTagHum_reset();
      initCharacteristicValue(SENSOR_PERI, SENSOR_DEFAULT_PERIOD
                              / SENSOR_PERIOD_RESOLUTION, sizeof ( uint8_t ));
    
      // Initialize the driver
      sensorHdc1000Init();
    }
    
    /*********************************************************************
     * @fn      sensorTaskFxn
     *
     * @brief   The task loop of the humidity readout task
     *
     * @return  none
     */
    static void sensorTaskFxn(UArg a0, UArg a1)
    {
    
    
    	  PWM_Params pwmParams;
    	  PWM_Params_init(&pwmParams);
    	  pwmParams.idleLevel  = PWM_IDLE_LOW;
    
    	  /* PWM in US with fractional duty cycle */
    
    	  pwmParams.periodUnit  = PWM_PERIOD_US;
    	  pwmParams.periodValue = PERIOD_US;
    	  pwmParams.dutyUnit    = PWM_DUTY_FRACTION;
    	  pwmParams.dutyValue   = 0;
    
    	  /* PWM open  will set  pin to idle level  */
    	  hPWM0 = PWM_open(CC2650_PWM0, &pwmParams);
    	  hPWM1 = PWM_open(CC2650_PWM1, &pwmParams);
    
    	  if(hPWM0 == NULL || hPWM1 == NULL) {
    	    Log_error0("Opening PWM failed");
    	    while(1);
    	  }
    
    	  PWM_start(hPWM0);
    	  PWM_start(hPWM1);
    
    	  uint16_t index0 = 0;
    	  uint16_t index1 = SINELUT_MAX/2;
    
    	  uint32_t dutyValue0, dutyValue1;
    
    
    
    
      typedef union {
        struct {
          uint16_t rawTemp, rawHum;
        } v;
        uint8_t a[2];
      } Data_t;
    
      // Initialize the task
      sensorTaskInit();
    
      // Deactivate task (active only when measurement is enabled)
      Task_setPri(Task_handle(&sensorTask), -1);
    
      // Task loop
      while (true)
      {
    	  //20160107
    	    /* Sleep 10x PWM periods */
    	    Task_sleep(10 * PERIOD_US / Clock_tickPeriod);
    
    	    /* New duty cycle value */
    	    dutyValue0 = PWM_DUTY_FRACTION_MAX / SINELUT_MAX * sine_lut[index0++];
    	    dutyValue1 = PWM_DUTY_FRACTION_MAX / SINELUT_MAX * sine_lut[index1++];
    
    	    if(index0 == SINELUT_SIZE)
    	    {
    	      index0 = 0;
    	    }
    	    if(index1 == SINELUT_SIZE)
    	    {
    	      index1 = 0;
    	    }
    	    PWM_setDuty(hPWM0, dutyValue0);
    	    PWM_setDuty(hPWM1, dutyValue1);
    
    	    //20160107
        if (sensorConfig == ST_CFG_SENSOR_ENABLE)
        {
          Data_t data;
    
          // 1. Start temperature measurement
          sensorHdc1000Start();
          delay_ms(HUM_DELAY_PERIOD);
    
          // 2. Read data
          sensorHdc1000Read(&data.v.rawTemp, &data.v.rawHum);
    
          // 3. Send data
          Humidity_setParameter( SENSOR_DATA, SENSOR_DATA_LEN, data.a);
    
          // 4. Wait until next cycle
          delay_ms(sensorPeriod - HUM_DELAY_PERIOD);
        }
        else
        {
          delay_ms(SENSOR_DEFAULT_PERIOD);
        }
      }
    
    }
    
    /*********************************************************************
     * @fn      sensorConfigChangeCB
     *
     * @brief   Callback from Humidity Service indicating a value change
     *
     * @param   paramID - parameter ID of the value that was changed.
     *
     * @return  none
     */
    static void sensorConfigChangeCB(uint8_t paramID)
    {
      // Wake up the application thread
      SensorTag_charValueChangeCB(SERVICE_ID_HUM, paramID);
    }
    
    /*********************************************************************
     * @fn      initCharacteristicValue
     *
     * @brief   Initialize a characteristic value
     *
     * @param   paramID - parameter ID of the value is to be cleared
     *
     * @param   value - value to initialize with
     *
     * @param   paramLen - length of the parameter
     *
     * @return  none
     */
    static void initCharacteristicValue(uint8_t paramID, uint8_t value,
                                        uint8_t paramLen)
    {
      uint8_t data[SENSOR_DATA_LEN];
    
      memset(data,value,paramLen);
      Humidity_setParameter( paramID, paramLen, data);
    }
    
    /*********************************************************************
    *********************************************************************/
    
  • 未加入那个部分的时候没问题吧?感觉这个有可能跟代码没关系,可能是工程配置问题,找个例程,然后替换里面代码试试。

  • 可能是原因是:1)若是工程内有多个.c文件,但是主文件中根本没有调用从文件中的函数,因为编译时是每个文件独立编译成.obj,最后链接成一个总的obj,单独编译一个文件没报错,链接起来时因为在主文件中没有使用,或者说没有定义,就会报错说unresolved symbols 而symbols都是在从文件中出现的。
    2)也有可能是主文件使用从文件时,工程内没有加上从文件include所需的头文件,一般是与他同名的头文件。当然了,不论从文件还是主文件中include的头文件都得在路径中可以找到才行。
    3)还有一种可能是主文件中使用了从文件的函数,但是工程内没有添加相关的从文件,也会出现这种情况,不过错误提示中的first reference in...可以帮助我们找到错误的源头。
    4.主文件名应与工程名一致,大小写不敏感。