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

how does sd_softdevice_vector_table_base_set actually work?

Hi,

I'm missing something on how forwarding interrupt control between SoftDevice and APP works! how is it that part of the interrupts are handled by the SoftDevice code and another part is handled by the APP code?

I'm guessing that calling sd_softdevice_vector_table_base_set(CODE_REGION_1_START) actually changes the vector table in NVIC to the APP vector table meaning that all interrupt handlers are compiled and linked in the APP code so how does the SoftDevice still handle part of the interrupts?

for example I know that the SVC interrupt is used by the SoftDevice to handle APP commands so I'm guessing that the SoftDevice implements the SVC_Handler but in the APP code this handler is not defined! how is it that after calling sd_softdevice_vector_table_base_set(CODE_REGION_1_START) the SVC interrupt is still handled by the SVC handler of the SD?

Thanks


Edit: I just saw this in the SoftDevice Specification:

16.1.1 Interrupt forwarding to the application
The forwarding of interrupts to the application depends on the state of the SoftDevice.
At the lowest level, the MBR receives all interrupts and forwards them to the SoftDevice regardless of whether
the SoftDevice is enabled or not. The use of a bootloader introduces some exceptions to this. See Master Boot
Record and bootloader on page 55.
Some peripherals and their respective interrupt numbers are reserved for use by the SoftDevice (see Hardware
peripherals on page 21). Any interrupt handler defined by the application for these interrupts will not be
called as long as the SoftDevice is enabled. When the SoftDevice is disabled, these interrupts will be forwarded
to the application.
The SVC interrupt is always intercepted by the SoftDevice regardless of whether it is enabled or disabled. The
SoftDevice inspects the SVC number, and if it is equal or greater than 0x10, the interrupt is processed by the
SoftDevice. SVC numbers below 0x10 are forwarded to the application's SVC interrupt handler. This allows the
application to make use of a range of SVC numbers for its own purpose, for example, for an RTOS.
Interrupts not used by the SoftDevice are always forwarded to the application.
For the SoftDevice to locate the application interrupt vectors, the application must define its interrupt vector
table at the bottom of the Application Flash Region illustrated in Figure 24: Memory resource map on page 59.
When the base address of the application code is directly after the top address of the SoftDevice, the code can
be developed as a standard ARM Registered Cortex Registered -M4 application project with the compiler creating the interrupt
vector table.

Does this mean that the VTOR is not used to change the NVIC vector table address? can someone explain more how this works?

Parents Reply Children
No Data
Related