This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Configure SPM peripherals without modifying SPM files

Hi,

I am using "http_upgrade_ota" project. 

I have added UARTE2 , SPIM3 and WDT peripherals in the application. 

To use this peripherals i had to make change in "spm.c" file as below 

spm_config_peripheral(
NRFX_PERIPHERAL_ID_GET(NRF_UARTE2), 0);

spm_config_peripheral(
NRFX_PERIPHERAL_ID_GET(NRF_SPIM3_S), 0);

spm_config_peripheral(
NRFX_PERIPHERAL_ID_GET(NRF_WDT_S), 0);

There is also one more option (Use macro inside proj.conf )to do this but not for WDT peripheral ( I didn't find macro for WDT )

CONFIG_SPM_NRF_UARTE2_NS=y
CONFIG_SPM_NRF_SPIM3_NS=y

But for both options used above , i need to make change in SPM project which is in the "nrf" folder.

I don't want to make change to "nrf" folder as it is submodule and downloaded from github. 

So is there any other way through which we can configure UARTE 2, SPIM3 and WDT without modifying files inside "nrf" folder ?

Regards,

Smitesh Mali

Parents Reply Children
  • Hi Simon,

    I think there is some disconnect between what i want  and what you understood from my question.

    I know that by modifying kconfig and spm.c  or by modifying proj.conf file we can configure peripheral.

    But all these files are inside "nrf" submodule. 

    We don't want to modify any of these files inside "nrf" submodule and want to use it as it is provided by you through github.

    If we want to make change to application then we generally copy that application folder outside

    "nrf" folder and then we use it so that there is no change inside "nrf" folder.

    As you mentioned in your earlier thread "UARTE2" and "SPIM3" are both included as "Non-secure" in 

    spm.c file. So i don't need to configure them.

    Only peripheral i need to configure is "WDT".

    So is there a way to configure "WDT" as non-secure without modifying "kconfig" or "spm.c" or "proj.conf"

    files inside "nrf" submodule ?

    Regards,

    Smitesh Mali

  • In order to set a peripheral to a Non-Secure state, you have to access the SPU register PERIPHID[n].PERM, and I don't think this is possible to do from Non-Secure firmware. E.g. the user application (I couldn't find any documentation confirming this, but it doesn't make sense that Non-Secure firmware can modify the Security state of peripherals).

    If my understanding is right, you have to configure security state of the peripheral from a separate Secure firmware image. Thus you have to do it from the SPM application.

    I understand your concern about modifying Nordic libraries, as it doesn't seem like a clean way of doing things.

    However, I will be gone for the next two weeks, but I will ask somebody else to take over the case, which can ask one of the developers of the SPM library how to go about this.

    Best regards,

    Simon

  • Hi simon,

    any update on this issue ?

    I want to ask whether we can change path of "SPM" project included in the "http_update_ota" 

    project. 

    If we can then i can move SPM outside "nrf" folder and use it.

    Regards,

    Smitesh Mali

  • I think this should be possible, take a look at ..\ncs\nrf\samples\CMakeLists.txt and the following lines:

    if (CONFIG_SPM)
      zephyr_add_executable(spm require_build)
      if (${require_build})
        add_subdirectory(nrf9160/spm ${CMAKE_BINARY_DIR}/spm)
      endif ()
    endif()

    You can see that the SPM path is added through the line add_subdirectory(..).

    In order to use another path, e.g. ncs/your_folder, try this:

    add_subdirectory(../your_folder/spm ${CMAKE_BINARY_DIR}/spm)

    If this doesn't work, please tell me and I will look into it.

    Best regards,

    Simon

  • Hi Simon,

    Above option you suggested would bring change inside "nrf" folder.

    So this option is not feasible. 

    Regards,

    Smitesh Mali

Related