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
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