Can't get STM32duino Low Power library to compile in Atom PIO

Hi everyone

I’ve been trying to get the STM32duino Low Power library to compile, but I get a long string of errors relating to the RTC library such as:

.pio\libdeps\bluepill_f103c8\STM32duino RTC\src\STM32RTC.cpp: In member function 'void STM32RTC::sy
.pio\libdeps\bluepill_f103c8\STM32duino RTC\src\STM32RTC.cpp:988:5: error: 'hourAM_PM_t' was not de
clared in this scope
  988 |     hourAM_PM_t p = HOUR_AM;
      |     ^~~~~~~~~~~
.pio\libdeps\bluepill_f103c8\STM32duino RTC\src\STM32RTC.cpp:991:38: error: 'p' was not declared in
 this scope
  991 |                  &_alarmSubSeconds, &p, &match);
      |                                      ^
.pio\libdeps\bluepill_f103c8\STM32duino RTC\src\STM32RTC.cpp:990:5: error: 'RTC_GetAlarm' was not d
eclared in this scope; did you mean 'HAL_RTC_GetAlarm'?
  990 |     RTC_GetAlarm(&_alarmDay, &_alarmHours, &_alarmMinutes, &_alarmSeconds,
      |     ^~~~~~~~~~~~
      |     HAL_RTC_GetAlarm
.pio\libdeps\bluepill_f103c8\STM32duino RTC\src\STM32RTC.cpp:992:26: error: 'HOUR_AM' was not decla
red in this scope; did you mean 'HOUR_12'?
  992 |     _alarmPeriod = (p == HOUR_AM) ? AM : PM;
      |                          ^~~~~~~
      |                          HOUR_12
*** [.pio\build\bluepill_f103c8\lib579\STM32duino RTC\STM32RTC.cpp.o] Error 1

I think it’s the same as this issue because the RTC library is a dependency of the low power module. However, I can’t figure out how to get it working.

I’ve tried including the RTC library in the list of lib_deps separately using the GitHub link in the above forum posts, I’ve tried downgrading to version 13 of the ststm32 platform and I’ve been using pio system prune -f and deleting .pio throughout but nothing has had any effect.

Here’s the minimum platformio.ini file that causes the build to fail:

platform = ststm32
board = bluepill_f103c8
upload_protocol = serial
framework = arduino
lib_deps =
  stm32duino/STM32duino Low Power @ 1.0.3

Does anyone have any ideas how I could get it working?

Thank you!

You explicitly select an older version here which is not compatible with the newest core. Have you tried opening a CLIpio platform update ststm32 (to update to the latest platform), then using the latest version per this, aka stm32duino/STM32duino RTC @ ^1.1.0?

To use the older version, which I don’t recommend, you should be using an older platform version which comes with the older Arduino core version, via platformio.ini instructions documented here.

It seems to work now! I updated the platform using the command you specified and changed platformio.ini to use stm32duino/STM32duino Low Power @ ^1.1.0 and it now compiles successfully.

I was using version 1.0.3 because a while ago because I had this issue but I suppose it’s been fixed now.

Thank you!