fixedpoint library linking issue with slbuild

조회 수: 6 (최근 30일)
Ruchit
Ruchit 2025년 2월 26일
댓글: Sivsankar 2025년 3월 7일
I have a model with S-function which uses ssRegisterDataTypeFxpBinaryPoint for uint64, but I am getting error when try to create an executable with slbuild for my model.
It looks like linking error, how to link fixedpoint library when I create an executable of my model with slbuild.
  댓글 수: 2
Raj
Raj 2025년 3월 3일
Hi @Ruchit, I think it will be of great help if you can also attach the error message you are facing as well. This will make it easier for me or anyone in the community to accurately understand the issue and answer it better.
Ruchit
Ruchit 2025년 3월 4일
Hi @Raj
Thanks.
I got this error when I use slbuild,
Error: undefined reference to `ssRegisterDataTypeFxpBinaryPoint' collect2.exe: error: ld returned 1 exit status
To add more info, I am using ssRegisterDataTypeFxpBinaryPoint in S-function to take uint64 datatype signal as input. When I run the model in normal mode, it is working fine, but got above error when I try to create executable of my model.
I have also defined fixpoint header file and .c file both in S-function.

댓글을 달려면 로그인하십시오.

채택된 답변

Sivsankar
Sivsankar 2025년 3월 6일
To compile a fixed-point S-function, additional steps must be used compared to standard C-MEX S-functions.
  1. In your S-function, include "fixedpoint.c" and "fixedpoint.h". For more information, see: https://www.mathworks.com/help/fixedpoint/ug/structure-of-the-s-function.html
  2. Pass an extra argument, "-lfixedpoint", to the MEX command. For example:
>> mex('sfun_user_fxp_asr.c','-lfixedpoint')
Including this extra argument should help in resolving any linker errors you may encounter.
You can leverage the following documentation to larn how to create MEX functions : https://www.mathworks.com/help/fixedpoint/ug/creating-mex-files.html
  댓글 수: 2
Ruchit
Ruchit 2025년 3월 6일
Yes, I have followed both steps which you have mentioned. But in my case, I am getting this error while using slbuild function to create an executable for my model.
My Simulink model has S-function block inside.
Sivsankar
Sivsankar 2025년 3월 7일
You will need to provide TLC code for the fixed pont S-Function when using 'slbuild' as Andy had mentioned in the comment: 'Hence a call to ssRegisterDataTypeFxpBinaryPoint in the standalong executable code just won't work. For generation of standalone code, you'll need to provide TLC code for the fixed-point s-function' of the following MATLAB answer,

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 FPGA, ASIC, and SoC Development에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by