Other Parts Discussed in Thread: DAC128S085, SFRA, C2000WARE
问题1:如果把一下代码添加到sci.c,发现sci.c不参与编译。
int fputc(int _c, FILE *_fp)
{
while (SCI_getTxFIFOStatus(SCIA_BASE) == SCI_FIFO_TX16);
HWREGH(SCIA_BASE + SCI_O_TXBUF) = _c;
return _c;
}
int putc(int _x, FILE *_fp)
{
while (SCI_getTxFIFOStatus(SCIA_BASE) == SCI_FIFO_TX16);
HWREGH(SCIA_BASE + SCI_O_TXBUF) = _x;
return _x;
}
int putchar(int _x)
{
while (SCI_getTxFIFOStatus(SCIA_BASE) == SCI_FIFO_TX16);
HWREGH(SCIA_BASE + SCI_O_TXBUF) = _x;
return _x;
}
int fputs(const char * __restrict _ptr, FILE * __restrict _fp)
{
unsigned int i, len;
len = strlen(_ptr);
for(i=0 ; i<len ; i++)
{
while (SCI_getTxFIFOStatus(SCIA_BASE) == SCI_FIFO_TX16);
HWREGH(SCIA_BASE + SCI_O_TXBUF) = (uint8_t) _ptr[i];
}
return len;
}
问题2:如果把代码放到sci.h,编译报如下错误:
<Linking>
error #10056: symbol "putc" redefined: first defined in "./sys_main.obj"; redefined in "./libraries/control/mtpa/mtpa.obj"
error #10056: symbol "fputs" redefined: first defined in "./sys_main.obj"; redefined in "./libraries/control/mtpa/mtpa.obj"
error #10056: symbol "fputc" redefined: first defined in "./sys_main.obj"; redefined in "./libraries/control/mtpa/mtpa.obj"
error #10056: symbol "putchar" redefined: first defined in "./sys_main.obj"; redefined in "./libraries/control/mtpa/mtpa.obj"
error #10056: symbol "putc" redefined: first defined in "./sys_main.obj"; redefined in "./libraries/dacs/dac128s085/dac128s085.obj"
error #10056: symbol "fputs" redefined: first defined in "./sys_main.obj"; redefined in "./libraries/dacs/dac128s085/dac128s085.obj"
error #10056: symbol "fputc" redefined: first defined in "./sys_main.obj"; redefined in "./libraries/dacs/dac128s085/dac128s085.obj"
error #10056: symbol "putchar" redefined: first defined in "./sys_main.obj"; redefined in "./libraries/dacs/dac128s085/dac128s085.obj"
error #10056: symbol "putc" redefined: first defined in "./sys_main.obj"; redefined in "./libraries/sfra/sfra_gui.obj"
error #10056: symbol "fputs" redefined: first defined in "./sys_main.obj"; redefined in "./libraries/sfra/sfra_gui.obj"
error #10056: symbol "fputc" redefined: first defined in "./sys_main.obj"; redefined in "./libraries/sfra/sfra_gui.obj"
error #10056: symbol "putchar" redefined: first defined in "./sys_main.obj"; redefined in "./libraries/sfra/sfra_gui.obj"
error #10056: symbol "putc" redefined: first defined in "./sys_main.obj"; redefined in "./libraries/sfra/sfra_gui_scicomms_driverlib.obj"
error #10056: symbol "fputs" redefined: first defined in "./sys_main.obj"; redefined in "./libraries/sfra/sfra_gui_scicomms_driverlib.obj"
error #10056: symbol "fputc" redefined: first defined in "./sys_main.obj"; redefined in "./libraries/sfra/sfra_gui_scicomms_driverlib.obj"
error #10056: symbol "putchar" redefined: first defined in "./sys_main.obj"; redefined in "./libraries/sfra/sfra_gui_scicomms_driverlib.obj"
error #10056: symbol "putc" redefined: first defined in "./sys_main.obj"; redefined in "./src_board/hal.obj"
error #10056: symbol "fputs" redefined: first defined in "./sys_main.obj"; redefined in "./src_board/hal.obj"
error #10056: symbol "fputc" redefined: first defined in "./sys_main.obj"; redefined in "./src_board/hal.obj"
error #10056: symbol "putchar" redefined: first defined in "./sys_main.obj"; redefined in "./src_board/hal.obj"
error #10056: symbol "putc" redefined: first defined in "./sys_main.obj"; redefined in "./src_board/user_mtr1.obj"
error #10056: symbol "fputs" redefined: first defined in "./sys_main.obj"; redefined in "./src_board/user_mtr1.obj"
error #10056: symbol "fputc" redefined: first defined in "./sys_main.obj"; redefined in "./src_board/user_mtr1.obj"
error #10056: symbol "putchar" redefined: first defined in "./sys_main.obj"; redefined in "./src_board/user_mtr1.obj"
error #10056: symbol "putc" redefined: first defined in "./sys_main.obj"; redefined in "./src_control/communication.obj"
error #10056: symbol "fputs" redefined: first defined in "./sys_main.obj"; redefined in "./src_control/communication.obj"
error #10056: symbol "fputc" redefined: first defined in "./sys_main.obj"; redefined in "./src_control/communication.obj"
error #10056: symbol "putchar" redefined: first defined in "./sys_main.obj"; redefined in "./src_control/communication.obj"
error #10056: symbol "putc" redefined: first defined in "./sys_main.obj"; redefined in "./src_control/motor1_drive.obj"
error #10056: symbol "fputs" redefined: first defined in "./sys_main.obj"; redefined in "./src_control/motor1_drive.obj"
error #10056: symbol "fputc" redefined: first defined in "./sys_main.obj"; redefined in "./src_control/motor1_drive.obj"
error #10056: symbol "putchar" redefined: first defined in "./sys_main.obj"; redefined in "./src_control/motor1_drive.obj"
error #10056: symbol "putc" redefined: first defined in "./sys_main.obj"; redefined in "./src_control/motor_common.obj"
error #10056: symbol "fputs" redefined: first defined in "./sys_main.obj"; redefined in "./src_control/motor_common.obj"
error #10056: symbol "fputc" redefined: first defined in "./sys_main.obj"; redefined in "./src_control/motor_common.obj"
error #10056: symbol "putchar" redefined: first defined in "./sys_main.obj"; redefined in "./src_control/motor_common.obj"
error #10056: symbol "putc" redefined: first defined in "./sys_main.obj"; redefined in "./src_device/device.obj"
error #10056: symbol "fputs" redefined: first defined in "./sys_main.obj"; redefined in "./src_device/device.obj"
error #10056: symbol "fputc" redefined: first defined in "./sys_main.obj"; redefined in "./src_device/device.obj"
error #10056: symbol "putchar" redefined: first defined in "./sys_main.obj"; redefined in "./src_device/device.obj"
error #10056: symbol "fputs" redefined: first defined in "./sys_main.obj"; redefined in "C:\ti\ccs1230\ccs\tools\compiler\ti-cgt-c2000_22.6.0.LTS\lib\rts2800_fpu32_eabi.lib<fputs.c.obj>"
error #10010: errors encountered during linking; "universal_motorcontrol_lab_f280013x.out" not built
>> Compilation failure
makefile:240: recipe for target 'universal_motorcontrol_lab_f280013x.out' failed
gmake[1]: *** [universal_motorcontrol_lab_f280013x.out] Error 1
makefile:236: recipe for target 'all' failed
gmake: *** [all] Error 2