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.

LAUNCHXL-F280025C: LAUNCHXL-F280025C

Part Number: LAUNCHXL-F280025C
Other Parts Discussed in Thread: C2000WARE

Hi

I am using this example:

 C:\ti\c2000\C2000Ware_4_01_00_00\libraries\diagnostic\f28002x\examples\sdl_ex_dcsm_ffi

 

The problem I encounter is that when I reach to the function DCSM_secureZone1() (in main).

As you can see in the image below:

 

 

 

This function write to the address of the control register to the force secure bit. 

See image below:

 

static inline void
DCSM_secureZone1(void)
{
    //
    // Write to the FORCESEC bit.
    //
    HWREGH(DCSMBANK0_Z1_BASE + DCSM_O_Z1_CR)|= DCSM_Z1_CR_FORCESEC;
}

After this function executed and secure zone1 The program jump to interrupt below:

 

static void Interrupt_illegalOperationHandler(void)
{
    //
    // Something has gone wrong.  The CPU has tried to execute an illegal
    // instruction, generating an illegal instruction trap (ITRAP).
    ESTOP0;
    for(;;)
    {
        ;
    }
}

 

My question is why when I make the zone secure it will jump to this interrupt? The program didn’t try to change

Anything yet in the secure zone( the array). 

What am I missing here?

 

I tried to comment the ESTOP0 command and it doesn't matter, it always come back to this

Interrupt and I can't continue my debug no matter what I do.

 

Thanks

