如何为Blackfin BF537使用VisualDsp++5中*.cpp文件中的asm中实现的函数

How to use function implemented in asm from *.cpp file, in VisualDsp++ 5, for Blackfin BF537?

本文关键字:文件 cpp asm 函数 实现 Blackfin BF537 使用 VisualDsp++5      更新时间:2023-10-16

我已经在"Wiley Embedded Signal Processing with the Micro Signal Architecture。2007"-实现了2D DCT/IDCT(图像压缩)中解释了这个项目,我想在Blackfin BF 537Visual Dsp中将另一个具有图像处理(只有*.cpp文件)的个人项目组合(将这些文件移动到..)。(首先在模拟器中,然后在板BF537上。)

已实施的项目2D DCT/IDCT具有*c和*asm文件,并且它工作得非常好。在某些情况下,对于某些计算,from C文件使用的是在asm文件中声明(并实现)的函数。

我注意到,如果我在我的项目中移动这些*.c文件(其中只包含*.cpp文件),我会得到很多错误,还有一些类似的错误:

"`[Error li1021] The following symbols referenced in processor 'p0' could not be resolved:
   'something [_something]' referenced from '.Debugproject name.doj'"

所以,我认为我的项目中只需要*.cpp文件(而不是*.cpp和*.c的组合)。

2D DCT/IDCT项目中,当我更改所有这些*时,问题就会出现c文件到*cpp文件。当我试图构建时,我得到了这个链接错误:

"[Error li1021]  The following symbols referenced in processor 'p0' could not be resolved:
   '_r8x8dct(short *, short *, short *) [__r8x8dct__FPsN21]' referenced from '.DebugStart_DCT2.doj'
   '_r8x8invdct_ieee(short *, short *, short *) [__r8x8invdct_ieee__FPsN21]' referenced from '.DebugStart_DCT2.doj'"

在*cpp文件这就是我调用asm:中实现的函数的方式

     _r8x8dct(in,coeff,temp);

在同一个*cpp文件我包括一个头文件,我在其中声明了函数:

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

这是*的一部分asm包含以下函数的文件:

     .section    L1_code;
     .global     __r8x8dct;
     .align      8;
     __r8x8dct:
     .....................................
     __r8x8dct.end:

具有$_r8x8invdct_ieee() 功能的模拟

*请原谅我的英语写作错误

要从C++调用C函数,您需要使用extern "C"来限定C函数原型,例如

extern "C" void _r8x8dct(fract16 *in, fract16 *coeff, fract16 *temp);

或者,如果你有多个C函数,你可以像这样将原型组合在一起:

extern "C" {
    void _r8x8dct(fract16 *in, fract16 *coeff, fract16 *temp);
    // ... other C function prototypes ...
}