volatile/auto variable access for Kinetis MPU (K8x)

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

volatile/auto variable access for Kinetis MPU (K8x)

1,139 次查看
muratcakmak
Contributor II

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?

标记 (3)
0 项奖励
回复
2 回复数

1,002 次查看
jorge_a_vazquez
NXP Employee
NXP Employee

Hi Murat Cakmak

Could you tell us what IDE and MCU are you using? I have tried to replicate what you mention but in my case it rises BUS Fault as expected.

Regards

Jorge Alcala

0 项奖励
回复

1,002 次查看
muratcakmak
Contributor II

The other interesting thing is when build project with ARMCC, it works as expected.

Problem is about GCC compiler.

0 项奖励
回复