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.

CCS/TMS320F28377D: Calling to a function in a secure, ONLYEXE Flash Sector

Part Number: TMS320F28377D

Tool/software: Code Composer Studio

Hello everyone,

Given the following pieces of program code:

myStrCmpFile is placed at address 0x82000.

As I understand, it should be possible to call function myStrCmp from secure Flash Sector C, shoudn’t it?

Anyway, myStrCmp function does not return the expected value when the system is standalone (But it works well in debug mode).

If I unlock Z1 and Z2 zones before calling myStrCmp, it works well, even in standalone mode:

 

It also works if I just unlock Zone 2.

Can anybody tell me where my mistake is?

Many  thanks in advance,

Andreu

 

  • Hi Andreu,

    As I understand, it should be possible to call function myStrCmp from secure Flash Sector C, shoudn’t it?

    Yes, your understanding is correct. functional call from one zone to other zone is allowed.

    Anyway, myStrCmp function does not return the expected value when the system is standalone (But it works well in debug mode).

    In debug mode, are you unlocking the zone via Gel file or flash plug-in GUI ?

    Where is your stack placed? It should be in non-secure RAM. If it's in secure RAM then it'll be an issue. Please check if that is the case. Also please make sure the function is not trying to read any data from other zone or EXEONLY memory.

    Regards,

    Vivek Singh

  • Hi Vivek,

    Many thanks for your quick answer. Here are mines:

    1) In debug mode, I am unlocking via flash plug-in GUI.

    2) My stack is placed in RAMM1.

    3) All the RAMs are non-secure.

    4) The only ONLYEXE sector is FLASHB.

    5) There is no ONLYEXE RAM.

    6) As I undertand, strcmp (a library function) is placed in FLASHB as I can see in the .map file. I do not know how this function is implemented but I do not think it tries to read constant data from FLASHB. Anyway, other functions like strcpy or strlen have the same problem. This the Sector Summary:

    Best,

    Andreu

  • Andreu,

    In that case it should work without any issue. What you should is unlock the ECSL for both the zone (write matching password for KEY0 and KEY1 only) and step through the code to see if code is getting executed as expected.

    Regards,

    Vivek Singh

  • Hello Viveck,

    Many thanks for your answer.

    I have done what you said and think the problem is that, sometimes, one or both parameters of the function are constant strings stored in Zone 2:


    As Zone 2 is secure, the strcmp function in Zone 1 cannot read string  s1, so it does not work. What do you think? Is there any possibility to do this (apart from unlocking Z2 before calling myStrCmp function and locking it after) ?

    Best regards,

    Andreu

  • Andreu,

    That would not work and also I would not recommend to unlock the zone during runtime because that makes the zone unsecure for some time. Instead you should place the constant strings in unsecure RAM so both zone can exchange the data.

    Regards,

    Vivek Singh

  • Viveck,

    Many thanks for your help.

    Best,

    Andreu