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.

MSP430FR6989: IPE issues need help

Part Number: MSP430FR6989


Hi TI guys,

  I have a algorith need to be protcted, and find IPE is a good choice for me to achive this. I go through the user guider and some post in this forum, and still have some doubts.

1) I want to know if a const data or code in IPE area can be modified by another code which is also located in IPE area.

of courese,  MPU has open the write access right.

2) Interrupt vector table(IVT) is automatically readable enabled by MPU. Besides,The user guider says"  if the IVT is inside of the IPE area, the execute is always prohibited. "

so I am a little confused when the MSP430 reponses to a interrupt event, it use its "Read" or  "Execute" right?  It  "reads" the IVT or it "executes" the IVT.

 

3) I have carefully read the IPE charpter in user guider,and know well of the IPE_INIT_structure.The boot code will tell whether the  IPE Signature1(0xFF88) is 0xAAAA; if YES , IPE signature2(0xFF8A)

actived. and it points to the IPE_init_structure. I believe the content of IPE_Init_structure will load noto registers such as MPUIPC0、MPUIPSEGB2、MPUIPSEGB by boot code.The output(.txt)  of the example

codes provided by TI is sth like this:


When this code download onto chip, reboot the MSP430 .... the IPE actived.  But...this methord only sovle the application that the coder knows exactly  what data need to be protected ,  maybe like this way:

#progrma location = "IPEDATA16_C" //IAR not CCS

const char key[ ]={0x11,0x22,0x33,0x44.......};

 

If the developer himself don't know the  const data, he just knows where  and how to get this data. For example, he wants use the DieXY or random seed in the TLV  as the password. And need

copy these bytes to IPE area as password. How he to achieve this?

I write the following code,but I don't know whether it will work or not. I don't have a  HW/LauchPad  to veryfy it. so I pasted it here.

//SENSTIVE is allocatoned @ IPE area I design. But put this in mind: IPE does't exist yet. before this fuction be called.

void GenerateSortsOfKeysAndEnable_IPE(void)@"SENSITIVE"    
{
    uint16_t i;
    uint8_t* DieXY_ptr;
    uint8_t* RandomSeed_ptr;
    
    if(0xAAAA == *((uint16_t*)IPE_SIG_VALID) )
        return;
    
    DieXY_ptr = (uint8_t*)0x1A0A;
    RandomSeed_ptr = (uint8_t*)0x1A30;
    

    for(i=0;i<8;i++){
        PassWord_ToolAuthorize[i] = *DieXY_ptr++;}

    for(i=0;i<16;i++){
        PassWord_cryptImage[i] = *RandomSeed_ptr++;}
    


    IPE_Init_Tmp.MPU_IPC0 = MPUIPENA;
    IPE_Init_Tmp.MPU_IPB2 = IPE_END_ADR>>4;
    IPE_Init_Tmp.MPU_IPB1 = IPE_START_ADR>>4;
    IPE_Init_Tmp.MPU_CHECK = 0xFFFF ^(IPE_Init_Tmp.MPU_IPC0) ^ (IPE_Init_Tmp.MPU_IPB2)^ (IPE_Init_Tmp.MPU_IPB1);
    
    
    *( (uint16_t*)(IPE_START_ADR) ) = IPE_Init_Tmp.MPU_IPC0;
    *( (uint16_t*)(IPE_START_ADR+2) ) = IPE_Init_Tmp.MPU_IPB2;
    *( (uint16_t*)(IPE_START_ADR+4) ) = IPE_Init_Tmp.MPU_IPB1;
    *( (uint16_t*)(IPE_START_ADR+6) ) = IPE_Init_Tmp.MPU_CHECK;
    
    /*************************Start IPE*****************************/
    *( (uint16_t*)(IPE_STR_PTR_SRC) ) = IPE_START_ADR; //0xFF8A
    *( (uint16_t*)(IPE_SIG_VALID) ) = 0xAAAA;          //0xFF88
 
    PMMCTL0 = PMMPW+PMMSWBOR;
}


4)  The user guider says, boot code will transfer IPE Signature2 to a secured nonvolatile system data area, like a copy , and IPE signature can be overwritten。

 I have 4 questions here:

a)   A secured nonvolatile system data area is where?

b)As I know when MSP430 powers on, boot code runs first, then call memory or SP initialization fuctions. At last , the code in Main().

Because IPE signature does not work any more after the reboot, I want know how to erase the IPE area. It looks like the application code

can't achieve this. Pls intruduce the mechanism.

c) If I  directly write to registers MPUIPC0、MPUIPSEGB2、MPUIPSEGB instead of building  a IPE_init_structure, What will happen?

Of course, IPE Signature1 will be 0xAAAA.  IPE Signaute2 looks like useless in this circumstance.

d)You can see I don't want the fuction GenerateSortsOfKeysAndEnable_IPE be called twice.  so I use the IPE Signature1 as a flag.

    if(0xAAAA == *((uint16_t*)IPE_SIG_VALID) )

    return;

As mentioned above, IPE Signature can be modified after BOR, it bother me a little.

Do u have a more rubust way to solve this?

 

That'all . Thanks.

 

.

 

  • Hi

    We have an application note about IPE www.ti.com/.../slaa685.pdf
    There is a code examples for IPE
    1)a const data or code can't be modified in IPE because we defined the const data and code . For more you can see the code example of SLAA685
    2)I think you just need to define a ISR just the same way the code example and that will be work
    For the next two question you can read the SLAA658 first and if there is no answer please let me know.

    Best regards
    Gary
  • Hi 

    Add more information here

    1) You can't change the const data or code in IPE area is means that is const data and execute data. When you try to change it you will get the compiler's errors. But the variables can be changed in the IPE area you see it in the demo code that in the 

    2)Yes, when the IVT is include the IPE area. The interrupt can't be used. In our demo we use a timer ISR that is in the IPE area but the IVT is not in the IPE area.

    3)like the #1 we can't change the value of a const array. And if you define the key to  a variable value and the copy operation code is in IPE area I think that will be work.

    4)

    a) the secured nonvolatile system data area is the IPE protected area. You know the signature 2 include the start address of the IPE

    b)The IPE is active before the application runs. In the UG it just says"The boot code can preload user-defined setting before the start of application code. This ensures that the encapsulation is active before any user-controlled accesses to the memory can be performed." For more details is like "The bootcode performs a sequence to ensure the integrity of the IPE structure pointer. On bootcode execution, a valid IPE Signature 1 triggers the transfer of the IPE Signature 2 (IPE structure pointer source) to a secured nonvolatile system data area (saved IPE structure pointer)." For more details it don't say and I don't know it. Sorry about that.

    c) That should be work if the IPE registers is not locked. But by this way you can't make sure the IPE is active before application code runing

    d)why you say that"IPE Signature can be modified after BOR"?

    BR

    Gary

  • Hi Gary,
    Thanks for your detailed answer. That helps a lot.
    I have a FR5969 LaunchPad in hand now, I will test my code.

    Thanks again.

**Attention** This is a public forum