TI中文支持网
TI专业的中文技术问题搜集分享网站

sleep 定义问题

请教:

我编译COLLECTOR.C 文件,使用了SLEEP 函数,并加入了头文件 #include <unistd.h>

提示下面的错误:

**** Build of configuration Release for project collector_CC1350_LAUNCHXL_433_tirtos_ccs ****

"C:\\ti\\ccs1000\\ccs\\utils\\bin\\gmake" -k -j 4 all -Omaking ../src/sysbios/rom_sysbios.aem3 …
gmake[1]: Nothing to be done for 'all'.
making ../src/sysbios/rom_sysbios.aem3 …
gmake[2]: Nothing to be done for 'all'.
Building target: "collector_CC1350_LAUNCHXL_433_tirtos_ccs.out"
Invoking: ARM Linker
"C:/ti/ccs1000/ccs/tools/compiler/ti-cgt-arm_20.2.0.LTS/bin/armcl" –cmd_file="C:/Users/Administrator/workspace_v10/collector_CC1350_LAUNCHXL_433_tirtos_ccs/Application/Defines/collector.opts" -mv7M3 –code_state=16 –float_support=vfplib -me -O4 –opt_for_speed=0 –define=Board_EXCLUDE_NVS_EXTERNAL_FLASH –define=DeviceFamily_CC13X0 –define=SET_CCFG_BL_CONFIG_BL_LEVEL=0x00 –define=SET_CCFG_BL_CONFIG_BL_ENABLE=0xC5 –define=SET_CCFG_BL_CONFIG_BL_PIN_NUMBER=0x0D –define=SET_CCFG_BL_CONFIG_BOOTLOADER_ENABLE=0xC5 -g –c99 –plain_char=unsigned –diag_warning=225 –diag_warning=255 –diag_wrap=off –display_error_number –gen_func_subsections=on –embedded_constants=on –unaligned_access=on –enum_type=packed –wchar_t=16 –common=on –fp_reassoc=off –sat_reassoc=off -z -m"collector_CC1350_LAUNCHXL_433_tirtos_ccs.map" -i"C:/ti/ccs1000/ccs/tools/compiler/ti-cgt-arm_20.2.0.LTS/lib" –reread_libs –define=ONE_PAGE_NV –diag_wrap=off –display_error_number –warn_sections –xml_link_info="collector_CC1350_LAUNCHXL_433_tirtos_ccs_linkInfo.xml" –rom_model –unused_section_elimination=on -o "collector_CC1350_LAUNCHXL_433_tirtos_ccs.out" "./CC1350_LAUNCHXL_433.obj" "./CC1350_LAUNCHXL_433_fxns.obj" "./ccfg.obj" "./Application/LCD12864-15/LCD12864DRIVER.obj" "./Application/LaunchPad/board_gpio.obj" "./Application/LaunchPad/board_key.obj" "./Application/LaunchPad/board_lcd.obj" "./Application/LaunchPad/board_led.obj" "./Application/MAC/HAL/common/hal_appasrt.obj" "./Application/MAC/HAL/target/dbg.obj" "./Application/MAC/HAL/target/hal_aes.obj" "./Application/MAC/HAL/target/hal_ccm.obj" "./Application/MAC/HAL/target/hal_flash_wrapper.obj" "./Application/MAC/HAL/target/hal_rtc_wrapper.obj" "./Application/MAC/HAL/target/hal_trng_wrapper.obj" "./Application/MAC/HAL/target/pwrmon.obj" "./Application/MAC/HighLevel/mac_cfg.obj" "./Application/MAC/LowLevel/mac_settings.obj" "./Application/ML302/EdpKit.obj" "./Application/ML302/ML302Model.obj" "./Application/PALNA/board_palna.obj" "./Application/Services/nvocop.obj" "./Application/Services/nvoctp.obj" "./Application/Services/saddr.obj" "./Application/api_mac.obj" "./Application/cllc.obj" "./Application/collector.obj" "./Application/csf.obj" "./Application/macTask.obj" "./Application/mac_user_config.obj" "./Application/mac_util.obj" "./Application/main.obj" "./Application/uart_printf.obj" "./Application/util_timer.obj" "./Application/osal_port/osal_port.obj" "./Application/osal_port/osal_port_timers.obj" "../cc13x0lp.cmd" -l"configPkg/linker.cmd" -l"C:/ti/simplelink_cc13x0_sdk_4_10_00_10/source/ti/ti154stack/library/tirtos/ccs/bin/maclib_secure_cc13x0.a" -l"C:/ti/simplelink_cc13x0_sdk_4_10_00_10/source/ti/display/lib/display.aem3" -l"C:/ti/simplelink_cc13x0_sdk_4_10_00_10/source/ti/grlib/lib/ccs/m3/grlib.a" -l"C:/ti/simplelink_cc13x0_sdk_4_10_00_10/source/ti/drivers/rf/lib/rf_multiMode_cc13x0.aem3" -l"C:/ti/simplelink_cc13x0_sdk_4_10_00_10/source/ti/drivers/lib/drivers_cc13x0.aem3" -l"C:/ti/simplelink_cc13x0_sdk_4_10_00_10/kernel/tirtos/packages/ti/dpl/lib/dpl_cc13x0.aem3" -l"C:/ti/simplelink_cc13x0_sdk_4_10_00_10/source/ti/devices/cc13x0/driverlib/bin/ccs/driverlib.lib" -llibc.a<Linking>
undefined first referenced
symbol in file ——— —————-
sleep <whole-program>error #10234-D: unresolved symbols remain
error #10010: errors encountered during linking; "collector_CC1350_LAUNCHXL_433_tirtos_ccs.out" not built
>> Compilation failure
makefile:205: recipe for target 'collector_CC1350_LAUNCHXL_433_tirtos_ccs.out' failed
gmake[1]: *** [collector_CC1350_LAUNCHXL_433_tirtos_ccs.out] Error 1
makefile:201: recipe for target 'all' failed
gmake: *** [all] Error 2

