Enable APPROTECT through UICR with a TFM Project

Hello,

I am wondering how I can enable APPROTECT through UICR with a TFM project. Using ncs2.6.0 and nrf5340. My project makes use of TFM to separate secure and non-secure partitions. The issue I am running into is that using any of the following configurations does not work:

CONFIG_NRF_SECURE_APPROTECT_LOCK=y
CONFIG_NRF_SECURE_APPROTECT_USE_UICR=y
CONFIG_NRF_APPROTECT_LOCK=y
CONFIG_NRF_APPROTECT_USE_UICR=y

I tried to use the code in the sample project of TFM provisioning_image_net_core, but I lose the putty output, and I am still able to read out memory from the terminal (approtect is not enabled):

#include <zephyr/sys/printk.h>
#include <stdio.h>
#include <nrfx_nvmc.h>

int main(void)
{
   bool is_writable = nrfx_nvmc_word_writable_check((uint32_t)&NRF_UICR->APPROTECT,
      UICR_APPROTECT_PALL_Protected);

   if (!is_writable) {
      printk("Cannot write to the UICR->APPROTECT register, exiting...!\n");
      return 0;
   }

   nrfx_nvmc_word_write((uint32_t)&NRF_UICR->APPROTECT, UICR_APPROTECT_PALL_Protected);
   printk("The UICR->APPROTECT register is now configured to deny debugging access for the "
         "network core!\n");
   printk("Success!\n");

   return 0;
}

I am wondering if there are ways I can solve this issue. It might be because I am reading/writting to a secure area (UICR) from a non-secure area.

Thanks!

Parents Reply Children
No Data
Related