S32K312 put stack in dtcm then run into hardfault

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

S32K312 put stack in dtcm then run into hardfault

446 次查看
jhuang1
Contributor II

Hi, I transportted my original program driver to RTD 4.0.0 from RTD 2.0.3. The demo startup file and demo ld file base on RTD 4.0.0 allocate the stack to dtcm area, and I thought it useful to save RAM area. But it resultted in a curious trouble that the program may run into hardfault when it stored some data into a stack addess. 

For example, The stack area address I defined at ld file located at 0x20000000~0x20002000.  I defined a struct data in the pit ISR, which has only 42 bytes, and the address of the struct data was allocated at 0x20001e60 in the pit ISR, once the code runs to "str r0, [r4, #0]" which r4 is 0x20001e60, the program then run into the hardfault. If I move the struct data to globle variable, the ISR would run ok.

Another method to avoid this trouble is disabling the MPU, I think I have some mistake on the MPU setting, the dtcm part setting is as below:

jhuang1_0-1717317569927.png

The ld file is uploaded as attachment.

please help me to check out the trouble, thanks a lot.

 

0 项奖励
回复
4 回复数

388 次查看
davidtosenovjan
NXP TechSupport
NXP TechSupport

Hi, don't you have some conflict between descriptors' setup?

0 项奖励
回复

386 次查看
jhuang1
Contributor II

Hi davidtosenovjan, which descriptors do you mean? 

0 项奖励
回复

384 次查看
davidtosenovjan
NXP TechSupport
NXP TechSupport

MPU region configurations.

0 项奖励
回复

356 次查看
jhuang1
Contributor II

I didn't find any conflict in MPU settings. I changed the stack to sram back, it works fine now.

0 项奖励
回复