RTC uses too much program memory... | Cypress Semiconductor
RTC uses too much program memory...
I don't need a full-fledged RTC, but I do need to keep track of time of day, including sleeping my PSoC5 that must use the SleepTimer to wake up.
RTC with daylight savings time enabled appears to use more than 9kB. My CY8C5566LTI-017 doesn't have enough rom for this.
RTC with daylight savigns time disabled appears to use nearly 5kB. This barely fits in my CY8C5566LTI-017 rom. So I need a smaller solution.
All I need is an accurate clock and an interrupt. I can count tics on my own to get time of day. Been there, done that, for 30 years.
But how on the PSoC5? It appears that the SleepTimer, that I'm already using for sleep waking and would love to reuse, can only use the ILO. That's not accurate. (In fact, as an aside, it seems to stop somehow when I come out of sleep, without me issuing a stop to the SleepTimer component or attached ISR component. Also, my configured 16ms is 23ms before my first sleep, only 14ms while sleeping, and then stopped after sleeping, and restarting when I go to sleep again without a _Start() call. Wierd)
Anyway, I'm aware of CyXTAL_32KHZ_Start(). Is there some minimal code component I can tie to that, and will continue to run during sleep, so that it can form the basis for my clock? Otherwise, I'm tempted to go hack away at the RTC source to cut out all the waste. The RTC.c is 2515 lines of code!!! (Not sure how to make edits stick, however, given auto code generation.)
QUESTION ONE: What's my best way to count tics for time of day, using minimum program memory, and being able to sleep without losing time?
QUESTION TWO: Back on the RTC taking 5kB subject, referencing only RTC_Start() pulls in all this code. Is the code linked in on a .c unit basis, or function by function per the call tree? In other compilers, I believe it's normally on a .c basis. However, the map here made it look like individual functions are being linked in individually, which suggests that if I don't call them anywhere on my call tree, then they won't get linked in. This could be a clue on how to reduce that 5kB program memory usage of the RTC.