Hello,
We have a function SUP_UpdateTargetRudderAngle() which is called in interrupt context and when Process Id (PID) is 1:
void SUP_UpdateTargetRudderAngle(DEG20 tra)
{
// Process ID are used as filtering criteria by MPU (memory protection)
set_pid( 2u );
va_SUP_TargetRudderAngle = tra;
va_SUP_TargetRudderAngleTime = 0u;
// Restore Process ID afterwards
set_pid( 1u );
}
Variables va_SUP_TargetRudderAngle and va_SUP_TargetRudderAngleTime are allocated to RAM at addresses (from map-file):
va_SUP_TargetRudderAngleTime 400011f2
va_SUP_TargetRudderAngle 400011f4
Our CMPU configuration is shown in attached MMU.DUMP TLB2.png.
An IVOR2 (Data storage) exception occurrs when va_SUP_TargetRudderAngle is accessed in function UpdateTargetRudderAngle(). Please see attached Lauterbach Trace32 screenshot, IVOR2.png. As shown PID = 2 and DEAR = 0x400011F4 (va_SUP_TargetRudderAngle).
But, it shouldn't be any CMPU vialoation and IVOR2 at this acccess as PID = 2?
But, if adding some code according to below there is no exception occurring.
Is it possible for someone to explain this behavior?
void SUP_UpdateTargetRudderAngle(DEG20 tra)
{
UINT32 pid;
// Process ID are used as filtering criteria by MPU (memory protection)
set_pid( 2u );
pid = get_spr(48);
while (pid != 2u)
{
// Wait...
}
va_SUP_TargetRudderAngle = tra;
va_SUP_TargetRudderAngleTime = 0u;
// Restore Process ID afterwards
set_pid( 1u );
}
Best Regards,
Peder Rogö