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.

TMS320F280025: running a program with DCSM tool from RAM

Part Number: TMS320F280025


Hi

I have a program with DCSM tool activated only on zone 1. at the beginning my program booted from flash and i copied some parts to the ram and everything worked fine.

the demands as changed and i need to run all the program from RAM. the problem is when i use a ram linker file and connect to the debugger, the program wont reach to main.

I noticed that when i exclude the file "dcsm.asm" the program runs with the debugger and everything works fine.

dcsm.asm:

 

;----------------------------------------------------------------------
; 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_otp_z1_pswdlock"
      .retain
      .long 0xFB7FFFFF
      .long 0x7FFFFFFF     ;Reserved
      
     .sect "dcsm_otp_z1_crclock"
      .retain
      .long 0x4BFFFFFF
      .long 0x3FFFFFFF     ;Reserved
   
;;     .sect "dcsm_otp_z1_gpreg"
;;      .retain
;;      .long 0x5AFF1820     ;Z1OTP_BOOTPIN_CONFIG
;;      .long 0x5AFFFFff     ;Z1OTP_GPREG2
;;     .sect "dcsm_otp_z1_bootctrl"
;;      .retain
;;      .long 0x00000000     ;Z1OTP_BOOTDEF_LOW
;;      .long 0xFFFFFFFF     ;Z1OTP_BOOTDEF_HIGH
      
     .sect "dcsm_zsel_z1"
      .retain
      .long 0x000000F0       ;Z1-EXEONLYRAM
      .long 0x0000FFFF      ;Z1-EXEONLYSECT
      .long 0x0000A600          ;Z1-GRABRAM
      .long 0xAAAA96AA         ;Z1-GRABSECT
      
      .long 0x12345678
      .long 0x47FFFFFF
      .long 0x12345678
      .long 0xFFFFFFFF


;----------------------------------------------------------------------

; For code security operation,after development has completed, prior to
; production, all other zone select block locations should be programmed
; to 0x0000 for maximum security.        
; If the first zone select block at offset 0x10 is used, the section 
; "dcsm_rsvd_z1" can be used to program these locations to 0x0000.
; This code is commented out for development.

;       .sect "dcsm_rsvd_z1"
;        .loop (1e0h)
;              .int 0x0000
;        .endloop


;----------------------------------------------------------------------
; 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_otp_z2_pswdlock"
;;      .retain
;;      .long 0xBF7FFFFF
;;      .long 0x77FFFFFF     ;Reserved
;;      
;;     .sect "dcsm_otp_z2_crclock"
;;      .retain
;;      .long 0x0FFFFFFF
;;      .long 0x37FFFFFF     ;Reserved
;;            
;;     .sect "dcsm_otp_z2_gpreg"
;;      .retain
;;      .long 0x5AFF1820     ;Z2OTP_BOOTPIN_CONFIG
;;      .long 0x5AFFFFff     ;Z2OTP_GPREG2
;;     .sect "dcsm_otp_z2_bootctrl"
;;      .retain
;;      .long 0x00000000     ;Z2OTP_BOOTDEF_LOW
;;      .long 0xFFFFFFFF     ;Z2OTP_BOOTDEF_HIGH
;;      
;;     .sect "dcsm_zsel_z2"
;;      .retain
;;      .long 0x000000F0       ;z2-EXEONLYRAM
;;      .long 0x0000FFFF      ;z2-EXEONLYSECT
;;      .long 0x0000AA00          ;z2-GRABRAM
;;      .long 0xAAAAAAAA         ;z2-GRABSECT
;;      
;;      .long 0xFFFFFFFF
;;      .long 0xE3FFFFFF
;;      .long 0xFFFFFFFF
;;      .long 0xFFFFFFFF


;----------------------------------------------------------------------

; For code security operation,after development has completed, prior to
; production, all other zone select block locations should be programmed
; to 0x0000 for maximum security.        
; If the first zone select block at offset 0x10 is used, the section 
; "dcsm_rsvd_z2" can be used to program these locations to 0x0000.
; This code is commented out for development.

;       .sect "dcsm_rsvd_z2"
;        .loop (1e0h)
;              .int 0x0000
;        .endloop


;----------------------------------------------------------------------
; End of file
;----------------------------------------------------------------------

linker file:

