Pico/RP2040 Watchdog functions undefined reference


I’m unsure if this is a PIO or embed Arduino Core problem but I can not use the Watchdog functions from the Pico-SDK.
if I follow the Watchdog Example I get the error that watchdog_caused_reboot(), watchdog_enable, and watchdog_update are not defined.

I’m trying to understand for a while now to understand the source code structure of the mbed Arduino core but it’s quite confusing. most of the Arduino code is not in the mbed arduino core and I can not find most of the c files in the .platformio\packages\framework-arduino-mbed directory.

Could somebody help me understand how the include/source code structure is?

I can use many of the Pico-SDK functions like multicore_launch_core1 but not all. is this intended?


I found a solution to the watchdog include here

extern "C" {
#include <hardware/watchdog.h>

I still am interested in the source code structure. would like to look into some source code files

Hm, the extern "C" shouldn’t be necessary because the latest SDK has the correct macros in place to place them there in C++ mode.

The ArduinoCore-mbed which PlatformIO is using might however lag behind in SDK updates. When you follow the hardware/watchdog.h file in the IDE (Ctrl+Click on header name), what is the content?

i have the 1.3.0 Version of the PIO core installed. i think that’s the latest one.

About the Watchdog.h the IDE does not find a .c or .cpp file with a definition. i only find .h files.
Go to definition etc does not work.
I searched for the definitions by hand but couldn’t locate them eather

The .c files are not there because they’re hidden inside the precompiled library file (libmbed.a). Only the header is important. Ctrl+Clicking on the watchdog part of the #include <hardware/watchdog.h> line should get you there.

Ah okay thats what i was missing.
Thanks for the info!