This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

F29H850TU: The static function is not compiled/linked if it is called by an inline assembly function

Part Number: F29H850TU

Device: F29H850

CCS: 20.3

Compiler: TI C29 Clang Compiler 2.0.0

I defined three functions in my main.c (attached). Two are public functions (main(), and pub_func()) and one is a static function (static_func()). Both pub_func() and static_func() are called in main() with inline assembly code (line#26 and Line#29). 

Screenshot 2025-12-03 113354.jpg

When compiling and linking the project, I got an error of "undefined symbol": static_func (static function). Calling the public function (line #29) with inline assembly works fine.

Screenshot 2025-12-03 103208.jpg

Adding a c function call (line #27) will resolved the problem. I'd like to know why calling a static function frm an inline assembly generates an error. Do I miss something in compile/link options?

 

main.c 

  • Hello,

    I have brought this thread to the attention of the compiler experts as they will be able to assist best.

    Thanks

    ki

  • Hi QJ, as the `static_func` function is declared static, the compiler will not see the reference in inline assembly when compiling that file and ends up removing the function prior to link-time, hence the error.  The `pub_function` is not removed (non static) and persists until link-time.  But I would strongly advise against calling functions from inlined assembly since it will not honor the strict C29 calling convention requirements implemented by the compiler.

    -Alan