Raising BASEPRI on M7 port (v9.0.0) is done as below:
#define portDISABLE_INTERRUPTS() vPortRaiseBASEPRI()
static portFORCE_INLINE void vPortRaiseBASEPRI( void )
{
uint32_t ulNewBASEPRI = configMAX_SYSCALL_INTERRUPT_PRIORITY;
__asm
{
/* Set BASEPRI to the max syscall priority to effect a critical
section. */
cpsid i
msr basepri, ulNewBASEPRI
dsb
isb
cpsie i
}
}
Could you explain the need for a DSB?
Additionally, I understand that ISB is used to ensure that when this function returns, the BASEPRI change is observed. However this makes sense only if ISB is placed after “cpsie i” instruction so that the PRIMASK clear is also observed.
The cpsid/cpsie instructions are a workaround to a silicon errata and
are only required if the revision of the core is r01p, otherwise use the
Cortex-M4F port layer. I imagine the errata docs will be the only place
they are mentioned.
On the M3 and M4 it is actually after the next instruction: “MSR
side-effects are visible after one further instruction is executed”. I
believe it is different on the M7 though and will have to look it up.
The M4F port was updated so it could also be used on an M7.
So, for M3/4 at least, removing the DSB instruction means that the side-effects will be visible after the ISB instruction, which is what we want. So it looks that practically there is no need for a DSB.
I will be waiting for your findings on M7 as well. Many thanks again for the help.