Modify TOC2_FLAGS not work for disable SWD/JTAG

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
WaLo_3890256
Level 2
Level 2
5 replies posted 10 questions asked 5 questions asked

Hello,

According to Is it possible to prevent user to trace through SWD/JTAG?  discussed:

We could disable JTAG/SWD in Normal mode by modifying the TOC2 flags offset 0x1F8.

Here is sflash toc2 content for my application, IDE is modustoolbox v2.0.

I have modified "SWJ_PINS_CTL" bit to disable SWJ pins in flash boot, but when I programmed the elf to my device, it could not boot correctly(LED not on).

Is there any issue for the TOC2_FLAGS of if CRC checksum is wrong? Please help to clarify how to calculate CRC16-CCITT for these bit value.

Thanks so much for your help.

BR,

Wayne

CY_SECTION(".cy_toc_part2") __attribute__( (used) )

const uint32_t cyToc[128] =

{

    0x200-4,                /* Offset=0x0000: Object Size, bytes */

    0x01211220,             /* Offset=0x0004: Magic Number (TOC Part 2, ID) */

    0,                      /* Offset=0x0008: Key Storage Address */

    (int)&smifIpBlocksArr,  /* Offset=0x000C: This points to a null terminated array of SMIF structures. */

    0x10000000u,            /* Offset=0x0010: App image start address */

     [126] =  0x00000282,    /* Offset=0x01F8: Bits[ 1: 0] CLOCK_CONFIG (0=8MHz, 1=25MHz, 2=50MHz, 3=100MHz)

                                              Bits[ 4: 2] LISTEN_WINDOW (0=20ms, 1=10ms, 2=1ms, 3=0ms, 4=100ms)

                                              Bits[ 6: 5] SWJ_PINS_CTL (0/1/3=Disable SWJ, 2=Enable SWJ)

                                              Bits[ 8: 7] APP_AUTHENTICATION (0/2/3=Enable, 1=Disable)

                                              Bits[10: 9] FB_BOOTLOADER_CTL: UNUSED */

    [127] =  0x3BB30000     /* Offset=0x01FC: CRC16-CCITT (the upper 2 bytes contain the CRC and the lower 2 bytes are 0) */

};

0 Likes
3 Replies
WaLo_3890256
Level 2
Level 2
5 replies posted 10 questions asked 5 questions asked

We can use cymcuelf tool to sign the elf and get the CRC checksum and boot successfully after programmed the signed elf.

But we can still program other elf/hex files. It looks like we disable SWJ bit in TOC2_FLAGS not work since we can still program the device.

Is there anything else I need to concern and verify? Please correct me and help to disable SWD/JTAG interface.

Thanks a lot.

BR,

Wayne

0 Likes

Hello Wayne,

We can use cymcuelf tool to sign the elf and get the CRC checksum and boot successfully after programmed the signed elf.

Can you please let me know the commands used to achieve this? Does the application work when you program the hex file?

Also, can you please share the hex file that is used to program the device?

Thanks and Regards,

Rakshith M B

Thanks and Regards,
Rakshith M B
0 Likes
Rakshith
Moderator
Moderator
Moderator
250 likes received 1000 replies posted 750 replies posted

The thread was locked due to inactivity for a long time, you can continue the discussion on the topic by opening a new thread with reference to the locked one. The continuous discussion in an inactive thread may mostly be unattended by community users.

Thanks and Regards,
Rakshith M B
0 Likes