In the past, you need modify rtc_api.c in mbed-dev source code. From this revision, you can just use RTC function all of conditions (Normal, Reset, Stand-by, Power OFF).
Note
From now on, you do NOT need any modification for mbed-dev library because STM team updates rtc_api.c source code and support RTC function under reset & standby condition includes power off condition (You need additional VBAT back-up hardware).
Please refer following NOTE information.
/users/kenjiArai/notebook/nucleo-series-rtc-control-under-power-onoff-and-re/
Diff: uart_as_stdio/uart_as_stdio.h
- Revision:
- 14:4b03106ece1f
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uart_as_stdio/uart_as_stdio.h Sat Mar 06 08:29:51 2021 +0000 @@ -0,0 +1,18 @@ +/* + * mbed Application program + * Redirect Standard Input/Output + * + * Copyright (c) 2021 Kenji Arai / JH1PJL + * http://www7b.biglobe.ne.jp/~kenjia/ + * https://os.mbed.com/users/kenjiArai/ + * Created: January 13th, 2021 + * Revised: January 14th, 2021 + */ + +#include "mbed.h" + +// Function prototypes -------------------------------------------------------- +uint8_t readable(void); +void putc(uint8_t c); +uint8_t getc(void); +void sleep_preparation(void);