Setup secure storage memory for data storage inside TFM

Hi,

We are working on nrf5340 board with NS and TF-M setup and we have SDK v2.7.0

We need to have a flash partition to store the some secure data may be a size of 4KB inside the TF-M.

Please help us or direct us to any reference.

Parents
  • Hi, any one please guide us through the setup please.

    I see they have an example psa_protected_storage. If I set any partition size to 1KB the example does not work, it just goes into  arch_system_halt().

    How can I modify the partition size?

  • Hi,

     

    You seem to have found an example that provides what you are looking for:

    Jithin A said:
    example psa_protected_storage.

    What exactly did you add here?

    Jithin A said:
    If I set any partition size to 1KB the example does not work, it just goes into  arch_system_halt().

    And what is the assert output? 

    I suspect that the data that you added is stacked memory. If yes, then try to adjust your CONFIG_MAIN_STACK_SIZE.

     

    If you want to store larger than 2k objects, you should adjust the CONFIG_TFM_PS_MAX_ASSET_SIZE. This can max. be 4020 due to overhead, and aligning to a flash page.

     

    Kind regards,

    Håkon

  • Hi  Håkon Alseth,

    Thank you for the response, please see below comments.

    What exactly did you add here?

    --> Nothing, plain example as is.

    And what is the assert output?

    --> Reason holds 2

    I suspect that the data that you added is stacked memory. If yes, then try to adjust your CONFIG_MAIN_STACK_SIZE.

    --> I don't think so, the data is a string with only 20-30 chars defined global which I believe is not stacked.

    I just adjusted the partition size to be 1000 instead and nothing else changed.

    If you want to store larger than 2k objects, you should adjust the CONFIG_TFM_PS_MAX_ASSET_SIZE. This can max. be 4020 due to overhead, and aligning to a flash page.

    --> Yet the same result. For reference I have attached the logs screenshot.

    You can see it's not able execute the application.

    Please let me know if my setup is wrong or missing something.

    Thank you.

Reply
  • Hi  Håkon Alseth,

    Thank you for the response, please see below comments.

    What exactly did you add here?

    --> Nothing, plain example as is.

    And what is the assert output?

    --> Reason holds 2

    I suspect that the data that you added is stacked memory. If yes, then try to adjust your CONFIG_MAIN_STACK_SIZE.

    --> I don't think so, the data is a string with only 20-30 chars defined global which I believe is not stacked.

    I just adjusted the partition size to be 1000 instead and nothing else changed.

    If you want to store larger than 2k objects, you should adjust the CONFIG_TFM_PS_MAX_ASSET_SIZE. This can max. be 4020 due to overhead, and aligning to a flash page.

    --> Yet the same result. For reference I have attached the logs screenshot.

    You can see it's not able execute the application.

    Please let me know if my setup is wrong or missing something.

    Thank you.

Children
Related