gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-30 18:02:39 44 4
gpt4 key购买 nike

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

实现的项目 2D DCT/IDCT 有 *.c 和 *.asm 文件,并且它工作非常好。在某些时候,对于某些计算,C 文件正在使用 asm 文件中声明(和实现)的函数。

我注意到,如果我在项目中移动这些 *.c 文件(仅包含 *.cpp 文件),我会收到很多错误,其中一些错误如下:

"`[Error li1021] The following symbols referenced in processor 'p0' could not be resolved:
'something [_something]' referenced from '.\Debug\project 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 '.\Debug\Start_DCT2.doj'
'_r8x8invdct_ieee(short *, short *, short *) [__r8x8invdct_ieee__FPsN21]' referenced from '.\Debug\Start_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 函数原型(prototype),例如

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

或者,如果您有多个 C 函数,您可以将原型(prototype)分组在一起,如下所示:

extern "C" {

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

// ... other C function prototypes ...
}

关于c++ - 如何在 VisualDsp++ 5 中为 Blackfin BF537 使用 *.cpp 文件中的 asm 实现的函数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9045675/

44 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com