S32K312 put stack in dtcm then run into hardfault

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

S32K312 put stack in dtcm then run into hardfault

172件の閲覧回数
jhuang1
Contributor I

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 返答(返信)

114件の閲覧回数
davidtosenovjan
NXP TechSupport
NXP TechSupport

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

0 件の賞賛

112件の閲覧回数
jhuang1
Contributor I

Hi davidtosenovjan, which descriptors do you mean? 

0 件の賞賛

110件の閲覧回数
davidtosenovjan
NXP TechSupport
NXP TechSupport

MPU region configurations.

0 件の賞賛

82件の閲覧回数
jhuang1
Contributor I

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

0 件の賞賛