开发者

TI C2800 DSPs: troubleshooting linker problems between C++ and assembly code

开发者 https://www.devze.com 2022-12-14 21:26 出处:网络
I have a function sincos_Q15_asm() in assembly, in file sincos_p5sh.asm with directives as follows: .sect\".text\"

I have a function sincos_Q15_asm() in assembly, in file sincos_p5sh.asm with directives as follows:

.sect   ".text"
.global _sincos_Q15_asm
.sym    _sincos_Q15_asm,_sincos_Q15_asm, 36, 2, 0
.func   1

The function works fine when I test it by itself (assembly only), but when I try to link to it, I get a linker error:

undefined                   first referenced
symbol                         in file
---------                   ----------------
sincos_Q15_asm(int, int *) build\pwm3phase.obj

error: u开发者_JS百科nresolved symbols remain

This is very puzzling to me, as I am including the assembled file build\blocks\sincos_p5sh.obj in my linker command, and I've used the absolute lister abs2000 on this obj file and it says there is a symbol _sincos_Q15_asm. (the underscore prefix is how it works for assembly)

Any suggestions what I should troubleshoot next?


D'oh! I figured it out -- I was using C++ and forgot to include the extern "C" declaration for my function:

extern "C" {
extern void sincos_Q15_asm(int16_t theta, int16_t* cs);
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号