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

  • 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

  • Take a look at the nRF Connect SDK Tutorial, at the bottom of section 2.2.4. There I am showing how to include peripherals to the SPM library.

    Best regards,

    Simon

  • 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

Related