This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F28379D: How to properly implement DCSM

Part Number: TMS320F28379D
Other Parts Discussed in Thread: LAUNCHXL-F28379D, SYSCONFIG

Hi,

I am currently trying to implement the DCSM on the LAUNCHXL-F28379D. I already studied the documentation and the example project blinky_with_dcsm_cpu01. 

Since the example project doesnt cleary implement the DCSM functionality besides the default section structure (DCSM_Z1_ZoneSelectBlock.asm) and the linker command file (2837xD_dcsm_lnk_cpu1.cmd) I am a bit confused. 

I added the dcsm.c and dcsm.h to the project to make use of the unlock funtions. The only thing which confuses me is the DCSM_Z1_ZoneSelectBlock.asm. I am not sure which values are neccessary and need to be configured by me and what values I need to put there.

I understand that the Z1-CSMPSWD0 - Z1-CSMPSWD3 is used for the password to compare against CSMKEY.

The Z1-PSWDLOCK is for protecting the zone in the OTP.

But I am not quite sure what the Z1-LINKPOINTER1 - Z1-LINKPOINTER3 is used for nor the Z1-BOOTCTRL, Z1-EXEONLYRAM,Z1-EXEONLYSECT, Z1-GRABRAM,Z1-GRABSECT

Are they mandatory for the DCSM to work or are they just optional? 

What is the minimum configuration that is needed for locking the flash?

Thank you already!

