dpigen how to generate *.so objects with debug symbols

8 ビュー (過去 30 日間)
Ronald
Ronald 2025 年 6 月 5 日
コメント済み: Ronald 2025 年 6 月 12 日
we should be able to generate *.so with something like this
dpigen -d MyDPIProject -testbench fun_tb.m fun.m -args {double(0),int8(0)} -launchreport
I'd like to generate the *.so files with debug symbols to be able to debug with GDB or the simulator
How to achieve this?

採用された回答

Marc Erickson
Marc Erickson 2025 年 6 月 11 日
You can gain more control on the codegen process by using a configuration object. Here's how you can create a debug build:
cfg = svdpiConfiguration;
cfg.CoderConfiguration.BuildConfiguration = 'Debug';
dpigen -config cfg -d MyDPIProject -testbench fun_tb.m fun.m -args {double(0),int8(0)} -launchreport
Here's the resulting compilation commands from the codegen report (with the mingw toolchain):
### Using toolchain: MinGW64 | gmake (64-bit Windows)
### Creating 'C:\dpigen_debug_mode\MyDPIProject\fun_rtw.mk' ...
### Building 'libfun_dpi': "$(MINGW_ROOT)\mingw32-make.exe" -j 6 -l 6 -Oline -f fun_rtw.mk all
"C:\Mingw64\bin/gcc" -c -fwrapv -m64 -O0 -g -msse2 -fno-predictive-commoning -D__USE_MINGW_ANSI_STDIO=1 -DMODEL=libfun_dpi @fun_rtw_comp.rsp -o "fun.obj" "C:/dpigen_debug_mode/MyDPIProject/fun.c"
"C:\Mingw64\bin/gcc" -c -fwrapv -m64 -O0 -g -msse2 -fno-predictive-commoning -D__USE_MINGW_ANSI_STDIO=1 -DMODEL=libfun_dpi @fun_rtw_comp.rsp -o "fun_dpi.obj" "C:/dpigen_debug_mode/MyDPIProject/fun_dpi.c"
"### Creating dynamic library "./libfun_dpi.dll" ..."
"C:\Mingw64\bin/g++" -shared -Wl,--no-undefined -g -Wl,--out-implib,./libfun_dpi.lib fun.def -o ./libfun_dpi.dll @fun_rtw.rsp -lws2_32
"### Created: ./libfun_dpi.dll"
"### Successfully generated all binary outputs."
You could also hand-edit the "fun_rtw.mk" makefile and reinvoke the "all" target if you are comfortable doing that.
  1 件のコメント
Ronald
Ronald 2025 年 6 月 12 日
Thanks a lot for the help! it works

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGenerated Code Compilation についてさらに検索

タグ

製品


リリース

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by