Hardfault debugging with S32DS_3.4

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

Hardfault debugging with S32DS_3.4

跳至解决方案
521 次查看
OliverTian
NXP Employee
NXP Employee

Hello,

If you met hardfault when debugging with S32DS 3.4, you can do the follow steps and find the information where triggered the hardfault.

 

  1. Copy the follows data into notepad and save as ‘.gdbinit’


    define armex

      printf "EXEC_RETURN (LR):\n"

      info registers $lr

     

      if (((unsigned int)$lr & 0x4) == 0x4)

      printf "Uses PSP 0x%x return.\n", $psp

      set $armex_base = (unsigned int)$psp

      else

      printf "Uses MSP 0x%x return.\n", $msp

      set $armex_base = (unsigned int)$msp

      end

      printf "xPSR            0x%x\n", *($armex_base+28)

      printf "ReturnAddress   0x%x\n", *($armex_base+24)

      printf "LR (R14)        0x%x\n", *($armex_base+20)

      printf "R12             0x%x\n", *($armex_base+16)

      printf "R3              0x%x\n", *($armex_base+12)

      printf "R2              0x%x\n", *($armex_base+8)

      printf "R1              0x%x\n", *($armex_base+4)

      printf "R0              0x%x\n", *($armex_base)

       

      printf "Return instruction:\n"

      x/i *($armex_base+24)

      printf "LR instruction:\n"

      x/i *($armex_base+20)

    end

     document armex

    ARMv7 Exception entry behavior.

    xPSR, ReturnAddress, LR (R14), R12, R3, R2, R1, and R0

    end

     



  2. Place the file into the folder of S32DS_3.x, like C:\NXP\S32DS_3.4\S32DS\build_tools

  3. In S32DS, S32DS –> Window –> Performances –> Debug –> GDB –> GDB command file
    Set as below
    OliverTian_2-1744856832689.png

     

  4. Debug as general and when meet hardfault, you can input armex in Debugger Console to get more information from stack
    OliverTian_3-1744856832740.png

 

Cheers!

Oliver

 

0 项奖励
回复
1 解答
519 次查看
OliverTian
NXP Employee
NXP Employee

Hope this will help you.

在原帖中查看解决方案

0 项奖励
回复
1 回复
520 次查看
OliverTian
NXP Employee
NXP Employee

Hope this will help you.

0 项奖励
回复