AnsweredAssumed Answered

volatile/auto variable access for Kinetis MPU (K8x)

Question asked by Murat Cakmak on Jan 8, 2017
Latest reply on Jan 13, 2017 by Jorge Antonio Alcala Vazquez

Hello,

Interestingly, volatile and auto variables show different behaviours with Kinetis Custom MPU HW module.

 

BUS fault is rised only with volatile variable access. Please see following combinations.

 

#define RESTRICTED_ADDRESS       0x2001000

 

/* OK! Rises BUS Fault */

volatile uint32_t val = *(volatile uint32_t*)RESTRICTED_ADDRESS;

 

/* OK! Rises BUS Fault */

volatile uint32_t val = *(uint32_t*)RESTRICTED_ADDRESS;

 

/* OK! Rises BUS Fault */

uint32_t val = *(volatile uint32_t*)RESTRICTED_ADDRESS;

 

/* UPS!!!!!!!!!!!!!!! No BUS Fault Exception, continues to execution */

uint32_t val = *(uint32_t*)RESTRICTED_ADDRESS;

 

Any idea? Any limitation on Kinetis Custom MPU?

Outcomes