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.

Modifying the Memory Security Module keys for TMS470 (SPNA099A)

Other Parts Discussed in Thread: TMS470R1B1M

I am trying to follow the application note SPNA099A to set the MSM for the TMS470R1B1M.  I do not seem to be able to make it work though.  My first goal was to change the MSM password on the board, and then not supply it in the .MAC file the next time i programmed.  In my mind this should block me from programming or debugging the second time.  I took my project and did the following things to ( I thought) change the MSM password:

1. I added a file titled MSM_key.c to my project and included the two segments found on page 6 of the application note.

//------------------------------------------------------------------------
//This module modifies the MSM keys
//------------------------------------------------------------------------
#pragma location="MSMKEYS"
__root const unsigned long MSMKeys[4] =
{
  0xAAAAAAAA,
  0xBBBBBBBB,
  0xCCCCCCCC,
  0xDDDDDDDD
};

 

2. I changed the linker file to define regions for MSMKEYS

/*###ICF### Section handled by ICF editor, don't touch! ****/
/*-Editor annotation file-*/
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\a_v1_0.xml" */
/*-Specials-*/
define symbol __ICFEDIT_intvec_start__ = 0x00000000;
/*-Memory Regions-*/
define symbol __ICFEDIT_region_ROM_start__ = 0x00000080;
define symbol __ICFEDIT_region_ROM_end__   = 0x000FFFFF;
define symbol __ICFEDIT_region_RAM_start__ = 0x00400000;
define symbol __ICFEDIT_region_RAM_end__   = 0x0040FFFF;
/*-Sizes-*/
define symbol __ICFEDIT_size_cstack__   = 0x400;
define symbol __ICFEDIT_size_svcstack__ = 0x40;
define symbol __ICFEDIT_size_irqstack__ = 0x100;
define symbol __ICFEDIT_size_fiqstack__ = 0x100;
define symbol __ICFEDIT_size_undstack__ = 0x0;
define symbol __ICFEDIT_size_abtstack__ = 0x0;
define symbol __ICFEDIT_size_heap__     = 0x1000;
/**** End of ICF editor section. ###ICF###*/


define symbol __FlashKeyStartAddr__ = 0x0000FFE0;
define symbol __FlashKeyEnd_Addr__  = 0x0000FFFF;

define memory mem with size = 4G;
define region ROM_region   = mem:[from  __ICFEDIT_region_ROM_start__   to (__FlashKeyStartAddr__-1)] |
                             mem:[from (__FlashKeyEnd_Addr__+1)         to __ICFEDIT_region_ROM_end__];
define region RAM_region   = mem:[from  __ICFEDIT_region_RAM_start__   to __ICFEDIT_region_RAM_end__];
define region MSMKEYS = mem:[from __FlashKeyStartAddr__ size 0x10];
define region FLASHKEYS = mem:[from (__FlashKeyStartAddr__+0x10) to __FlashKeyEnd_Addr__];

define block CSTACK    with alignment = 8, size = __ICFEDIT_size_cstack__   { };
define block SVC_STACK with alignment = 8, size = __ICFEDIT_size_svcstack__ { };
define block IRQ_STACK with alignment = 8, size = __ICFEDIT_size_irqstack__ { };
define block FIQ_STACK with alignment = 8, size = __ICFEDIT_size_fiqstack__ { };
define block UND_STACK with alignment = 8, size = __ICFEDIT_size_undstack__ { };
define block ABT_STACK with alignment = 8, size = __ICFEDIT_size_abtstack__ { };
define block HEAP      with alignment = 8, size = __ICFEDIT_size_heap__     { };

initialize by copy { readwrite };
do not initialize  { section .noinit };

place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };

place in ROM_region   { readonly };
place in RAM_region   { readwrite,
                        block CSTACK, block SVC_STACK, block IRQ_STACK, block FIQ_STACK,
                        block UND_STACK, block ABT_STACK, block HEAP };

 

