nRF9160 non-secure firmware image can access UARTE2 secure peripheral

Hi, I'm working on nRF9160 modem firmware update.

For Understanding SPM with secure and non-secure firmaware, I have used UARTE2(secure peripheral) into non-secure firmware image. Though UARTE2is secure it can be accessed through non-secure board image.

How is secure peripheral(NRF_UARTE2) can be accessed by non-secure board image ?

Image is attached for reference. It goes to init UART2 which is connected with nRF52840 mounted on nRF9160 board and it succeed without any error.

Parents Reply Children
  • Code used to initialize the UARTE2 for UART communication between nRF9160 and nRF52840:

    <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 

      if (enabled_transport & UART_COMM_TRANS)
    {
    memset(&uart_ctx, 0x00, sizeof(uart_ctx));
    printk("UART 9160 start!\n");
    err = uart_comm_init(DT_LABEL(DT_NODELABEL(uart2)), &uart_ctx, ASYNC_UART_COMM);
    if (err != 0)
    {
    printk("Fail to init UART\n");
    break;
    }
    }

    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

    This code is working fine with CONFIG_TRUSTED_EXECUTION_NONSECURE=y and CONFIG_SPM_NRF_UARTE2_NS=n config.

    As UARTE2 is configured as secure peripheral, it would provide an error with non-secure(ns) build. But it is not producing error related to security attribute. Reason ?

  • Hi

    If you set CONFIG_SPM_NRF_TWIM2_NS=n (in <project_folder>/child_image/spm.conf), this should make UARTE2 Secure as well.-

    UARTE2 shares peripheral ID with TWIM2, see Instantiation.
    My guess is that when TWIM is conigured as Non-Secure, this sets the whole of Peripheral ID 10 to Non-Secure as well,
    but we will have to investigate this further.

    If the work-around does not work for you, let me know.

    Regards,
    Sigurd Hellesvik

Related