I am trying to lock the SWJ using the following code:
CY_SECTION(".cy_toc_part2") __USED const uint32_t cyToc =
0x200-4, /* Offset=0x0000: Object Size, bytes (512 bytes - 4 bytes of CRC) */
0x01211220, /* Offset=0x0004: Magic Number (TOC Part 2, ID) */
0, /* Offset=0x0008: Key Storage Address */
 = 0x10000000u, /* Offset=0x0010: App image start address */
 = 0x00000002, /* Offset=0x01F8: Bits[ 1: 0] CLOCK_CONFIG (0=8MHz, 1=25MHz, 2=50MHz, 3=100MHz) (default = 2)
Bits[ 4: 2] LISTEN_WINDOW (0=20ms, 1=10ms, 2=1ms, 3=0ms, 4=100ms) (default = 0)
Bits[ 6: 5] SWJ_PINS_CTL (0/1/3=Disable SWJ, 2=Enable SWJ) (default = 2)
Bits[ 8: 7] APP_AUTHENTICATION (0/2/3=Enable, 1=Disable)(default = 0)
Bits[10: 9] FB_BOOTLOADER_CTL: UNUSED (default = 0)(reserved) */
The CRC is automatically generated using cymcuelftool.
I have attached the .hex file generated by reading the SFlash using PSoC Programmer after loading the program.
Please advise on what needs to be modified in the CY_SECTION to properly lock the SWJ.
From your recent post, I assume you were able to get this working. I will be locking this thread, we will continue all further discussions in the other thread: PSoC Programmer: CPU stopped at wrong address (0x10002958).