**** Build Finished ****

Kevin Qiu1:

SDK版本是多少,将这部分代码传出来看看

自由飞翔:

回复 Kevin Qiu1:

simplelink_cc13x0_sdk_4_10_00_10
/* Standard C Libraries */
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdbool.h> //bool 类型
#include <unistd.h>//sleep
#include <ti/sysbios/knl/Task.h>//task_sleep
//UART UARTCC26XX_CMD_RX_FIFO_FLUSH
//UART UARTCC26XX_CMD_RETURN_PARTIAL_ENABLE
#include <ti/drivers/UART.h>
#include <ti/drivers/uart/UARTCC26XX.h>
#include <ti/drivers/uart/UARTCC26XX.h>

代码://发送ATSETVOLTE命令:ok。关闭回显//设置AT 返回判断数据列表长度V_F_REBACKOK_LEN=1;V_F_REBACKERROR_LEN=1;
FunExeReback=UartWrite_TC35(F_ORDER_ATSETVOLTE, sizeof(F_ORDER_ATSETVOLTE)-1,D_BufferAreaLen,F_REBACK_OK,F_REBACK_ERROR);if (FunExeReback==false){ML320_ERRORNO=1;UART_write(hUart, "Gsm_CallPhone:-2\r\n", strlen("Gsm_CallPhone:-2\r\n"));return FunExeReback;}
sleep(5);//注意:AT设置命令发送完应延迟几秒,在发送下一步的AT命令。
V_F_REBACKOK_LEN=F_REBACK_Call_LEN;V_F_REBACKERROR_LEN=1;

Kevin Qiu1:

回复 自由飞翔:

库中没有这个sleep函数,可以用Task_sleep();

自由飞翔:

回复 Kevin Qiu1:

*======== unistd.h ========*/

#ifndef ti_posix_ccs_unistd__include
#define ti_posix_ccs_unistd__include

/* compiler vendor check */
#if !defined(__TI_COMPILER_VERSION__) && !defined(__clang__)
#error Incompatible compiler: use this include path (…/ti/posix/ccs) only \
with a Texas Instruments compiler. You appear to be using a different compiler.
#endif

#include "sys/types.h"

#ifdef __cplusplus
extern "C" {
#endif

extern unsigned sleep(unsigned seconds);
extern int usleep(useconds_t useconds);

#ifdef __cplusplus
}
#endif

#endif /* ti_posix_ccs_unistd__include */

Kevin Qiu1:

回复 自由飞翔:

这里只是声明了sleep

自由飞翔:

回复 Kevin Qiu1:

我用collector_CC1310_LAUNCHXL_tirtos_ccs 这个历程,其中调用了SLEEP ,编译是没问题的。
现在我用collector_CC1350_LAUNCHXL_433_tirtos_ccs 历程中调用SLEEP 编译就出现问题,能否是编译参数设置的问题。

函数声明是在:C:\ti\simplelink_cc13x0_sdk_4_10_00_10\source\ti\ccs\unistd.h 中定义:
/* compiler vendor check */
#if !defined(__TI_COMPILER_VERSION__) && !defined(__clang__)
#error Incompatible compiler: use this include path (…/ti/posix/ccs) only \
with a Texas Instruments compiler. You appear to be using a different compiler.
#endif

#include "sys/types.h"

#ifdef __cplusplus
extern "C" {
#endif

extern unsigned sleep(unsigned seconds);
extern int usleep(useconds_t useconds);
函数原型在:C:\ti\simplelink_cc13x0_sdk_4_10_00_10\source\ti\posix\tirtos\sleep.c 中定义
/**======== sleep ========*/
unsigned sleep(unsigned seconds)
{unsigned long secs, ticks;/* at least 32-bit */unsigned max_secs, rval;/* native size, might be 16-bit */
max_secs = MAX_SECONDS;
if (seconds < max_secs) {secs = seconds;rval = 0;}else {secs = max_secs;rval = seconds – max_secs;}
/* must use 64-bit math to compute tick value */ticks = ((uint64_t)secs * 1000000L) / (uint64_t)Clock_tickPeriod;
/* must add one tick to ensure a full duration of requested ticks */Task_sleep((UInt32)(ticks + 1));
return (rval);
}

是否编译参数中没有设置加载C:\ti\simplelink_cc13x0_sdk_4_10_00_10\source\ti\posix\tirtos\sleep.c。

Kevin Qiu1:

回复 自由飞翔:

根据编译错误应该是没有找到sleep定义

自由飞翔是否编译参数中没有设置加载C:\ti\simplelink_cc13x0_sdk_4_10_00_10\source\ti\posix\tirtos\sleep.c

是的

自由飞翔:

回复 Kevin Qiu1:

如何修改编译参数加载C:\ti\simplelink_cc13x0_sdk_4_10_00_10\source\ti\posix\tirtos\sleep.c

Kevin Qiu1:

回复 自由飞翔:

最快的办法是将sleep.c直接复制到导入后的rfEasyLinkTx_CC1350_LAUNCHXL_433_tirtos_ccs工程文件夹中

赞(0)
未经允许不得转载:TI中文支持网 » sleep 定义问题
分享到: 更多 (0)