In my mind this should work and change the MSM_key to what i have in the MSM_key.c file.  What am i missing?  If someone has a successful example of this I would appreciate getting a copy of it.  Does the .c file need to be included somewhere in my project?

  • Hi,

    I will forward your query to our expert..

    Please be aware that the TMS470R1 Series (including the TMS470R1A288 device) is not recommended for new designs. However, the device, tool, or software continues to be in production to support existing customers.  Please see the full 'NRDN' notice here.

    Soon TI will be launching the new TMS470M series of microcontrollers.  This series will feature greater ARM CPU performance and a similar peripheral set to the TMS470R1 Series of microcontrollers.  Please come back soon for more information about the TMS470M Series of microcontrollers.  The product preview for the first two microcontrollers in the TMS470M series is available here: TMS470MF0660x - SPNS157.

  • I know that.  However, our design has been in process for 3 years and we are about to start production of our final product.

  • Can anyone help with this?  I would assume TI has example code for the IAR workbench since they wrote a application note for this...

  • Has no one used the Memory Security Module / Flash security Module?  If you have can you please help me get going on this?  I tried to implement this but couldn't get it to work.  An example project or direction would be most helpful.  See above post.

  • Jonathan Baisch,

    I'll check and let you know on this. 

    This is an older architecture and it may take some time to figure it out.

    Regards,

    Pratip

     

  • I would appreciate that.  There is a white paper on this, however, I am having trouble implementing it and was looking for an example project.  The documents regarding it are spnu243 and SPNA099A.

  • Jonathan,

    Do you mean you are able to access the RAM even after changing the MSM password ?

    Best Regards,

    Pratip

     

  • I am able to access the RAM & ROM.  If desired I can post the project.  I am trying to disable access to the memory.  In my understanding if I change the MSM password & then don't provide it i should not be able to debug & run the microprocessor.  Is my understanding correct?  I am able to debug & run the micro using the j-link module.

  • I think I have narrowed down the issue to the fact that I am not actually storing the new keys in the memory locations even though the device is unlocked.

    My guess is that this problem is either in the linker file, or in the msmkeys.c file that is supposed to store the data.  I do not understand in the white paper what the following command is supposed to do since as far as I can tell it is not a linker command.

    -Z(CODE)MSMKEYS=(ROMSTART+0x1FE0):+0x10

    My assumption is that this defines a region in memory at the MSMPWL locations so for the TMS470R1B1M this is at 0x0000FFE0 - 0x0000FFEF.  I have attempted to implement this using the following commands which I highlighted in RED.  I am wondering if I need a place in or place at directive in here for the MSMKEYS / FLASHKEYS regions just like I do for the ROM_region & RAM_region.  I am not very familiar with linker files / syntax.  

     

    /*###ICF### Section handled by ICF editor, don't touch! ****/
    /*-Editor annotation file-*/
    /* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\a_v1_0.xml" */
    /*-Specials-*/
    define symbol __ICFEDIT_intvec_start__ = 0x00000000;
    /*-Memory Regions-*/
    define symbol __ICFEDIT_region_ROM_start__ = 0x00000080;
    define symbol __ICFEDIT_region_ROM_end__   = 0x000FFFFF;
    define symbol __ICFEDIT_region_RAM_start__ = 0x00400000;
    define symbol __ICFEDIT_region_RAM_end__   = 0x0040FFFF;
    /*-Sizes-*/
    define symbol __ICFEDIT_size_cstack__   = 0x400;
    define symbol __ICFEDIT_size_svcstack__ = 0x40;
    define symbol __ICFEDIT_size_irqstack__ = 0x100;
    define symbol __ICFEDIT_size_fiqstack__ = 0x100;
    define symbol __ICFEDIT_size_undstack__ = 0x0;
    define symbol __ICFEDIT_size_abtstack__ = 0x0;
    define symbol __ICFEDIT_size_heap__     = 0x1000;
    /**** End of ICF editor section. ###ICF###*/
    define symbol __FlashKeyStartAddr__ = 0x0000FFE0;
    define symbol __FlashKeyEnd_Addr__  = 0x0000FFFF;

    define memory mem with size = 4G;

    define region ROM_region   = mem:[from  __ICFEDIT_region_ROM_start__   to (__FlashKeyStartAddr__-1)] |

                                 mem:[from (__FlashKeyEnd_Addr__+1)         to __ICFEDIT_region_ROM_end__];

    define region RAM_region   = mem:[from  __ICFEDIT_region_RAM_start__   to __ICFEDIT_region_RAM_end__];

    define region MSMKEYS = mem:[from __FlashKeyStartAddr__ size 0x10];

    define region FLASHKEYS = mem:[from (__FlashKeyStartAddr__+0x10) to __FlashKeyEnd_Addr__];

    define block CSTACK    with alignment = 8, size = __ICFEDIT_size_cstack__   { };

    define block SVC_STACK with alignment = 8, size = __ICFEDIT_size_svcstack__ { };

    define block IRQ_STACK with alignment = 8, size = __ICFEDIT_size_irqstack__ { };

    define block FIQ_STACK with alignment = 8, size = __ICFEDIT_size_fiqstack__ { };

    define block UND_STACK with alignment = 8, size = __ICFEDIT_size_undstack__ { };

    define block ABT_STACK with alignment = 8, size = __ICFEDIT_size_abtstack__ { };

    define block HEAP      with alignment = 8, size = __ICFEDIT_size_heap__     { };

    initialize by copy { readwrite };

    do not initialize  { section .noinit };

    place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };

    place in ROM_region   { readonly };

    place in RAM_region   { readwrite,

                            block CSTACK, block SVC_STACK, block IRQ_STACK, block FIQ_STACK,

                            block UND_STACK, block ABT_STACK, block HEAP };

     

  • I have figured out the MSM issue.  I had to add the following line to my linker file (shown in my last post):

    place in MSMKEYS { object msm_key.o };

    When i implemented the flash key & the msm key i simply made them separate files so i can use another place in command for the flash key:

    place in FLASHKEYS { object flash_key.o };.

    I'm glad i found a solution despite of TI's horrible customer support.

     

    SO to sum up.  Instead of the non existant

    -z(CODE) MSMKEYS=(ROMSTART+0x1FE0):+0x10

    I add the following lines of code to the linker file for the flash keys & MSM keys.

    define symbol __FlashKeyStartAddr__ = 0x0000FFE0;                          NOTE (These might be in the default .icf file already)
    define symbol __FlashKeyEnd_Addr__  = 0x0000FFFF;

    define region MSMKEYS = mem:[from __FlashKeyStartAddr__ size 0x10];
    define region FLASHKEYS = mem:[from (__FlashKeyStartAddr__+0x10) to __FlashKeyEnd_Addr__];

    place in MSMKEYS { object msm_key.o };
    place in FLASHKEYS { object flash_key.o };

    I followed Application Report SPNA099A for all other points and it worked.

  •  

    Hi Jonathan,

    I'm sorry that this was not a good experience for you.  Our organization doesn't have the history on these R1x + IAR combinations.  We do our best to try to support any questions that are posted related to R1x devices but our team is set up to support our catalog devices in the TMS470M and TMS570 families.  I am guessing that something has changed in the supported IAR linker commands of today as compared to 2007 when this app note was published.  Perhaps we should have directed you to seek some support from IAR much earlier in the process.  Again, my apologies that we weren't of much help.   I hope that you will still consider using this forum as your project progresses.

  • The icf update must be modified from the old one that had the key space defined. I am no longer with TI but I wrote the book on TMS470 devices. The MCU Daddy