Here is a summary of my adventure in configuring the PCF8523 real-time clock. I did this with a RasPi-0W and TinyCore version 9.0.3
I'm using the Adafruit PiRTC - PCF8523 Real Time Clock module. While on one hand its socket plugs neatly into the GPIO connector, the socket hides some pins including those for the TTY port as well as +5V power. There are feed through holes, so that with some careful soldering, I was able to solder some pin strips for those otherwise hidden pins.
For libraries, make sure that the following is installed and configured as onboot.
rtc-4.9.22-piCore.tcz
Before editing bootlocal.sh, be sure to try the commands out by hand... First set the system date and time. If your system is connected to the Internet, it should have already used settime.sh to set the date and time.
Otherwise you can manually set the date and time. I used
https://time.is/UTC to get the date and time, then I set the RTC.
$ sudo date -s 2018.01.24-06:21:00
Wed Jan 24 06:21:00 UTC 2018
The following are commands that I typed in to configure the RTC. The hwclock command will report the date and time from the RTC.
$ sudo modprobe rtc-pcf8523
$ echo pcf8523 0x68 | sudo tee /sys/class/i2c-adapter/i2c-1/new_device
$ sudo hwclock --systohc --utc
$ hwclock
At this point edit the /opt/bootlocal.sh file. Insert the following lines at the end.
modprobe rtc-pcf8523
echo pcf8523 0x68 | tee /sys/class/i2c-adapter/i2c-1/new_device
sleep 1s
hwclock -s
Once the text is inserted, be sure to backup. From the command line you can execute filetool.sh -b
In the future if you need to reset the RTC, first set the system date and time then set the RTC. Having the notes in this forum have been a huge help, thanks everyone. If I missed anything, a post will be appreciated.
$ sudo date -s 2018.01.24-06:21:00
Wed Jan 24 06:21:00 UTC 2018
$ sudo hwclock --systohc --utc
$ hwclock