How to detect boot type (ESP32 S3)

I have a project that also includes a Task Watch Dog Timer (WDT) timeout to prevent lockup. What I'm trying to do is detect at boot time what sort of restart is happening, whether its a normal boot/reset or a WDT reset. I've noticed the following boot messages on the serial console:

Power On or Reset Button: console shows rst:0x1 (POWERON)

WDT reboot : console shows rst:0xc (RTC_SW_CPU_RST)

Is there any way to read these parameters and bootloader messages from software at boot time in the Arduino environment to detect the boot type?

I want to customise the Arduino setup() differently for each.

Thanks

See if work for you

That's fantastic, just what I was looking for. I searched for quite a while but obviously I wasn't searching for the correct terms.

Thank you very much for your help.