I used to use Cubemx to generate peripheral code not realizing that it got SYS > Debug → Disabled the whole time. According to sources on the internet this means, no JTAG, no SWO as those pins were not initialized. Yet, I use Truestudio IDE and was able to debug all along. Could you please share some info on how this mechanism worked ?
I looked into project startup scripts, startup.s and there didn't seem to have any special instructions that could enabled SWO debug.