cancel
Showing results for 
Search instead for 
Did you mean: 

How to catch and handle M4 watchdog crashes on Linux side?

Mario Luzeiro
Senior

I managed to make the M4 WWDOG to work.

I got on Linux cmd line:

remoteproc remoteproc0: crash detected in m4: type watchdog

How can I catch and handle this events programmatically on a shell script, C or Python ?

1 ACCEPTED SOLUTION

Accepted Solutions
ArnaudP
Senior

Hello Mario,

Different strategies are possible.

1) The polling method

  • disable the auto recovery
echo disabled >/sys/class/remoteproc/remoteproc0/recovery
  • poll the remoteproc state, looking for the "crashed" stated
cat /sys/class/remoteproc/remoteproc0/state
  • recover the M4
echo recover >/sys/class/remoteproc/remoteproc0/recovery 

2) Use coredump trigger

An event is sent to the userspace application on crash to save the coredump, this can also be used to detect the crash

Details and link to udev script are available on this page:

https://wiki.st.com/stm32mpu/wiki/How_to_retrieve_Cortex-M4_logs_after_crash

3) Create your own udev trigger based on virtio device add/remove ( work only if you use RPMsg)

this page provide details on how to implement it:

https://www.tecmint.com/udev-for-device-detection-management-in-linux/

The rules to implement is:

SUBSYSTEM=="virtio", ACTION=="add",   RUN+="/bin/device_added.sh"
SUBSYSTEM=="virtio", ACTION=="remove", RUN+="/bin/device_removed.sh"

4) tips to ease your test

you can simulate a watchdog crash using following command:

echo 1 >/sys/kernel/debug/remoteproc/remoteproc0/crash

Regards,

Arnaud

View solution in original post

1 REPLY 1
ArnaudP
Senior

Hello Mario,

Different strategies are possible.

1) The polling method

  • disable the auto recovery
echo disabled >/sys/class/remoteproc/remoteproc0/recovery
  • poll the remoteproc state, looking for the "crashed" stated
cat /sys/class/remoteproc/remoteproc0/state
  • recover the M4
echo recover >/sys/class/remoteproc/remoteproc0/recovery 

2) Use coredump trigger

An event is sent to the userspace application on crash to save the coredump, this can also be used to detect the crash

Details and link to udev script are available on this page:

https://wiki.st.com/stm32mpu/wiki/How_to_retrieve_Cortex-M4_logs_after_crash

3) Create your own udev trigger based on virtio device add/remove ( work only if you use RPMsg)

this page provide details on how to implement it:

https://www.tecmint.com/udev-for-device-detection-management-in-linux/

The rules to implement is:

SUBSYSTEM=="virtio", ACTION=="add",   RUN+="/bin/device_added.sh"
SUBSYSTEM=="virtio", ACTION=="remove", RUN+="/bin/device_removed.sh"

4) tips to ease your test

you can simulate a watchdog crash using following command:

echo 1 >/sys/kernel/debug/remoteproc/remoteproc0/crash

Regards,

Arnaud