1 of 1 people found this helpful
The secure way is to disable the SWD/JTAG ports by entering SECURE mode. But in case you want the SWJ pins to be disabled in NORMAL mode, you can basically modify the TOC2 flags of the SFlash that configures the flash boot parameters.
Here's some more details regarding this:
For more information please refer to the Chapter Boot Code in the Architecture TRM.
Hope this helps