Trace from STM can be captured in similar style as with the nrfutil trace lte subcommand. STM trace data in a file stm_trace.bin can be captured to binary format by running the following command:
nrfutil trace stm --input-file stm_trace.bin --output-raw out.bin