dpigen how to generate *.so objects with debug symbols

2 vues (au cours des 30 derniers jours)
Ronald
Ronald le 5 Juin 2025
Commenté : Ronald le 12 Juin 2025
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?

Réponse acceptée

Marc Erickson
Marc Erickson le 11 Juin 2025
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 commentaire
Ronald
Ronald le 12 Juin 2025
Thanks a lot for the help! it works

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Generated Code Compilation dans Help Center et File Exchange

Tags

Produits


Version

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by