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

app_timer2 and unprivileged mode

Hi,

In our project, we are using a small RTOS to switch between simple tasks and set MPU. We would like to run all task in unprivileged mode, but some Nordic SDK libraries prevent this.

In unprivileged mode, all call to SCS are forbidden. So, we can't call NVIC functions (i.e. NVIC_SetPendingIRQ...etc). But some very usefull libraries are doing it: app_timer2, nrf_pwr_mgmt...etc.

Running in privileged mode is not an option, as this bypass all security measures we implement.

So, do you think that Nordic can update these libraries (and all others making call to SCS) to call softdevice if available (i.e. sd_nvic_SetPendingIRQ...etc) like in nrf_sdh.c:

#ifdef SOFTDEVICE_PRESENT

    sd_nvic_SetPendingIRQ(IRQn);

#else

    NVIC_SetPendingIRQ(IRQn);

#endif

or to allow the use of a custom function:

#ifdef USE_UNPRIVILEGED_MODE

    rtos_nvic_SetPendingIRQ(IRQn);

#else

    NVIC_SetPendingIRQ(IRQn);

#endif

That will be wonderful :-)

For the record, we are using nRF5-SDK-16, on nRF52832 MCU.

Thank you !

Best,

jym

Parents
  • Hi Jean,

    So, do you think that Nordic can update these libraries (and all others making call to SCS) to call softdevice if available (i.e. sd_nvic_SetPendingIRQ...etc) like in nrf_sdh.c:

    #ifdef SOFTDEVICE_PRESENT

        sd_nvic_SetPendingIRQ(IRQn);

    #else

        NVIC_SetPendingIRQ(IRQn);

    #endif

     We should have done this already to check if the softdevice is present and call the softdevice function instead, atleast in the libraries. NRFX libraries will not have this check since they are designed to be agnostic of external dependencies.

    I can create a bug ticket for this. Thanks for reporting.

Reply
  • Hi Jean,

    So, do you think that Nordic can update these libraries (and all others making call to SCS) to call softdevice if available (i.e. sd_nvic_SetPendingIRQ...etc) like in nrf_sdh.c:

    #ifdef SOFTDEVICE_PRESENT

        sd_nvic_SetPendingIRQ(IRQn);

    #else

        NVIC_SetPendingIRQ(IRQn);

    #endif

     We should have done this already to check if the softdevice is present and call the softdevice function instead, atleast in the libraries. NRFX libraries will not have this check since they are designed to be agnostic of external dependencies.

    I can create a bug ticket for this. Thanks for reporting.

Children
Related