Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > PSoC® 5 > RTC uses too much program memory...

Bookmark and Share
Cypress Developer CommunityTM
Forums | Videos | Blogs | Training | Rewards Program | Community Components



RTC uses too much program memory...
Moderator:
ANCY

Post Reply
Follow this topic



RTC uses too much program memory...

Helmut posted on 19 Oct 2012 10:56 AM PST
Top Contributor
48 Forum Posts

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.

Thanks.




Re: RTC uses too much program memory...

Bob Marlowe posted on 19 Oct 2012 12:40 PM PST
Top Contributor
1768 Forum Posts

Did you set under Project -> Build Settings -> Linker -> General -> Remove unused Functions ?

The RTC is not a good example for reducing code space. Easiest self-made will be a timer that fires every ms. In the ISR increment a 64-bit var which will give you time enough (32 bit is aprox. a year). Do not forget to read the timer state-register in the ISR to clear the interrupt.

 

Bob



Re: RTC uses too much program memory...

Helmut posted on 19 Oct 2012 12:54 PM PST
Top Contributor
48 Forum Posts

 Thx again, Bob.  Will that work through sleep on PSoC5?



Re: RTC uses too much program memory...

Bob Marlowe posted on 19 Oct 2012 01:39 PM PST
Top Contributor
1768 Forum Posts

There is NO clock running in sleep mode except the unaccurate ILO which can be trimmed to be more exact. I've recently read about that...  Yes, AN80248 Have a look here http://www.cypress.com/?rID=67061 

 

Bob






ALL CONTENT AND MATERIALS ON THIS SITE ARE PROVIDED "AS IS". CYPRESS SEMICONDUCTOR AND ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY OF THESE MATERIALS FOR ANY PURPOSE AND DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THESE MATERIALS, INCLUDING BUT NOT LIMITED TO, ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT OF ANY THIRD PARTY INTELLECTUAL PROPERTY RIGHT. NO LICENSE, EITHER EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, IS GRANTED BY CYPRESS SEMICONDUCTOR. USE OF THE INFORMATION ON THIS SITE MAY REQUIRE A LICENSE FROM A THIRD PARTY, OR A LICENSE FROM CYPRESS SEMICONDUCTOR.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms and Conditions of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms and Conditions of this site. Cypress Semiconductor and its suppliers reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Spec No: None; Sunset Owner: GRAA; Secondary Owner: RAIK; Sunset Date: 01/01/20