Yoav

  • Hi Yoav,

    Please expect a reply early next week from our expert.

    Thanks and regards,
    Vamsi

  • Hi,

    I will need to examine your security setting on this device. If you are ok, please share it here or send me the configuration via private message.

    Regards,

    Vivek Singh

  • Hi,

    I am not sure I understand what settings do you want.

    as I said, I am using this example:

    C:\ti\c2000\C2000Ware_4_01_00_00\libraries\diagnostic\f28002x\examples\sdl_ex_dcsm_ffi

    and I didn't change anything, just tried to debug it so you can see all the settings there.

    Thanks

    Yoav

  • I hope you referring to this:

    MEMORY
    {
       BEGIN            : origin = 0x080000, length = 0x000002
       BOOT_RSVD        : origin = 0x00000002, length = 0x00000126
       RAMM0            : origin = 0x00000128, length = 0x000002D8
       RAMM1            : origin = 0x00000400, length = 0x000003F8     /* on-chip RAM block M1 */
    // RAMM1_RSVD       : origin = 0x000007F8, length = 0x00000008 /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */
    
       RAMLS4           : origin = 0x0000A000, length = 0x00000800
       RAMLS5           : origin = 0x0000A800, length = 0x00000800
    /* RAMLS6           : origin = 0x0000B000, length = 0x00000800
       RAMLS7           : origin = 0x0000B800, length = 0x00000800*/
    
       /* Combining all the LS RAMs */
       RAMLS67          : origin = 0x0000B000, length = 0x00001000
       RAMGS0           : origin = 0x0000C000, length = 0x000007F8
    // RAMGS0_RSVD      : origin = 0x0000C7F8, length = 0x00000008 /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */
    
    
    //  FLASHBANK1       : origin = 0x00080000, length = 0x0000FFF0
    //  FLASH_BANK1_RSVD : origin = 0x0008FFF0, length = 0x00000010 /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */
       BOOTROM          : origin = 0x003F0000, length = 0x00008000
       BOOTROM_EXT      : origin = 0x003F8000, length = 0x00007FC0
       RESET            : origin = 0x003FFFC0, length = 0x00000002
       /* Flash sectors */
       /* BANK 0 */
       FLASH_BANK0_SEC0  : origin = 0x080002, length = 0x000FFE /* on-chip Flash */
       FLASH_BANK0_SEC1  : origin = 0x081000, length = 0x001000 /* on-chip Flash */
       FLASH_BANK0_SEC2  : origin = 0x082000, length = 0x001000 /* on-chip Flash */
       FLASH_BANK0_SEC3  : origin = 0x083000, length = 0x001000 /* on-chip Flash */
       FLASH_BANK0_SEC4  : origin = 0x084000, length = 0x001000 /* on-chip Flash */
       FLASH_BANK0_SEC5  : origin = 0x085000, length = 0x001000 /* on-chip Flash */
       FLASH_BANK0_SEC6  : origin = 0x086000, length = 0x001000 /* on-chip Flash */
       FLASH_BANK0_SEC7  : origin = 0x087000, length = 0x001000 /* on-chip Flash */
       FLASH_BANK0_SEC8  : origin = 0x088000, length = 0x001000 /* on-chip Flash */
       FLASH_BANK0_SEC9  : origin = 0x089000, length = 0x001000 /* on-chip Flash */
       FLASH_BANK0_SEC10 : origin = 0x08A000, length = 0x001000 /* on-chip Flash */
       FLASH_BANK0_SEC11 : origin = 0x08B000, length = 0x001000 /* on-chip Flash */
       FLASH_BANK0_SEC12 : origin = 0x08C000, length = 0x001000 /* on-chip Flash */
       FLASH_BANK0_SEC13 : origin = 0x08D000, length = 0x001000 /* on-chip Flash */
       FLASH_BANK0_SEC14 : origin = 0x08E000, length = 0x001000 /* on-chip Flash */
       FLASH_BANK0_SEC15 : origin = 0x08F000, length = 0x000FF0 /* on-chip Flash */
    // FLASH_BANK0_SEC15_RSVD     : origin = 0x08FFF0, length = 0x000010  /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */
    
    }
    
    
    SECTIONS
    {
       codestart        : > BEGIN, ALIGN(8)
       .text            : >> FLASH_BANK0_SEC2 | FLASH_BANK0_SEC3 | FLASH_BANK0_SEC4,   ALIGN(8)
       .cinit           : > FLASH_BANK0_SEC1,  ALIGN(8)
       .switch          : > FLASH_BANK0_SEC1,  ALIGN(8)
       .reset           : > RESET,                  TYPE = DSECT /* not used, */
    
       .stack           : > RAMM1
    
       .init_array      : > FLASH_BANK0_SEC1,  ALIGN(8)
       .bss             : > RAMLS67
       .bss:output      : > RAMLS67
       .bss:cio         : > RAMGS0
       .const           : > FLASH_BANK0_SEC1,  ALIGN(8)
       .data            : > RAMLS67
       .sysmem          : > RAMLS67
    
        ramgs0 : > RAMGS0
    
        /*  Allocate IQ math areas: */
       IQmath           : > RAMLS67
       IQmathTables     : > RAMLS67
    
      .TI.ramfunc      : LOAD = FLASH_BANK0_SEC1,
                      RUN = RAMGS0,
                      LOAD_START(RamfuncsLoadStart),
                      LOAD_SIZE(RamfuncsLoadSize),
                      LOAD_END(RamfuncsLoadEnd),
                      RUN_START(RamfuncsRunStart),
                      RUN_SIZE(RamfuncsRunSize),
                      RUN_END(RamfuncsRunEnd),
                      ALIGN(8)
    
       ZONE1_RAM        : > RAMLS4
       ZONE2_RAM        : > RAMLS5
       ZONE1_CODE       : > FLASH_BANK0_SEC5
       ZONE2_CODE       : > FLASH_BANK0_SEC6
    }
    

    or this:

    /*
     * This linker command file is to be included if user wants to use the DCSM
     * (Dual Zone Code Security Module) feature on the device. This linker command
     * file works as an addendum to the main Flash/RAM linker command file.
     * The sections in the dcsm.asm source file in this project are linked as per
     * the commands given in the file.
     *
     * This file was originally generated by the DCSM Tool and then edited to
     * remove sections not used by the sdl_ex_dcsm_ffi example. We strongly
     * recommend using this tool to generate the code for your DCSM configuration.
     * Refer to the following guide for more information:
     * http://www.ti.com/lit/pdf/spracp8
     *
     * Once users are confident that they want to program the passwords in OTP,
     * the DSECT section type can be removed.
     *
     */
    
    MEMORY
    {
    PAGE 0 :  /* Program Memory */
    
       /* Z1 OTP.  LinkPointers */
       DCSM_OTP_Z1_LINKPOINTER      : origin = 0x78000, length = 0x00000C
    
       /* DCSM Z1 Zone Select Contents (!!Movable!!) */
       /* Z1 OTP.  Z1 password locations / Flash and RAM partitioning */
       DCSM_ZSEL_Z1_P0              : origin = 0x78020, length = 0x000010
    
       /* Z2 OTP.  LinkPointers */
       DCSM_OTP_Z2_LINKPOINTER      : origin = 0x78200, length = 0x00000C
    
       /* DCSM Z1 Zone Select Contents (!!Movable!!) */
       /* Z2 OTP.  Z2 password locations / Flash and RAM partitioning  */
       DCSM_ZSEL_Z2_P0              : origin = 0x78220, length = 0x000010
    }
    
    SECTIONS
    {
       /* Remove the DSECT when you're ready to permanantly write to these
          sections. Make sure you've also uncommented the .asm file! */
       dcsm_otp_z1_linkpointer  : > DCSM_OTP_Z1_LINKPOINTER, PAGE = 0, type = DSECT
       dcsm_zsel_z1             : > DCSM_ZSEL_Z1_P0,         PAGE = 0, type = DSECT
    
       dcsm_otp_z2_linkpointer  : > DCSM_OTP_Z2_LINKPOINTER, PAGE = 0, type = DSECT
       dcsm_zsel_z2             : > DCSM_ZSEL_Z2_P0,         PAGE = 0, type = DSECT
    }
    
    /*
    //===========================================================================
    // End of file.
    //===========================================================================
    */
    

    Thanks

    Yoav

  • I see you still have the DSECT attribute in the dcsm.cmd file. Is your dcsm.asm file also still commented out? Please read the comment at the top of the sdl_ex_dcsm_ffi.c file to understand how to program the DCSM OTP. The example won't work properly until you've done so.

    Whitney

  • I did what you said, I uncommented the .asm file and commented the DESCT attribute at the .cmd file. still same problem.

    I noticec in the top of sdl_ex_dcsm_ffi.c file this comment:

    //! \note This example assumes you have not written to the DCSM OTP before and
    //! that the first zone select block is available for use. If this is not the
    //! case, you will need to update the link pointer, zone select block address,
    //! and passwords to use the next available zone select block.

    maybe that is my problem?

    Thanks

  • maybe that is my problem?

    That seems unlikely unless you know that you've programmed DCSM on your board before?

    If you open the DCSM registers in the Registers view in CCS, what status do you see for the memories used by the example?

    I tried reproducing this issue last week, but the example worked fine for me. I'll take another look at it today though. Do you mind sharing your .map file?

    Whitney

  • I still can't reproduce this issue. I have (expected) trouble if I try to single step into a secured function which makes sense, but DCSM_secureZone1() should be sitting in an unsecured Flash sector.

    The DCSM status registers should look like this for this example:

    Whitney

  • That seems unlikely unless you know that you've programmed DCSM on your board before?

    I don't think so either and if I did it unintentionally it will be the default configuration anyway because I didn't change anything.

    this is my .map file:

    ******************************************************************************
                 TMS320C2000 Linker PC v22.6.0                     
    ******************************************************************************
    >> Linked Mon Aug 15 16:13:51 2022
    
    OUTPUT FILE NAME:   <sdl_ex_dcsm_ffi.out>
    ENTRY POINT SYMBOL: "code_start"  address: 00080000
    
    
    MEMORY CONFIGURATION
    
             name            origin    length      used     unused   attr    fill
    ----------------------  --------  ---------  --------  --------  ----  --------
      BOOT_RSVD             00000002   00000126  00000000  00000126  RWIX
      RAMM0                 00000128   000002d8  00000000  000002d8  RWIX
      RAMM1                 00000400   000003f8  00000100  000002f8  RWIX
      RAMLS4                0000a000   00000800  00000100  00000700  RWIX
      RAMLS5                0000a800   00000800  00000100  00000700  RWIX
      RAMLS67               0000b000   00001000  0000000c  00000ff4  RWIX
      RAMGS0                0000c000   000007f8  0000012f  000006c9  RWIX
      DCSM_OTP_Z1_LINKPOINT 00078000   0000000c  00000000  0000000c  RWIX
      DCSM_ZSEL_Z1_P0       00078020   00000010  00000000  00000010  RWIX
      DCSM_OTP_Z2_LINKPOINT 00078200   0000000c  00000000  0000000c  RWIX
      DCSM_ZSEL_Z2_P0       00078220   00000010  00000000  00000010  RWIX
      BEGIN                 00080000   00000002  00000002  00000000  RWIX
      FLASH_BANK0_SEC0      00080002   00000ffe  00000000  00000ffe  RWIX
      FLASH_BANK0_SEC1      00081000   00001000  00000289  00000d77  RWIX
      FLASH_BANK0_SEC2      00082000   00001000  000007ec  00000814  RWIX
      FLASH_BANK0_SEC3      00083000   00001000  00000000  00001000  RWIX
      FLASH_BANK0_SEC4      00084000   00001000  00000000  00001000  RWIX
      FLASH_BANK0_SEC5      00085000   00001000  0000003d  00000fc3  RWIX
      FLASH_BANK0_SEC6      00086000   00001000  0000003e  00000fc2  RWIX
      FLASH_BANK0_SEC7      00087000   00001000  00000000  00001000  RWIX
      FLASH_BANK0_SEC8      00088000   00001000  00000000  00001000  RWIX
      FLASH_BANK0_SEC9      00089000   00001000  00000000  00001000  RWIX
      FLASH_BANK0_SEC10     0008a000   00001000  00000000  00001000  RWIX
      FLASH_BANK0_SEC11     0008b000   00001000  00000000  00001000  RWIX
      FLASH_BANK0_SEC12     0008c000   00001000  00000000  00001000  RWIX
      FLASH_BANK0_SEC13     0008d000   00001000  00000000  00001000  RWIX
      FLASH_BANK0_SEC14     0008e000   00001000  00000000  00001000  RWIX
      FLASH_BANK0_SEC15     0008f000   00000ff0  00000000  00000ff0  RWIX
      BOOTROM               003f0000   00008000  00000000  00008000  RWIX
      BOOTROM_EXT           003f8000   00007fc0  00000000  00007fc0  RWIX
      RESET                 003fffc0   00000002  00000000  00000002  RWIX
    
    
    SECTION ALLOCATION MAP
    
     output                                  attributes/
    section   page    origin      length       input sections
    --------  ----  ----------  ----------   ----------------
    dcsm_otp_z1_linkpointer 
    *          0    00078000    00000000     DSECT
    
    dcsm_zsel_z1 
    *          0    00078020    00000000     DSECT
    
    dcsm_otp_z2_linkpointer 
    *          0    00078200    00000000     DSECT
    
    dcsm_zsel_z2 
    *          0    00078220    00000000     DSECT
    
    codestart 
    *          0    00080000    00000002     
                      00080000    00000002     f28002x_codestartbranch.obj (codestart)
    
    .cinit     0    00081268    00000024     
                      00081268    0000000a     (.cinit..data.load) [load image, compression = lzss]
                      00081272    00000006     (__TI_handler_table)
                      00081278    00000004     (.cinit.ZONE1_RAM.load) [load image, compression = zero_init]
                      0008127c    00000004     (.cinit.ZONE2_RAM.load) [load image, compression = zero_init]
                      00081280    0000000c     (__TI_cinit_table)
    
    .reset     0    003fffc0    00000000     DSECT
    
    .stack     0    00000400    00000100     UNINITIALIZED
                      00000400    00000100     --HOLE--
    
    .init_array 
    *          0    00081000    00000000     UNINITIALIZED
    
    .data      0    0000b000    0000000c     UNINITIALIZED
                      0000b000    00000006     rts2800_fpu32_eabi.lib : exit.c.obj (.data)
                      0000b006    00000002                            : _lock.c.obj (.data:_lock)
                      0000b008    00000002                            : _lock.c.obj (.data:_unlock)
                      0000b00a    00000002     sdl_ex_dcsm_ffi.obj (.data)
    
    .const     0    00081000    00000136     
                      00081000    0000009b     driverlib.lib : flash.obj (.const:.string)
                      0008109b    00000001     --HOLE-- [fill = 0]
                      0008109c    0000009a                   : sysctl.obj (.const:.string)
    
    ZONE1_RAM 
    *          0    0000a000    00000100     UNINITIALIZED
                      0000a000    00000100     sdl_ex_dcsm_ffi.obj (ZONE1_RAM)
    
    ZONE2_RAM 
    *          0    0000a800    00000100     UNINITIALIZED
                      0000a800    00000100     sdl_ex_dcsm_ffi.obj (ZONE2_RAM)
    
    .TI.ramfunc 
    *          0    00081138    0000012f     RUN ADDR = 0000c000
                      00081138    0000003f     driverlib.lib : flash.obj (.TI.ramfunc:Flash_initModule)
                      00081177    0000002d                   : flash.obj (.TI.ramfunc:Flash_setBankPowerMode)
                      000811a4    00000024                   : flash.obj (.TI.ramfunc:Flash_setWaitstates)
                      000811c8    0000001e                   : flash.obj (.TI.ramfunc:Flash_setPumpPowerMode)
                      000811e6    0000001a                   : flash.obj (.TI.ramfunc:Flash_disableCache)
                      00081200    0000001a                   : flash.obj (.TI.ramfunc:Flash_disablePrefetch)
                      0008121a    00000019                   : flash.obj (.TI.ramfunc:Flash_enableCache)
                      00081233    00000019                   : flash.obj (.TI.ramfunc:Flash_enablePrefetch)
                      0008124c    00000017                   : flash.obj (.TI.ramfunc:Flash_enableECC)
                      00081263    00000004                   : sysctl.obj (.TI.ramfunc)
    
    ZONE1_CODE 
    *          0    00085000    0000003d     
                      00085000    00000017     sdl_ex_dcsm_ffi.obj (ZONE1_CODE:checkArray1)
                      00085017    00000016     sdl_ex_dcsm_ffi.obj (ZONE1_CODE:secureFunction1)
                      0008502d    00000010     sdl_ex_dcsm_ffi.obj (ZONE1_CODE:initArray1)
    
    ZONE2_CODE 
    *          0    00086000    0000003e     
                      00086000    00000017     sdl_ex_dcsm_ffi.obj (ZONE2_CODE:checkArray2)
                      00086017    00000016     sdl_ex_dcsm_ffi.obj (ZONE2_CODE:secureFunction2)
                      0008602d    00000011     sdl_ex_dcsm_ffi.obj (ZONE2_CODE:initArray2)
    
    .text      0    00082000    000007ec     
                      00082000    00000133     driverlib.lib : sysctl.obj (.text:SysCtl_setClock)
                      00082133    000000fe                   : sysctl.obj (.text:SysCtl_isPLLValid)
                      00082231    0000009a     device.obj (.text:Device_enableAllPeripherals)
                      000822cb    00000088     rts2800_fpu32_eabi.lib : fs_div28.asm.obj (.text)
                      00082353    0000007a     driverlib.lib : sysctl.obj (.text:DCC_setCounterSeeds)
                      000823cd    00000043                   : sysctl.obj (.text:SysCtl_selectOscSource)
                      00082410    00000041     sdl_ex_dcsm_ffi.obj (.text:main)
                      00082451    0000003d     driverlib.lib : interrupt.obj (.text:Interrupt_initModule)
                      0008248e    0000002e     rts2800_fpu32_eabi.lib : copy_decompress_lzss.c.obj (.text:decompress:lzss)
                      000824bc    0000002b     driverlib.lib : sysctl.obj (.text:SysCtl_selectXTAL)
                      000824e7    0000002b     rts2800_fpu32_eabi.lib : autoinit.c.obj (.text:__TI_auto_init_nobinit_nopinit)
                      00082512    00000029                            : exit.c.obj (.text)
                      0008253b    00000026     driverlib.lib : sysctl.obj (.text:SysCtl_pollX1Counter)
                      00082561    00000025                   : sysctl.obj (.text:DCC_enableSingleShotMode)
                      00082586    00000024     device.obj (.text:Device_init)
                      000825aa    0000001f     driverlib.lib : sysctl.obj (.text:DCC_setCounter0ClkSource)
                      000825c9    0000001f                   : sysctl.obj (.text:DCC_setCounter1ClkSource)
                      000825e8    0000001e                   : interrupt.obj (.text:Interrupt_initVectorTable)
                      00082606    0000001d     rts2800_fpu32_eabi.lib : memcpy.c.obj (.text)
                      00082623    0000001a     driverlib.lib : sysctl.obj (.text:SysCtl_selectXTALSingleEnded)
                      0008263d    00000017                   : sysctl.obj (.text:DCC_disableDoneSignal)
                      00082654    00000017     device.obj (.text:SysCtl_enablePeripheral)
                      0008266b    00000017     driverlib.lib : sysctl.obj (.text:SysCtl_enablePeripheral)
                      00082682    00000017     rts2800_fpu32_eabi.lib : boot28.asm.obj (.text)
                      00082699    00000016     driverlib.lib : sysctl.obj (.text:DCC_clearDoneFlag)
                      000826af    00000016                   : sysctl.obj (.text:DCC_clearErrorFlag)
                      000826c5    00000016                   : sysctl.obj (.text:DCC_disableErrorSignal)
                      000826db    00000016     sdl_ex_dcsm_ffi.obj (.text:unsecureFunction)
                      000826f1    00000015     driverlib.lib : sysctl.obj (.text:DCC_isBaseValid)
                      00082706    00000014                   : sysctl.obj (.text:DCC_disableModule)
                      0008271a    00000014                   : sysctl.obj (.text:DCC_enableModule)
                      0008272e    00000010                   : flash.obj (.text:Flash_isCtrlBaseValid)
                      0008273e    00000010                   : flash.obj (.text:Flash_isECCBaseValid)
                      0008274e    0000000e                   : interrupt.obj (.text:Interrupt_defaultHandler)
                      0008275c    0000000d                   : interrupt.obj (.text:Interrupt_disableMaster)
                      00082769    0000000d     device.obj (.text:SysCtl_setLowSpeedClock)
                      00082776    0000000d     rts2800_fpu32_eabi.lib : copy_zero_init.c.obj (.text:decompress:ZI:__TI_zero_init_nomemset)
                      00082783    0000000c     driverlib.lib : sysctl.obj (.text:SysCtl_setPLLSysClk)
                      0008278f    0000000c     rts2800_fpu32_eabi.lib : args_main.c.obj (.text)
                      0008279b    0000000b     driverlib.lib : sysctl.obj (.text:SysCtl_isMCDClockFailureDetected)
                      000827a6    00000009     sdl_ex_dcsm_ffi.obj (.text:DCSM_secureZone1)
                      000827af    00000009     rts2800_fpu32_eabi.lib : _lock.c.obj (.text)
                      000827b8    00000008     device.obj (.text:SysCtl_disableWatchdog)
                      000827c0    00000008     rts2800_fpu32_eabi.lib : copy_decompress_none.c.obj (.text:decompress:none)
                      000827c8    00000008     f28002x_codestartbranch.obj (.text)
                      000827d0    00000007     device.obj (.text:ASysCtl_lockVREG)
                      000827d7    00000007     driverlib.lib : sysctl.obj (.text:SysCtl_resetMCD)
                      000827de    00000007     device.obj (.text:__error__)
                      000827e5    00000002     driverlib.lib : interrupt.obj (.text:Interrupt_illegalOperationHandler)
                      000827e7    00000002                   : interrupt.obj (.text:Interrupt_nmiHandler)
                      000827e9    00000002     rts2800_fpu32_eabi.lib : pre_init.c.obj (.text)
                      000827eb    00000001                            : startup.c.obj (.text)
    
    MODULE SUMMARY
    
           Module                        code   ro data   rw data
           ------                        ----   -------   -------
        .\
           sdl_ex_dcsm_ffi.obj           219    0         514    
        +--+-----------------------------+------+---------+---------+
           Total:                        219    0         514    
                                                                 
        .\device\
           device.obj                    248    0         0      
           f28002x_codestartbranch.obj   10     0         0      
        +--+-----------------------------+------+---------+---------+
           Total:                        258    0         0      
                                                                 
        C:/ti/c2000/C2000Ware_4_01_00_00/driverlib/f28002x/driverlib/ccs/Debug/driverlib.lib
           sysctl.obj                    1167   154       0      
           flash.obj                     630    155       0      
           interrupt.obj                 122    0         0      
        +--+-----------------------------+------+---------+---------+
           Total:                        1919   309       0      
                                                                 
        C:\ti\ccs1200\ccs\tools\compiler\ti-cgt-c2000_22.6.0.LTS\lib\rts2800_fpu32_eabi.lib
           fs_div28.asm.obj              136    0         0      
           exit.c.obj                    41     0         6      
           copy_decompress_lzss.c.obj    46     0         0      
           autoinit.c.obj                43     0         0      
           memcpy.c.obj                  29     0         0      
           boot28.asm.obj                23     0         0      
           _lock.c.obj                   9      0         4      
           copy_zero_init.c.obj          13     0         0      
           args_main.c.obj               12     0         0      
           copy_decompress_none.c.obj    8      0         0      
           pre_init.c.obj                2      0         0      
           startup.c.obj                 1      0         0      
        +--+-----------------------------+------+---------+---------+
           Total:                        363    0         10     
                                                                 
           Stack:                        0      0         256    
           Linker Generated:             0      36        0      
        +--+-----------------------------+------+---------+---------+
           Grand Total:                  2759   345       780    
    
    
    LINKER GENERATED COPY TABLES
    
    __TI_cinit_table @ 00081280 records: 3, size/record: 4, table size: 12
    	.data: load addr=00081268, load size=0000000a bytes, run addr=0000b000, run size=0000000c bytes, compression=lzss
    	ZONE1_RAM: load addr=00081278, load size=00000004 bytes, run addr=0000a000, run size=00000100 bytes, compression=zero_init
    	ZONE2_RAM: load addr=0008127c, load size=00000004 bytes, run addr=0000a800, run size=00000100 bytes, compression=zero_init
    
    
    LINKER GENERATED HANDLER TABLE
    
    __TI_handler_table @ 00081272 records: 3, size/record: 2, table size: 6
    	index: 0, handler: __TI_decompress_lzss
    	index: 1, handler: __TI_decompress_none
    	index: 2, handler: __TI_zero_init
    
    
    GLOBAL DATA SYMBOLS: SORTED BY DATA PAGE
    
    address     data page           name
    --------    ----------------    ----
    00000400      10 (00000400)     __stack
    
    0000a000     280 (0000a000)     zone1LockedArray
    
    0000a800     2a0 (0000a800)     zone2LockedArray
    
    0000b000     2c0 (0000b000)     __TI_enable_exit_profile_output
    0000b002     2c0 (0000b000)     __TI_cleanup_ptr
    0000b004     2c0 (0000b000)     __TI_dtors_ptr
    0000b006     2c0 (0000b000)     _lock
    0000b008     2c0 (0000b000)     _unlock
    0000b00a     2c0 (0000b000)     result
    
    
    GLOBAL SYMBOLS: SORTED ALPHABETICALLY BY Name 
    
    page  address   name                           
    ----  -------   ----                           
    0     00082512  C$$EXIT                        
    0     00082231  Device_enableAllPeripherals    
    0     00082586  Device_init                    
    0     0000c000  Flash_initModule               
    0     00082451  Interrupt_initModule           
    0     000825e8  Interrupt_initVectorTable      
    0     00081267  RamfuncsLoadEnd                
    abs   0000012f  RamfuncsLoadSize               
    0     00081138  RamfuncsLoadStart              
    0     0000c12f  RamfuncsRunEnd                 
    abs   0000012f  RamfuncsRunSize                
    0     0000c000  RamfuncsRunStart               
    0     0000c12b  SysCtl_delay                   
    0     00082133  SysCtl_isPLLValid              
    0     000823cd  SysCtl_selectOscSource         
    0     000824bc  SysCtl_selectXTAL              
    0     00082623  SysCtl_selectXTALSingleEnded   
    0     00082000  SysCtl_setClock                
    0     00081280  __TI_CINIT_Base                
    0     0008128c  __TI_CINIT_Limit               
    0     0008128c  __TI_CINIT_Warm                
    0     00081272  __TI_Handler_Table_Base        
    0     00081278  __TI_Handler_Table_Limit       
    0     00000500  __TI_STACK_END                 
    abs   00000100  __TI_STACK_SIZE                
    0     000824e7  __TI_auto_init_nobinit_nopinit 
    0     0000b002  __TI_cleanup_ptr               
    0     0008248e  __TI_decompress_lzss           
    0     000827c0  __TI_decompress_none           
    0     0000b004  __TI_dtors_ptr                 
    0     0000b000  __TI_enable_exit_profile_output
    abs   ffffffff  __TI_pprof_out_hndl            
    abs   ffffffff  __TI_prof_data_size            
    abs   ffffffff  __TI_prof_data_start           
    0     00082776  __TI_zero_init_nomemset        
    0     000822cb  __c28xabi_divf                 
    n/a   UNDEFED   __c_args__                     
    0     000827de  __error__                      
    0     00000400  __stack                        
    0     0008278f  _args_main                     
    0     00082682  _c_int00                       
    0     0000b006  _lock                          
    0     000827b7  _nop                           
    0     000827b3  _register_lock                 
    0     000827af  _register_unlock               
    0     000827eb  _system_post_cinit             
    0     000827e9  _system_pre_init               
    0     0000b008  _unlock                        
    0     00082512  abort                          
    0     00085000  checkArray1                    
    0     00086000  checkArray2                    
    0     00080000  code_start                     
    0     00082514  exit                           
    0     0008502d  initArray1                     
    0     0008602d  initArray2                     
    0     00082410  main                           
    0     00082606  memcpy                         
    0     0000b00a  result                         
    0     00085017  secureFunction1                
    0     00086017  secureFunction2                
    0     000826db  unsecureFunction               
    0     0000a000  zone1LockedArray               
    0     0000a800  zone2LockedArray               
    
    
    GLOBAL SYMBOLS: SORTED BY Symbol Address 
    
    page  address   name                           
    ----  -------   ----                           
    0     00000400  __stack                        
    0     00000500  __TI_STACK_END                 
    0     0000a000  zone1LockedArray               
    0     0000a800  zone2LockedArray               
    0     0000b000  __TI_enable_exit_profile_output
    0     0000b002  __TI_cleanup_ptr               
    0     0000b004  __TI_dtors_ptr                 
    0     0000b006  _lock                          
    0     0000b008  _unlock                        
    0     0000b00a  result                         
    0     0000c000  Flash_initModule               
    0     0000c000  RamfuncsRunStart               
    0     0000c12b  SysCtl_delay                   
    0     0000c12f  RamfuncsRunEnd                 
    0     00080000  code_start                     
    0     00081138  RamfuncsLoadStart              
    0     00081267  RamfuncsLoadEnd                
    0     00081272  __TI_Handler_Table_Base        
    0     00081278  __TI_Handler_Table_Limit       
    0     00081280  __TI_CINIT_Base                
    0     0008128c  __TI_CINIT_Limit               
    0     0008128c  __TI_CINIT_Warm                
    0     00082000  SysCtl_setClock                
    0     00082133  SysCtl_isPLLValid              
    0     00082231  Device_enableAllPeripherals    
    0     000822cb  __c28xabi_divf                 
    0     000823cd  SysCtl_selectOscSource         
    0     00082410  main                           
    0     00082451  Interrupt_initModule           
    0     0008248e  __TI_decompress_lzss           
    0     000824bc  SysCtl_selectXTAL              
    0     000824e7  __TI_auto_init_nobinit_nopinit 
    0     00082512  C$$EXIT                        
    0     00082512  abort                          
    0     00082514  exit                           
    0     00082586  Device_init                    
    0     000825e8  Interrupt_initVectorTable      
    0     00082606  memcpy                         
    0     00082623  SysCtl_selectXTALSingleEnded   
    0     00082682  _c_int00                       
    0     000826db  unsecureFunction               
    0     00082776  __TI_zero_init_nomemset        
    0     0008278f  _args_main                     
    0     000827af  _register_unlock               
    0     000827b3  _register_lock                 
    0     000827b7  _nop                           
    0     000827c0  __TI_decompress_none           
    0     000827de  __error__                      
    0     000827e9  _system_pre_init               
    0     000827eb  _system_post_cinit             
    0     00085000  checkArray1                    
    0     00085017  secureFunction1                
    0     0008502d  initArray1                     
    0     00086000  checkArray2                    
    0     00086017  secureFunction2                
    0     0008602d  initArray2                     
    abs   00000100  __TI_STACK_SIZE                
    abs   0000012f  RamfuncsLoadSize               
    abs   0000012f  RamfuncsRunSize                
    abs   ffffffff  __TI_pprof_out_hndl            
    abs   ffffffff  __TI_prof_data_size            
    abs   ffffffff  __TI_prof_data_start           
    n/a   UNDEFED   __c_args__                     
    
    [63 symbols]
    

     Thanks

  • The .map file still says DSECT for the dcsm_otp_z1_linkpointer, dcsm_zsel_z1, etc... sections. You said you removed type = DSECT from your .cmd file though, right?

    Whitney

  • Hi 

    well when I remove the type = DESCT and uncomment the .asm file like this:

    cmd:

    /*
     * This linker command file is to be included if user wants to use the DCSM
     * (Dual Zone Code Security Module) feature on the device. This linker command
     * file works as an addendum to the main Flash/RAM linker command file.
     * The sections in the dcsm.asm source file in this project are linked as per
     * the commands given in the file.
     *
     * This file was originally generated by the DCSM Tool and then edited to
     * remove sections not used by the sdl_ex_dcsm_ffi example. We strongly
     * recommend using this tool to generate the code for your DCSM configuration.
     * Refer to the following guide for more information:
     * http://www.ti.com/lit/pdf/spracp8
     *
     * Once users are confident that they want to program the passwords in OTP,
     * the DSECT section type can be removed.
     *
     */
    
    MEMORY
    {
    PAGE 0 :  /* Program Memory */
    
       /* Z1 OTP.  LinkPointers */
       DCSM_OTP_Z1_LINKPOINTER      : origin = 0x78000, length = 0x00000C
    
       /* DCSM Z1 Zone Select Contents (!!Movable!!) */
       /* Z1 OTP.  Z1 password locations / Flash and RAM partitioning */
       DCSM_ZSEL_Z1_P0              : origin = 0x78020, length = 0x000010
    
       /* Z2 OTP.  LinkPointers */
       DCSM_OTP_Z2_LINKPOINTER      : origin = 0x78200, length = 0x00000C
    
       /* DCSM Z1 Zone Select Contents (!!Movable!!) */
       /* Z2 OTP.  Z2 password locations / Flash and RAM partitioning  */
       DCSM_ZSEL_Z2_P0              : origin = 0x78220, length = 0x000010
    }
    
    SECTIONS
    {
       /* Remove the DSECT when you're ready to permanantly write to these
          sections. Make sure you've also uncommented the .asm file! */
       dcsm_otp_z1_linkpointer  : > DCSM_OTP_Z1_LINKPOINTER, PAGE = 0
       dcsm_zsel_z1             : > DCSM_ZSEL_Z1_P0,         PAGE = 0
    
       dcsm_otp_z2_linkpointer  : > DCSM_OTP_Z2_LINKPOINTER, PAGE = 0
       dcsm_zsel_z2             : > DCSM_ZSEL_Z2_P0,         PAGE = 0
    }

    asm:

    ;;//###########################################################################
    ;;//
    ;;// FILE:  f28002x_dcsm.asm
    ;;//
    ;;//###########################################################################
    ;;//
    ;;// This file was originally generated by the DCSM Tool and then edited to
    ;;// remove sections not used by the sdl_ex_dcsm_ffi example. We strongly
    ;;// recommend using this tool to generate the code for your DCSM configuration.
    ;;// Refer to the following guide for more information:
    ;;// http://www.ti.com/lit/pdf/spracp8
    ;;//
    ;;//###########################################################################
    ;;// $TI Release: C2000 Diagnostic Library v3.00.00 $
    ;;// $Release Date: Thu Mar  3 16:52:56 IST 2022 $
    ;;// $Copyright:
    ;// Copyright (C) 2022 Texas Instruments Incorporated - http://www.ti.com/
    ;//
    ;// Redistribution and use in source and binary forms, with or without 
    ;// modification, are permitted provided that the following conditions 
    ;// are met:
    ;// 
    ;//   Redistributions of source code must retain the above copyright 
    ;//   notice, this list of conditions and the following disclaimer.
    ;// 
    ;//   Redistributions in binary form must reproduce the above copyright
    ;//   notice, this list of conditions and the following disclaimer in the 
    ;//   documentation and/or other materials provided with the   
    ;//   distribution.
    ;// 
    ;//   Neither the name of Texas Instruments Incorporated nor the names of
    ;//   its contributors may be used to endorse or promote products derived
    ;//   from this software without specific prior written permission.
    ;// 
    ;// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
    ;// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
    ;// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    ;// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
    ;// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
    ;// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
    ;// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    ;// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    ;// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
    ;// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
    ;// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    ;// $
    ;;//###########################################################################
    
    ;----------------------------------------------------------------------
    ; Zone 1
    ;----------------------------------------------------------------------
        .sect "dcsm_otp_z1_linkpointer"
         .retain
          .long 0x1FFFFFFF
          .long 0xFFFFFFFF     ; Reserved
          .long 0x1FFFFFFF
          .long 0xFFFFFFFF     ; Reserved
          .long 0x1FFFFFFF
          .long 0xFFFFFFFF     ; Reserved
    
        .sect "dcsm_zsel_z1"
         .retain
          .long 0x000000F0       ; Z1-EXEONLYRAM
          .long 0x0000FFFF      ; Z1-EXEONLYSECT
          .long 0x0000A900          ; Z1-GRABRAM - Secure only LS4 in Z1
          .long 0xAAAAA6AA         ; Z1-GRABSECT - Secure only B0 SECT 5
    
          .long 0xFFFFFFFF
          .long 0x47FFFFFF
          .long 0xFFFFFFFF
          .long 0xFFFFFFFF
    
    ;----------------------------------------------------------------------
    ; Zone 2
    ;----------------------------------------------------------------------
        .sect "dcsm_otp_z2_linkpointer"
         .retain
          .long 0x1FFFFFFF
          .long 0xFFFFFFFF     ; Reserved
          .long 0x1FFFFFFF
          .long 0xFFFFFFFF     ; Reserved
          .long 0x1FFFFFFF
          .long 0xFFFFFFFF     ; Reserved
    
        .sect "dcsm_zsel_z2"
         .retain
          .long 0x000000F0       ; Z2-EXEONLYRAM
          .long 0x0000FFFF      ; Z2-EXEONLYSECT
          .long 0x0000A600          ; Z2-GRABRAM - Secure only LS5 in Z2
          .long 0xAAAA9AAA         ; Z2-GRABSECT - Secure only B0 SECT6
    
          .long 0xFFFFFFFF
          .long 0xE3FFFFFF
          .long 0xFFFFFFFF
          .long 0xFFFFFFFF
    
    ;----------------------------------------------------------------------
    ; End of file
    ;----------------------------------------------------------------------
    
    

    i get this now:

    RAM initialization done

    C28xx_CPU1: GEL Output:
    Memory Map Initialization Complete
    C28xx_CPU1: GEL Output: ... DCSM Initialization Start ...
    C28xx_CPU1: GEL Output: ... DCSM Initialization Done ...
    C28xx_CPU1: GEL Output: ... DCSM Initialization Start ...
    C28xx_CPU1: GEL Output: ... DCSM Initialization Done ...
    C28xx_CPU1: GEL Output: ... DCSM Initialization Start ...
    C28xx_CPU1: GEL Output: ... DCSM Initialization Done ...
    C28xx_CPU1: Error during Flash Programming. Address 0x00078020, FMSTAT (STATCMD on some devices) 0x00000030
    C28xx_CPU1: File Loader: Memory write failed: Unknown error
    C28xx_CPU1: GEL: File: C:\Users\yoav.karmi\workspace_v12\secureZone\sdl_ex_dcsm_ffi\FLASH\sdl_ex_dcsm_ffi.out: Load failed.

  • Ok some good news.

    when I comment back the section of zone1 in the .asm file the program works for zone2 and it can be secured. zone1 remains unsecure because I also commented the DCSM_secureZone1() function.

    now I need to understand what happened to zone1

    Thanks

  • As we saw in call today, the zone1 settings are not getting loaded properly. Look like there is some issue with device. I would suggest to try another device and try it.

    Regards,

    Vivek Singh

  • Hi Vivek, Whitney

    See customer reply:

    I have some more questions if you can help me:

    1. Can I defined  timer interrupt in the secure zone?
    2. I have this problem:

    what does that mean?

    Thanks

  • Hi

    Is this from same customer ? 

    Customer should be able for put ISR in secure zone. Does the error message comes up when running the ISR from secure zone ? Error message may be related to device going into reset cycle. They can check the XRSn pin.

    Regards,

    Vivek Singh

  • Hi

    another thing I encountered:

    I have a secure function with local variable inside the function. I have unsecure interrupt who try to change this local variable via address. I can see that it can change the variable.

    Is that normal? If I look at the address of the local variable inside the secure function I can see that the address is not in the secure zone. 

    my next question is can I secure local variable in a secure function?

    Thanks

    Yoav

  • Hi,

    I have a secure function with local variable inside the function. I have unsecure interrupt who try to change this local variable via address. I can see that it can change the variable.

    Variable goes into stack and if stack region is not secure then yes, any unsecure code will be able to update the variables.

    my next question is can I secure local variable in a secure function?

    Thanks

    This is  a compiler question and I'll have to refer to our compiler team for this.

    Regrads,

    Vivek Singh  

  • can I secure local variable in a secure function?

    Unfortunately, my understanding of the security features of C28x devices is not very good.  Rather than addressing this question directly, I think it is better if I discuss, in a general manner, how local variables are allocated to memory.

    By default, local variables are allocated either on the stack, or in a register.  There is no method to control which of those two are used.

    If that is not good enough, then consider static variables.  Static variables have the same scope as local variables.  But they persist between calls.  They are allocated permanent addresses in a section just like global variables.  Thus, you can control which section they are in.  If you build with the newer EABI, you can even control the exact address.

    Based on my limited understanding, I think static variables are a practical solution.  Do you agree?

    Thanks and regards,

    -George