- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi there, I am using the RTC component for the first time and was checking the example project associated with it.
This project has a special file alongwith the ".cysch" and ".cydwr" files called ".cyre"
I learnt that this is a "reentrancy file" which contains functions names that can be shared by both interrupt and non -interrupt driven codes.
Can someone shed more clear light on this?
Regards.
Solved! Go to Solution.
- Labels:
-
PSoC 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As long as you observe the rules for reentrancy in your code (do not use global variables, ports or devices) the code generated by GCC is reentrant. I think there is no reentrancy file for PSoC4/5.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Take a look at this, also on this page is a link to an ap note
on the topic.
http://www.cypress.com/?id=4&rID=38637 www.cypress.com/ AN54460
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Reentracy is a problem for the 8051 core only, since its stack is just 256 bytes in size and local variables cannot be kept there as usual compiler strategy would be. So to keep everything going, the compiler builds a structure form your code to get a look at which function's local variables could be used by another function without destroing any needed information. This leeds to problems with interrupts and when using pointers to functions. The local vars will be allocated on a heap-like structure, but accessing them from the code is more complicated than accessing fixed addresses in sram and so the program will run significantly slower.
No similar problems like these on other PSoCs, so when you can spend the money, concentrate on the ARM-core both PSoC5 or 4 offer.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As bob points out, the re-enetrance issues is mainly for PSoC3 core which is 8051 base. We used that for our projects and use the re-entrance code as it doesn't need to be very fast.
It works if you following the instruction but it does slow it down a bit, If you worried about the speed, better use faster PSoC5 which doesn't have the 256 byte stack limitation. Better still is the PSOC3 and PSoC5 are basically PIn to pin compatiable. you can replace a PSOC3 with PSOC5 with very little or no change to the hardware.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As long as you observe the rules for reentrancy in your code (do not use global variables, ports or devices) the code generated by GCC is reentrant. I think there is no reentrancy file for PSoC4/5.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re-entrancy a problem for M8C as well. From the Compiler manual -
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Which manual did you inspect, the ImageCraft compiler did not mention reentrancy, but I found a hint in the manual for changing from Hi-Tech to ImageCraft. It says
The HI-TECH
reentrant keyword enforces the convention of passing parameters through the hardwarereentrant keyword. However, the default ImageCraft functionreentrant convention. This keyword can be removed from
Which in my eyes means: ImageCraft inherently generates reentrant code, as long as you follow the required guidelines for reentrancy. Bob (Forum SW is fooling me. I hope this will stay readable)
stack. ImageCraft does not support the
passing convention matches the HI-TECH
function declarations.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What's Tohu's christion name?
Bohu! Sorry, but the forum SW mangled my post. Pleas re-arrange the lines for best performance.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please do not confuse GOOSE. The image craft and hi-tech compiler are for PSoC1 not PSoC3.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The discussion includes responses to clarify earlier statements like -
"Reentracy is a problem for the 8051 core only,"
and
" As bob points out, the re-enetrance issues is mainly for PSoC3 core which is 8051 base."
and
"Please do not confuse GOOSE. The image craft and hi-tech compiler are for PSoC1 not PSoC3."
Lets let Goose tell us if he is confused.
In gneral threads are, as y7ou know, multifacted, not constrained to one specifc characteristic.
We have many threads in a specific family discussing other families and their relevance, compari-
son, etc..
Regards, Dana.
PS : I see by Goose's last post he is not confused.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
My apologies to incorrectly use thr word ’ONLY’. at that time I was thinking about PSoC3 and PSoC5. My bad.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hey guyz...I am having some problem with the RTC.....to be honest its really small…..I even feeI bad asking it…but I am lost here!!!!!!!!
I tried the RTC example project and it worked properly [I could see the clock moving on the LCD.].
Now when I try to duplicate this project..I see the initial values on the LCD ..BUT the clock doesn't move forward.
I simply copied the RTC example project as follows.....
------copied the .c code.
------added the "utils" header files.
------adjusted all the clock settings.
------& finally, I also added the ".cyre reentrancy" file.
But still the problem persists.
I know I must be missing some minute detail...I've searched all day today and couldn't find any difference with the example project.
Here's my project. Are there some more settings required for the RTC?...What am I possibly missing?
Regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Goose,
Within your main loop "while(1u)" you do not update the display, that's all.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@BoB........like I said earlier I've simply copied the c code from the RTC example project [which works properly]....so that can't be the problem.
Regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The RTC example uses PSoC3. And your project is PSOC5 LP.
When you said the example works. Were you using PSoC3 or PSoC5?
If you used PSoC3 for the examples porject., Had you test your new project with PSoC3?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am not saying it is the problem, just to collect more information.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes Sir, I tested the code on PS0C 3 only...[and like you said, it shouldn't be a problem.]
Regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You better ought to beleve me!
The original program for PSoC3 used the RTC interrupt routine to display all data on the LCD. You stepped into the trap of changing to PSoC5 which generates all modules anew and so not including the alterations made for PSoC3
I suggest you to update the clock in the main-loop (and not in the interrupt-routine) which will prevent you from having the same error again when switching to a PSoC4.
Have a look into the RTC_INT.c files both in PSoC3 and PSoC3 branch.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Mis-typed:
do not update the clock, but update the display.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@BoB......I've tried the code on PSoC 3 as well.....still the problem was there!!!
Anyways, I'll try to update the display in main() and see what happens!!
Regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
oh...cant believe it...problem solved!!!!!
I checked the RTC_INT.c files in both the RTC example project and my test project [which was a copy of example project only]. It turns out both were slightly different. Even though both the projects were on PSoC 3.
Instead of changing my main(), I replaced my RTC_INT.c file with that of the example project and well, it worked.
---------------------------------------------
I dont get one thing though.......when we update our component pack in PSoC Creator and open an example project, will it not contain the latest version of the component.........I mean how could the generated RTC_INT.c files be different?
Regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If there are problems with the project, check what are the changes were and re-work with the changes one at a time.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I dont have any problems with the project.......I just wanna ask that :
When we take a RTC component in the schematic and build it, its following files are generated...
1. RTC.c
2. RTC.h
3. RTC_INT.c
Now if a component has been updated, then the new version will produce some modified files......I agree!!
But how come the RTC component in the example project contains a different RTC_INT.c file?
In my opinion, if a component is updated, then its example projects should also be modified!!!!
Regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In general you are correct, when component is updated so should all
appropriate project files. Looks like this one missed. Consider filing
a "CASE" so that it gets updated.
"www.cypress.com"
"Support"
"Technical Support"
"Create a Case"
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
cant believe this was the only problem that was there....i spent an entire day trying to figure out what was wrong with my code!!!
Thanks guyz!!