I am writing an image processing application in Vivado HLS with cpp. I am getting a error of saying undefined reference to ISP(a function call) I have seen this error multiple times and looked at similar cases in the stack overflow and was able to debug previously.Mostly it was a mismatch in the datatypes previously, but I can't seem to find where it is going wrong now with the current version, I spent hours trying to look for it, Thought a fresh set of eyes can help and the reason for me posting it here. I have posted the related parts of code below:
//header file
#include "hls_stream.h"
#include <ap_fixed.h>
//#include <ap_int.h>
#include "ap_int.h"
typedef ap_ufixed<24,24> bit_24;
typedef ap_fixed<11,8> fix;
typedef unsigned char uc;
typedef ap_uint<24> stream_width;
//typedef hls::stream<uc> Stream_t;
typedef hls::stream<stream_width> Stream_t;
struct configuration
{
bool dn;
bool ct;
bool gm;
bool tm;
};
struct pixel_f
{
float r;
float g;
float b;
};
struct pixel_8
{
uc r;
uc g;
uc b;
};
void ISP(Stream_t& in,Stream_t& out, float weights_ct[3][3],float ctrl_pts[3702][3],float weights[3702][3],float coefs[4][3],int num_ctrl_pts,float rev_tone[256][3], configuration config);
.
//testbench file(where the function is called)
float TsTw_tran[3][3];
float ctrl_pts[3702][3];
float coefs[4][3];
float weights[3702][3];
float rev_tone_s[256][3];
Mat img_rev = imread("C:/Users/20181217/Desktop/images/imgs/output_rev.png");
bit_24 pix_in;
configuration config;
config.ct = true;
config.gm = true;
config.tm = true;
Stream_t in("in_tb");
Stream_t out("out_tb");
const int rows = 256;
const int cols = 512;
for(int i=0;i<256;i++)
{
for(int j=0; j<512;j++)
{
in << ((img_rev.at<Vec3b>(i, j)[2] << 16) | (img_rev.at<Vec3b>(i, j)[1] << 8) | (img_rev.at<Vec3b>(i, j)[0]));
}
}
ISP(in,out,TsTw_tran,ctrl_pts,weights,coefs,num_ctrl_pts,rev_tone_s,config);
.
//core file(wher the function is defined)
void ISP(Stream_t& in,Stream_t& out, float TsTw_tran_rec[3][3],float ctrl_pts_rec[3702][3],float weights_rec[3702][3],float coefs_rec[4][3],float num_ctrl_pts, float rev_tone[256][3],configuration version)
And the error I am getting is : undefined reference to ISP(hls::stream<ap_uint<24> >&, hls::stream<ap_uint<24> >&, float (*) [3], float (*) [3], float (*) [3], float (*) [3], int, float (*) [3], configuration)' collect2.exe: error: ld returned 1 exit status
Any help/suggestions will be highly appreciated,
Thanks in advance
In your header, the declaration of this ISP
function includes an int
parameter:
int num_ctrl_pts
This parameter is either missing from the function's actual definition, or it is defined as a float
instead of an int
.
C++ allows functions to be overloaded, so as far as the C++ compiler is concerned this is some other completely unrelated function, and the issue eventually results in a linking failure.
If you want to spend a few minutes inspecting the compiler's error message, it should now be obvious that the error message informs of you this fact, precisely. In your question you showed the compiler's error message right below the function's definition, this makes this mistake somewhat easy to spot.