Check my model of a buck converter here for a complete Kicad d_process example: Easier mixed mode simulation (and real world comparison!) - #4 by slh . It was originally based on the Isotel model by @uros.
There’s a good chance that you’ve run into a problem I found when I shared my first version ( Mixed mode simulation including C code and verilog ). Ngspice doesn’t get given the working directory properly so it doesn’t know where to look for the executable. My models have a change directory (cd) command in the ngspice control block on the schematic.
If you want to use gdb to debug the controller then check my first link as there’s a minor bug in ngspice in how you name the pipes.