主代码
#include"math.h"
#define PI 3.1415926
#define Coeff 16
#define num 512 //样本个数
int FIRLMS(int *nx,float *nh,int nError,int nCoeffNum);
float h[Coeff],fU;
int x[num],y[num],e[num];
int FIRLMS(int *nx,float *nh,int nError,int nCoeffNum)
{
int i,r;
float fWork;
r=0;
for ( i=0;i<nCoeffNum;i++ )
{
fWork=nx[i]*nError*fU;
nh[i]+=fWork;
r+=(nx[i-i]*nh[i]);
//r+=(nx[i]*nh[i]);
}
r/=128;
return r;
}
main()
{
int i,out;
out=0;
fU=0.0005; for ( i=0;i<Coeff;i++ )
{
h[i]=0;
}
for ( i=0;i<num;i++ )
{
x[i]=256*sin(i*2*PI/34);
y[i]=e[i]=0;
}
for ( i=Coeff+1;i<num;i++ )
{
out=FIRLMS(x+i,h,out-x[i-1],Coeff); // break point
y[i]=out;
e[i]=y[i]-x[i];
}
exit(0);
//return 0;
}
exit.c文件
/****************************************************************************/
/* EXIT.C v15.12.1 */
/* */
/* Copyright (c) 1995-2016 Texas Instruments Incorporated */
/* http://www.ti.com/ */
/* */
/* Redistribution and use in source and binary forms, with or without */
/* modification, are permitted provided that the following conditions */
/* are met: */
/* */
/* Redistributions of source code must retain the above copyright */
/* notice, this list of conditions and the following disclaimer. */
/* */
/* Redistributions in binary form must reproduce the above copyright */
/* notice, this list of conditions and the following disclaimer in */
/* the documentation and/or other materials provided with the */
/* distribution. */
/* */
/* Neither the name of Texas Instruments Incorporated nor the names */
/* of its contributors may be used to endorse or promote products */
/* derived from this software without specific prior written */
/* permission. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */
/* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
/* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
/* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */
/* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */
/* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */
/* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
/* */
/****************************************************************************/
#include <stdlib.h>
#include <_lock.h>
#include <pprof.h>
void (*__TI_cleanup_ptr)(void) = NULL;
void _DATA_ACCESS (*__TI_dtors_ptr)(int) = NULL;
typedef void (*PTRFUNC)();
extern void __TI_pprof_out_hndl(); // Declare the external function
//void __TI_pprof_out_hndl(); // Declare the external function
int __TI_enable_exit_profile_output = 1;
/****************************************************************************/
/* EXIT() - NORMAL PROGRAM TERMINATION. */
/****************************************************************************/
void exit(int status)
{
/*----------------------------------------------------------------------*/
/* Output profile info if we have a valid path profile output handler */
/*----------------------------------------------------------------------*/
if (__TI_enable_exit_profile_output &&
_symval(&__TI_pprof_out_hndl) != (unsigned long)-1)
{
PTRFUNC ppfunc = (PTRFUNC)(&__TI_pprof_out_hndl);
(ppfunc)();
}
/*-------------------------------------------------------------------*/
/* MUST LOCK WHEN ACCESSING GLOBALS, like __TI_dtors_ptr, */
/* __TI_cleanup_ptr */
/*-------------------------------------------------------------------*/
_lock();
/*-------------------------------------------------------------------*/
/* BOTH ATEXIT FUNCTIONS AND STATIC OBJECT DESTRUCTORS ARE */
/* REGISTERED IN A LINK LIST POINTED BY __TI_dtors_ptr, NOW WALK */
/* THROUGH THIS LIST TO CALL THEM. */
/*-------------------------------------------------------------------*/
if (__TI_dtors_ptr) (*__TI_dtors_ptr)(status);
#if defined(_C_IN_NS)
/*-------------------------------------------------------------------*/
/* _C_IN_NS IS A FLAG WE SET ONLY IN DINKUMWARE HEADERS. SO US IT TO */
/* TELL IF IT IS IN DINKUMWARE. */
/* FOR DINKUMWARE LIBRARY, CALL CLOSEALL() TO CLOSE ALL IO STREAMS. */
/* CLOSEALL() is a DINKUMWARE FUNCTION DEFINED IN FCLOSE.C TO CLOSE */
/* ALL OPENED IOSTREAMS. */
/*-------------------------------------------------------------------*/
closeall();
#else
/*-------------------------------------------------------------------*/
/* IF FILES ARE POSSIBLY OPEN, __TI_cleanup_ptr() WILL BE SETUP TO */
/* CLOSE THEM. */
/*-------------------------------------------------------------------*/
if (__TI_cleanup_ptr) (*__TI_cleanup_ptr)();
#endif
abort();
}
/****************************************************************************/
/* ABORT - ABNORMAL PROGRAM TERMINATION. CURRENTLY JUST HALTS EXECUTION. */
/****************************************************************************/
void abort(void)
{
/*-------------------------------------------------------------------*/
/* SET C$$EXIT LABEL SO THE DEBUGGER KNOWS WHEN THE C++ PROGRAM HAS */
/* COMPLETED. THIS CAN BE REMOVED IF THE DEBUGGER IS NOT USED. */
/*-------------------------------------------------------------------*/
__asm(" .global C$$EXIT");
__asm("C$$EXIT: nop");
for (;;); /* SPINS FOREVER */
}
pprof.h文件
/*****************************************************************************/
/* PPROF.H v15.12.1 */
/* */
/* Copyright (c) 2007-2016 Texas Instruments Incorporated */
/* http://www.ti.com/ */
/* */
/* Redistribution and use in source and binary forms, with or without */
/* modification, are permitted provided that the following conditions */
/* are met: */
/* */
/* Redistributions of source code must retain the above copyright */
/* notice, this list of conditions and the following disclaimer. */
/* */
/* Redistributions in binary form must reproduce the above copyright */
/* notice, this list of conditions and the following disclaimer in */
/* the documentation and/or other materials provided with the */
/* distribution. */
/* */
/* Neither the name of Texas Instruments Incorporated nor the names */
/* of its contributors may be used to endorse or promote products */
/* derived from this software without specific prior written */
/* permission. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */
/* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
/* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
/* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */
/* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */
/* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */
/* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
/* */
/*****************************************************************************/
#ifndef _PPROF_H
#define _PPROF_H
#include <linkage.h>
#define PPROF_HANDLER_NAME "PPHNDL" /* DO NOT CHANGE THIS */
#define PPROF_FILE_MAGIC "TI_PDD"
#define PPROF_DSET_MAGIC "TIPPRD"
#define PPROF_NUM_HDR_FIELDS 3
#define PPROF_VERSION 1
#define BIG_ENDIAN_CODE 2
#define LITTLE_ENDIAN_CODE 1
extern _CODE_ACCESS int __TI_prof_data_start;
extern _CODE_ACCESS int __TI_prof_data_size;
extern _CODE_ACCESS void __TI_pprof_out_hndl();
/* Used by pprof user API */
extern _CODE_ACCESS int __TI_enable_exit_profile_output;
_CODE_ACCESS extern void __TI_init_pphandler();
_CODE_ACCESS extern void _output_path_profile_info();
#endif
编译出现如下错误:
<Linking>
undefined first referenced
symbol in file
--------- ----------------
___TI_pprof_out_hndl ./exit.obj
error #10234-D: unresolved symbols remain
error #10010: errors encountered during linking; "5509YULMS.out" not built
>> Compilation failure
makefile:143: recipe for target '5509YULMS.out' failed
gmake: *** [5509YULMS.out] Error 1
gmake: Target 'all' not remade because of errors.
**** Build Finished ****
请帮助!