AnsweredAssumed Answered

Problem using function implemented in asm in *.cpp file; BF537

Question asked by floppy on Jan 28, 2012

SOLVED!

 

I have this project explained in "Wiley-Embedded Signal Processing with the Micro Signal Architecture.2007" - 2D DCT/IDCT (image compression) implemented, and i want to combine (move these files to..) with another personal project with image processing (which have only *.cpp files) in Visual Dsp for Blackfin BF 537. (first in Simulator, and after that on the board BF537..)

 

The implemented project 2D DCT/IDCT has *.c and *.asm files and it works verry well. At some point, for some calculations, from C file is using a function declared (and implemented) in asm file.

 

I noticed that if i move these *.c files in my project (which contain only *.cpp files), i get lots of errors and some like this one:

"`[Error li1021] The following symbols referenced in processor 'p0' could not be resolved:

'something [_something]' referenced from '.\Debug\project name.doj'"

 

So, i think i need to have just *.cpp files in my project (not combination off *.cpp and *.c).

 

 

In the 2D DCT/IDCT project, the problem appear when i'm changing all those *.c files to *.cpp files. When i'm trying to build, i get this linking error:

"[Error li1021]  The following symbols referenced in processor 'p0' could not be resolved:

        '_r8x8dct(short *, short *, short *) [__r8x8dct__FPsN21]' referenced from '.\Debug\Start_DCT2.doj'

        '_r8x8invdct_ieee(short *, short *, short *) [__r8x8invdct_ieee__FPsN21]' referenced from '.\Debug\Start_DCT2.doj'"

 

In *.cpp file this is how i'm calling the function implemented in asm:

               _r8x8dct(in,coeff,temp);

 

In the same *.cpp file i include a header file where i declared the function:

               void _r8x8dct(fract16 *in, fract16 *coeff, fract16 *temp);

 

And here is part of the *.asm file which contain the function:

               .section    L1_code;

               .global     __r8x8dct;

               .align      8;

               __r8x8dct:

               .....................................

               __r8x8dct.end:

 

Analog with function _r8x8invdct_ieee()..

 

I attached 2 archives whit the 2 projects: the one with *.c files, and the other with *.cpp files.

 

----------------------------------------------------------------------------------------------------------------------------------------------

SOLUTION:

 

In the same *.cpp file i include a header file where i grouped the protoypes of the functions, and worked!:

     extern "C" {

         void _r8x8dct(fract16 *in, fract16 *coeff, fract16 *temp);

         void _r8x8invdct_ieee(fract16 *in, fract16 *coeff, fract16 *temp);

     }

 

Message was edited by: Florin Virdol

Outcomes