MEMORY
{
   BEGIN           	: origin = 0x000000, 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 */
   //RAMLS4567        : origin = 0x0000A000, length = 0x00002000
   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" */

   RESET            : origin = 0x003FFFC0, length = 0x00000002

   // FLASHBANK1       : origin = 0x00080000, length = 0x00010000
   /* Flash sectors */
   /* BANK 0 */
   FLASH_BANK0_SEC0  : origin = 0x080002, length = 0x000FFE
   FLASH_BANK0_SEC1  : origin = 0x081000, length = 0x001000
   FLASH_BANK0_SEC2  : origin = 0x082000, length = 0x001000
   FLASH_BANK0_SEC3  : origin = 0x083000, length = 0x001000
   FLASH_BANK0_SEC4  : origin = 0x084000, length = 0x001000
   FLASH_BANK0_SEC5  : origin = 0x085000, length = 0x001000
   FLASH_BANK0_SEC6  : origin = 0x086000, length = 0x001000
   FLASH_BANK0_SEC7  : origin = 0x087000, length = 0x001000
   FLASH_BANK0_SEC8  : origin = 0x088000, length = 0x001000
   FLASH_BANK0_SEC9  : origin = 0x089000, length = 0x001000
   FLASH_BANK0_SEC10 : origin = 0x08A000, length = 0x001000
   FLASH_BANK0_SEC11 : origin = 0x08B000, length = 0x001000
   FLASH_BANK0_SEC12 : origin = 0x08C000, length = 0x001000
   FLASH_BANK0_SEC13 : origin = 0x08D000, length = 0x001000
   FLASH_BANK0_SEC14 : origin = 0x08E000, length = 0x001000
   FLASH_BANK0_SEC15 : origin = 0x08F000, length = 0x000FF8
// 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" */

   BOOTROM          : origin = 0x003F0000, length = 0x00008000
   BOOTROM_EXT      : origin = 0x003F8000, length = 0x00007FC0


   PAGE 0 :  /* Program Memory */

   /* Z1 OTP.  LinkPointers */
   DCSM_OTP_Z1_LINKPOINTER   : origin = 0x78000, length = 0x00000C
   /* Z1 OTP.  GPREG1/GPREG2 */
   DCSM_OTP_Z1_GPREG         : origin = 0x7800C, length = 0x000004
   /* Z1 OTP.  PSWDLOCK/RESERVED */
   DCSM_OTP_Z1_PSWDLOCK	    : origin = 0x78010, length = 0x000004
   /* Z1 OTP.  CRCLOCK/RESERVED */
   DCSM_OTP_Z1_CRCLOCK	    : origin = 0x78014, length = 0x000004
   /* Z1 OTP.  RESERVED/BOOTCTRL */
   DCSM_OTP_Z1_BOOTCTRL	    : origin = 0x7801C, length = 0x000004

   /* 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
   /* Z2 OTP.  GPREG1/GPREG2 */
   DCSM_OTP_Z2_GPREG	        : origin = 0x7820C, length = 0x000004
   /* Z2 OTP.  PSWDLOCK/RESERVED */
   DCSM_OTP_Z2_PSWDLOCK	    : origin = 0x78210, length = 0x000004
   /* Z2 OTP.  CRCLOCK/RESERVED */
   DCSM_OTP_Z2_CRCLOCK	    : origin = 0x78214, length = 0x000004
   /* Z2 OTP.  GPREG3/BOOTCTRL */
   DCSM_OTP_Z2_BOOTCTRL	    : origin = 0x7821C, length = 0x000004

   /* DCSM Z2 Zone Select Contents (!!Movable!!) */
   /* Z2 OTP.  Z2 password locations / Flash and RAM partitioning  */
   DCSM_ZSEL_Z2_P0	        : origin = 0x78220, length = 0x000010
}


SECTIONS
{
   .text            : >> RAMLS4 | RAMLS6 | RAMLS7 | RAMGS0
   .TI.ramfunc      : > RAMM0
   .cinit           : > RAMM0
   .switch          : > RAMM0
   .reset           : > RESET,                  TYPE = DSECT /* not used, */
   .cio             : > RAMGS0
   codestart        : > BEGIN

   .stack           : > RAMM1
#if defined(__TI_EABI__)
   .bss             : > RAMLS4 | RAMLS6 | RAMLS7
   .bss:output      : > RAMLS4 | RAMLS6 | RAMLS7
   .init_array      : > RAMM0
   .const           : > RAMGS0
   .data            : > RAMLS4 | RAMLS6 | RAMLS7 | RAMGS0
   .sysmem          : > RAMLS4 | RAMLS6 | RAMLS7
#else
   .pinit           : > RAMM0
   .ebss            : > RAMLS4 | RAMLS6 | RAMLS7
   .econst          : > RAMGS0
   .esysmem         : > RAMLS4 | RAMLS6 | RAMLS7
#endif

    ramgs0 : > RAMGS0

    /*  Allocate IQ math areas: */
   IQmath           : > RAMLS4 | RAMLS6 | RAMLS7 | RAMGS0
   IQmathTables     : > RAMLS4 | RAMLS6 | RAMLS7 | RAMGS0


   dcsm_otp_z1_linkpointer 	: > DCSM_OTP_Z1_LINKPOINTER		PAGE = 0
   dcsm_otp_z1_gpreg        : > DCSM_OTP_Z1_GPREG		    PAGE = 0, type = DSECT
   dcsm_otp_z1_pswdlock		: > DCSM_OTP_Z1_PSWDLOCK		PAGE = 0
   dcsm_otp_z1_crclock		: > DCSM_OTP_Z1_CRCLOCK			PAGE = 0
   dcsm_otp_z1_bootctrl		: > DCSM_OTP_Z1_BOOTCTRL		PAGE = 0, type = DSECT
   dcsm_zsel_z1				: > DCSM_ZSEL_Z1_P0				PAGE = 0

   dcsm_otp_z2_linkpointer	: > DCSM_OTP_Z2_LINKPOINTER		PAGE = 0, type = DSECT
   dcsm_otp_z2_gpreg        : > DCSM_OTP_Z2_GPREG		    PAGE = 0, type = DSECT
   dcsm_otp_z2_pswdlock		: > DCSM_OTP_Z2_PSWDLOCK		PAGE = 0, type = DSECT
   dcsm_otp_z2_crclock		: > DCSM_OTP_Z2_CRCLOCK			PAGE = 0, type = DSECT
   dcsm_otp_z2_bootctrl		: > DCSM_OTP_Z2_BOOTCTRL		PAGE = 0, type = DSECT
   dcsm_zsel_z2				: > DCSM_ZSEL_Z2_P0				PAGE = 0, type = DSECT
}
/*
//===========================================================================
// End of file.
//===========================================================================
*/

you can see in the linker file that i don't use RAMLS5 (the secure ram in zone1) for now. when i will finish i will copy the necessary sections to there. 

when "dcsm.asm" is included (which should be) the debugger get stuck somewhere (address 0x0000C057).

what could be the problem? 

Thanks

Yoav