HardFault_Handler() at exceptions.c using greenhills compiler plugin with mcal in s32k324

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

HardFault_Handler() at exceptions.c using greenhills compiler plugin with mcal in s32k324

Jump to solution
1,606 Views
xflong
Contributor III

hi,

   when i using greenhills compiler plugin compile the s32k324 mcal program port from s32ds v3.4's example application(Platform_Multicore_SingleElf_S32K324). it compile succeful,but can't run.

when i debug use pe, core0 main enter a hardfault.

who can help me? thanks.

zhangbo1_0-1659433720802.png

 

Tags (1)
0 Kudos
1 Solution
1,534 Views
nxf78987
NXP Employee
NXP Employee

Hi xflongzhang,

I compared your system.c file and this file in the RTD example.  I saw that in your system.c file, the code (in the #ifdef MPU_ENABLE... #endif) didn't execute. I think that you can try to define the MPU_ENABLE in your .mak files (or remove the #ifdef MPU_ENABLE... #endif in your system.c file) and rebuild and test again.

If your program still occur error, you should try to replace your system.c file by this file in the RTD example.

Best regards,

Dan

 

View solution in original post

8 Replies
1,585 Views
nxf78987
NXP Employee
NXP Employee

Hello xflongzhang,

Could you send me your project (including configuration files and code files)?

And what is the package's name you are using?

Best regards,

Dan

0 Kudos
1,580 Views
xflong
Contributor III

it's a multicore single elf project.sdk version (S32DS\software\PlatformSDK_S32K3_2022_03\SW32K3_RTD_4_4_2_0_0_D2203).ghs compiler version 2020.1.4. i change some compiler options,it still doesn't work.

thank you.

0 Kudos
1,566 Views
nxf78987
NXP Employee
NXP Employee

Hello xflongzhang,

I tested your project and I didn't get your error.

nxf78987_0-1660129969503.png

nxf78987_1-1660130035975.png

Are you using the board (which loaded HSE firmware)?

And which is the board and chip you are testing?

Best regards,

Dan

0 Kudos
1,562 Views
xflong
Contributor III

I am using S32K3X4EVB-Q257 ,the chip on the board is S32K344,but it was decoupled,so it is really a S32K324. It has no HSE firmware,I tested the demo "Platform_Multicore_SingleElf_S32K324" from S32DS  v3.4 ,it can work.
Maybe I uploaded the wrong project.But the two cores don't work correct.The correct is two red leds blink.

xflongzhang_0-1660132626679.pngxflongzhang_1-1660132675242.png

 

1,553 Views
nxf78987
NXP Employee
NXP Employee

Hello xflongzhang,

I got your error. I saw that this interrupt is PIT_0_ISR after I check the below registers.

nxf78987_0-1660198846323.png

I didn't why the PIT_0_ISR function didn't install after calling the Platform_Init(NULL_PTR); in the main_core0() function.

I have a solution: you can add the statement calling Platform_InstallIrqHandler function as the below image. After that, rebuild and test again.

nxf78987_1-1660199364540.png

Best regards,

Dan

0 Kudos
1,550 Views
xflong
Contributor III

Hello,Dan,

Thank you very much for your advice. But I still encountered the same problem. Is there anything else wrong?

0 Kudos
1,535 Views
nxf78987
NXP Employee
NXP Employee

Hi xflongzhang,

I compared your system.c file and this file in the RTD example.  I saw that in your system.c file, the code (in the #ifdef MPU_ENABLE... #endif) didn't execute. I think that you can try to define the MPU_ENABLE in your .mak files (or remove the #ifdef MPU_ENABLE... #endif in your system.c file) and rebuild and test again.

If your program still occur error, you should try to replace your system.c file by this file in the RTD example.

Best regards,

Dan

 

1,527 Views
xflong
Contributor III

Hi Dan,

I added MPU_ENABLE to the compiler options, rebuild the program and find that the program can run correctly. It is surprising that the code generated by the same RTD version is different from the example. But the problem was solved.

Thank you.