Can you please let us know the MPN (Manufacturing Part Number) of the device that you are using and also if you are using PSoC Creator or ModusToolbox to develop applications for PSoC 6? You can disable the Debug mode in the System tab in the Design Wide Resources file in PSoC Creator and Device Configurator in ModusToolbox.
To change the configuration of the SWD pins to GPIO through code you can use the PDL API - Cy_GPIO_SetHSIOM() with the en_hsiom_sel_t value to be HSIOM_SEL_GPIO and then change the drive mode to Analog High-Z using the API - Cy_GPIO_SetDrivemode()
You will still be able to reprogram the device when the SWD pins are changed to GPIO and only the Debug mode will be disabled.
Please refer to this Application Note for more details - PSoC 6 MCU Low-Power Modes and Power Reduction Techniques
Thanks and Regards,
Rakshith M B
Edit: Added information about HSIOM
Rakshith M B,
CY8C6336BZI-BLF03 with PSoC Creator 4.3.
I want the pins to be in debug mode by default in the System tab.
I want to change them to GPIO only during deep sleep.
I was trying to figure out how to do it with Cy_GPIO_SetHSIOM() and was hoping there were #defines for SWD_CLK and SWD_DATA. For this part, I guess I'll need to use GPIO_PRT6 and the appropriate pin number.