Maks

  • Maks,

        You can find the answers in the TRM itself:

    I am not quite sure what the Z1-LINKPOINTER1 - Z1-LINKPOINTER3 is used for

    The location of the zone select region in OTP is decided based on the value of three 29-bit link pointers (Zx-LINKPOINTERx) programmed in the OTP of each zone of both CPU subsystems. Since the OTP cannot be erased/reprogrammed, we need to use a different Zone Select Block every time you need to update the password or make changes to the allocation of secure resources. The Linkpointers help in tracking the location of the new Zone Select Block. In the OTP, you can only make a 1 to 0, but not the other way round. If changes are made to the password or allocation of secure resources, the Zone select block must be updated by the user and also the link pointers.

     Z1-BOOTCTRL is described in page 414 of SPRUHM8I. All other registers you mention are explained in the same section (3.5.15)

    Are they mandatory for the DCSM to work or are they just optional? 

    If you don't configure those values in OTP, default values will be used. For GRABRAM & GRABSECT, this has the effect of leaving the resource unsecure. Likewise, the execute-only protection will be disabled for the flash sectors and RAM blocks.

  • Thank you so much Hareesh,

    I configured the DCSM_Z1_ZoneSelectBlock.asm like this:

          .sect "dcsm_otp_z1_linkpointer"
        .long 0x1FFFFFFF     ;Z1-LINKPOINTER1
        .long 0xFFFFFFFF     ;Reserved
        .long 0x1FFFFFFF     ;Z1-LINKPOINTER2
        .long 0xFFFFFFFF     ;Reserved
        .long 0x1FFFFFFF     ;Z1-LINKPOINTER3
        .long 0xFFFFFFFF     ;Reserved
    
          .sect "dcsm_otp_z1_pswdlock"
        .long 0xFFFF1111     ;Z1-PSWDLOCK
        .long 0xFFFFFFFF     ;Reserved
    
          .sect "dcsm_otp_z1_crclock"
        .long 0xFFFFFFFF     ;Z1-CRCLOCK
        .long 0xFFFFFFFF     ;Reserved
    
          .sect "dcsm_otp_z1_bootctrl"
        .long 0xFFFFFFFF     ;Reserved
        .long 0xFFFFFFFF     ;Z1-BOOTCTRL
    
          .sect "dcsm_zsel_z1"
    
        .long 0xFFFFFFFF      ;Z1-EXEONLYRAM
        .long 0xFFFFFFFF      ;Z1-EXEONLYSECT
        .long 0xFFFFFFFA      ;Z1-GRABRAM 		secure LS0 RAM and LS1 RAM
        .long 0xFFFFFFFA      ;Z1-GRABSECT 		secure Flash A and Flash B
    
        .long 0x11111111      ;Z1-CSMPSWD0 (LSW of 128-bit password)
        .long 0x22222222      ;Z1-CSMPSWD1
        .long 0x33333333      ;Z1-CSMPSWD2
        .long 0x44444444      ;Z1-CSMPSWD3 (MSW of 128-bit password)
    

    and I also removed the type = DSECT in the linker command file.

    I am still a little bit confused about this warning:

    ; ******************************WARNING***************************************
    ; It is recommended not to program 0xFFFFFFFF to user OTP locations, if users
    ; intend to comeback and re-program any of the bits to '0' in future. If user
    ; programs 0xFFFFFFFF to any of the OTP locations then the ECC locations would
    ; get programmed to a non erased state and users won't be able to comeback
    ; and re-program the OTP location to another value. Please refer to DCSM
    ; chapter of device TRM for more details on ECC for the locations in DCSM.


    I made the minimum configuration neccessary for my purpose which means that there are some values that I left on 0xFFFFFFFF. Is it better practice to not configure them at all and leave them on the reset value?

    Also does this mean that I wont be able to configure them after flashing it once?

    I didnt find any information about the ECC in the DCSM chapter in the TRM

    Thank you already! 

  • Let me go through your values and come up with an assessment.

    Also does this mean that I wont be able to configure them after flashing it once?

    No, you will be able to make changes after writing. Just that you won't be making changes to the same location. Recall you cannot erase/reprogram OTP.

    I didnt find any information about the ECC in the DCSM chapter in the TRM

    It is explained in the Flash chapter. See pages 113, 137, 140-150 in SPRUHM8I

  • Hi Hareesh, 

    I am sorry that i need to bother you again. 

    No, you will be able to make changes after writing. Just that you won't be making changes to the same location. Recall you cannot erase/reprogram OTP.

    I understood that it isnt reprogrammable but i didnt understand the warning that I shouldnt program a 0xFFFFFFFF value to any of the OTP locations. What if I didnt want to configure them and leave the default values? Do i just leave them commented so they wont get programmed? 

    I also updated my code after some research and implemented the WAIT BOOT MODE since I want to have access to the MCU with a debug probe.

          .sect "dcsm_otp_z1_linkpointer"
        .long 0x1FFFFFFF     ;Z1-LINKPOINTER1
        .long 0xFFFFFFFF     ;Reserved
        .long 0x1FFFFFFF     ;Z1-LINKPOINTER2
        .long 0xFFFFFFFF     ;Reserved
        .long 0x1FFFFFFF     ;Z1-LINKPOINTER3
        .long 0xFFFFFFFF     ;Reserved
    
          .sect "dcsm_otp_z1_pswdlock"
        .long 0xFFFF1111     ;Z1-PSWDLOCK
        .long 0xFFFFFFFF     ;Reserved
    
          .sect "dcsm_otp_z1_crclock"
        .long 0xFFFFFFFF     ;Z1-CRCLOCK
        .long 0xFFFFFFFF     ;Reserved
    
          .sect "dcsm_otp_z1_bootctrl"
        .long 0xFFFFFFFF     ;Reserved
        .long 0xFFFF025A     ;Z1-BOOTCTRL 		wait boot mode
    
          .sect "dcsm_zsel_z1"
    
        .long 0xFFFFFFFF      ;Z1-EXEONLYRAM
        .long 0xFFFFFFFF      ;Z1-EXEONLYSECT
        .long 0xFFFFFFFA      ;Z1-GRABRAM 		secure LS0 RAM and LS1 RAM
        .long 0xFFFFFFFA      ;Z1-GRABSECT 		secure Flash A and Flash B
    
        .long 0x11111111      ;Z1-CSMPSWD0 (LSW of 128-bit password)
        .long 0x22222222      ;Z1-CSMPSWD1
        .long 0x33333333      ;Z1-CSMPSWD2
        .long 0x44444444      ;Z1-CSMPSWD3 (MSW of 128-bit password)
     

    Heres what I want to achieve:

    • Using the first Zone Select Block selected by the Link Pointer
    • Lock the Password location in the OTP
    • CRCLOCK is default
    • Boot Mode is Wait Boot mode so I can use a debug probe to connect to the MCU
    • Execute only functionality is default
    • LS0 and LS1 RAM is secured 
    • Flash A and Flash B is secure
    • The 128bit password is set as seen

    Thank you!

    Maks

  • What if I didnt want to configure them and leave the default values? Do i just leave them commented so they wont get programmed? 

    Yes, leave them commented out.

    Have you used the security tool in SYSCONFIG? That should make your task very simple.