RP2040 Connect + PlatformIO + RP2040_RTC build failure

Wow, amazing, it works. Nice debugging :slight_smile: I get that itā€™s a dirty hack but at least itā€™s a good start.

What is a mystery to me is that why does it work with the Arduino IDE and not with pio?

Slight differences in linking order (which there are in comparison to the Arduino IDE), compiler flags or compiler version can shuffle the stack around enough to cause a difference in stack memory and set the value of dotw to a value outside the 0-6 range and thus fail verification. The base problem is the code not initializing the datatstructureā€™s dotw field, leading to undefined behavior.

I can open an issue or directly a PR about this with a fixed version. Setting it to zero doesnā€™t seem correct, especially since the rtc_set_datetime function writes it in the RTC registers. But then, the entire time in the Arduino IDE , correctness was also more based on luckā€¦

1 Like

Thanks for the explanation, I am more than happy to open an issue, donā€™t worry about that.

As before, many thanks for debugging and looking into this super quickly :slight_smile:

I was faster already, opened at Library converts datetime_t incorrectly, causing example to fail Ā· Issue #4 Ā· khoih-prog/RP2040_RTC Ā· GitHub :smiley:

No problems :slight_smile:

The bug has been properly fixed in v1.0.7 to fix bug in rtc_set_datetime() Ā· khoih-prog/RP2040_RTC@de19cbf Ā· GitHub. The new 1.0.7 version should be visible in https://platformio.org/lib/show/12433/RP2040_RTC/installation soon, or directly via referencing https://github.com/khoih-prog/RP2040_RTC.git.

1 Like

Yeah, thanks to both of you :slight_smile: