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
  • UPDATE 2/24/2020: Check out this ticket for instructions on how to do this 


    If you look at the latest commit of the nrf repo, you can see that the the subsys/spm library includes both the UARTE2 and SPIM3, so I don't see any problems of you modifying the library. I am not sure if the WDT will be inlcuded, but I can look into it if you would like so.

    Best regards,

    Simon

  • Simon,

    If i don't write below in spm.c file inside "spm_jump()" function then 

    spm doesn't jump to the application 

    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);

    I either need to write above 3 functions in "spm_jump()" function or i need to add macro as i mentioned in above thread 

    in the proj.conf.

    otherwise "spm" won't jump to application. 

    So basically i don't want to make these changes to "nrf" submodule files.

    So is it possible ?

    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

  • A solution might be to put it in the CMakeLists.txt file inside <..>\ncs\nrf\samples\nrf9160\http_application_update.

    However, you are free to place the application folder wherever you want, e.g. in C:\ncs_projects\http_application_update. All you have to do is to set ZEPHYR_BASE appropriately, and cmake will find all the repositories (nrf, zephyr, nrfxlib etc..).

    In the NCS tutorial, under 2.1.4 Manage your project with west -- How to preserve your application,  I will soon explain where and how to develop your application.

    Best regards,

    Simon

Reply
  • A solution might be to put it in the CMakeLists.txt file inside <..>\ncs\nrf\samples\nrf9160\http_application_update.

    However, you are free to place the application folder wherever you want, e.g. in C:\ncs_projects\http_application_update. All you have to do is to set ZEPHYR_BASE appropriately, and cmake will find all the repositories (nrf, zephyr, nrfxlib etc..).

    In the NCS tutorial, under 2.1.4 Manage your project with west -- How to preserve your application,  I will soon explain where and how to develop your application.

    Best regards,

    Simon

Children
Related