Board reboots when a function is executed in TF-M

Hi,

I'm moving a project from SPM to TF-M. I have imported a static library and the board (nRF5340DK) restarts automatically every time the following mycli/main.c function is executed: signature.

signature(pk, msg, buffer);

More specifically, the problem occurs when executing blst_sign_pk_in_g1 function, which is located in lib/bls_hsm.h.

blst_sign_pk_in_g1(&sig, &hash, secret_keys_store + pk_index*sizeof(blst_scalar));

Other functions from the static library are executed correctly, so I guess the problem is not in the import of the library, but must be related to memory. In case it is of any interest, a few weeks ago I had problems importing such a static library into TF-M. The problem was solved as indicated in the following forum ticket: Problem importing a library into TF-M: Not enough space to import i.

I attach a link to the github project repo, so that the error can be easily reproduced: bls-hsm-2. To reproduce the error, build and execute application mycli. You will see that the board reboots.

Thank you in advice,

Pablo

Useful information about the project:
- I'm using the nRF5340DK development kit.
- nRF SDK v2.0.0
- The project is based on the example: TF-M Secure Partition Sample. When doing the build for this example, the available and used space shown is as follows:

Parents
  • Hi,

    I have reproduced your issue. I'll look into it more tomorrow.

    Best regards,
    Dejan

  • Hi,

    When doing the build for this example, the available and used space shown is as follows:

    I guess something is missing. I don't see anything after "follows:". Could you please resend what you wanted to send initially?

    Best regards,
    Dejan

  • What I wanted to send was this:

    Useful information about the project:
    - I'm using the nRF5340DK development kit.
    - nRF SDK v2.0.0
    - The project is based on the example: TF-M Secure Partition Sample.

    The text at the end is something I forgot to remove. I copied and pasted this information about the project from another ticket where I had a problem with the build.

  • Hi,

    I have looked into your project. I noticed that there are many warnings during build process. I would suggest you to go through these warnings and try to fix them. There seems to be a problem with your project that would need to be investigated further. 

    Could you provide more information on how you narrowed down the problem to the blst_sign_pk_in_g1 function from lib/bls_hsm.h?

    It would be beneficial if you could provide some logs. Could you show application log and secure partition log?

    Have you seen any hard fault errors?

    Bes regards,
    Dejan

  • I narrowed down the problem by doing a step-by-step debug. I found that it is in that line of code that the board reboot occurs.

    As for the warnings I get when doing the build, they don't seem to be related to the problem. I will still try to fix them

    Executing the following command inside bls-hsm-2/mycli, i get this log:

    west build -t partition_manager_report

    The reboot of the board made me think that it might be a RAM problem. To do so, I set the value of the RAM assigned to the safe partition to an extremely high value, by writing the following in prj.conf:

    CONFIG_PM_PARTITION_SIZE_TFM_SRAM=0x63000

    This did not solve the problem. Running the same command, having added this configuration inside prj.conf to the build gives the following log:

    Are them the logs you need?

    Regards,

    Pablo

Reply
  • I narrowed down the problem by doing a step-by-step debug. I found that it is in that line of code that the board reboot occurs.

    As for the warnings I get when doing the build, they don't seem to be related to the problem. I will still try to fix them

    Executing the following command inside bls-hsm-2/mycli, i get this log:

    west build -t partition_manager_report

    The reboot of the board made me think that it might be a RAM problem. To do so, I set the value of the RAM assigned to the safe partition to an extremely high value, by writing the following in prj.conf:

    CONFIG_PM_PARTITION_SIZE_TFM_SRAM=0x63000

    This did not solve the problem. Running the same command, having added this configuration inside prj.conf to the build gives the following log:

    Are them the logs you need?

    Regards,

    Pablo

Children
No Data
Related