Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > PSoC® Software > Creator 2 and CYREENTRANT

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



Creator 2 and CYREENTRANT
Moderator:
JFMD

Post Reply
Follow this topic



Creator 2 and CYREENTRANT

Bob Marlowe posted on 18 Jan 2012 3:14 AM PST
Top Contributor
1768 Forum Posts

Hi,

unfortunately when a  function is declared as reeantrant (with CYREENTRANT) it is not possible to watch local variables when debugging. Is there a magic trick to get some more insight into that?

Regards, Bob




Re: Creator 2 and CYREENTRANT

Robert-CY posted on 23 Jan 2012 01:31 PM PST
Cypress Employee
129 Forum Posts

Hi Bob,

we are going to investigate this issue.

Were you working with a PSoC 3 or a PSoC 5 when this problem showed up?

If PSoC 5, did you use the Keil uVision or the Creator integrated debugger?

This would be good information to have.

Robert



Re: Creator 2 and CYREENTRANT

Bob Marlowe posted on 23 Jan 2012 01:46 PM PST
Top Contributor
1768 Forum Posts

I used a PSoC3 part wit a Kit001and the Keil-compiler. I cannot switch to a PSoC5 part to test in the next few days.

Regards, Bob



Re: Creator 2 and CYREENTRANT

yfs posted on 24 Jan 2012 10:38 AM PST
Cypress Employee
77 Forum Posts

I have to believe this is a PSoC 3 issue - the 8051 stack architecture creates the need for the REENTRANT option. Do let us know if you see the same thing on PSoC 5 - I have been wrong before!!!

What compiler optimizations do you have? I am using level 2 for size and it works OK.

Are you using the Locals window or adding your local to the Watch window? Do you get a message like "The name 'loc' does not exist in the current context"?

- Mark

 



Re: Creator 2 and CYREENTRANT

Bob Marlowe posted on 24 Jan 2012 12:24 PM PST
Top Contributor
1768 Forum Posts

Using Keil 9,03 Optimization Level 0 (zero) (during Debug)

I used the locals window and when I didn't see any vars, I tried to add a watch, but the name I clicked right on didn't allow for a watch-var. No error-messages as far as I remember. Presumably you are right with the architecture of the 8051 when using reentrant code, but I do need it for a RTOS for PSoC 3. No time this week to test it with a PSoC 5, sorry.

Regards, Bob



Re: Creator 2 and CYREENTRANT

yfs posted on 26 Jan 2012 07:06 AM PST
Cypress Employee
77 Forum Posts

I didn't mean to imply there was anything wrong with writing reentrant code on an 8051. There was just a little confusion as to whether you were on a PSoC 3 or a 5. I was just saying that I thought you were on a PSoC 3.

 

The issue behind this is the small stack size on the 8051 which runs out of space quickly if you pass parameters that way (i.e. the normal C way). To avoid stack overflow the Keil compiler assumes functions are not reantrant and allocates static addresses for them. This is fine and dandy, and quite clever, most of the time but fails badly if your function gets called from ISRs because the variables get corrupted when the ISR fires while you were in that function.

 

One solution is to change the way all functions are handled but that is a big RAM cost. The CYREENTRANT keyword turns on reentrancy for those functions that use it only. Anyway, you probably know all that and just want to figure out what the debugger is up to... !

 

What kind of variable is it? A simple int or a struct or whatever? Have you declared it volatile? Can you watch, or see in locals, other variables? I tried this out and had no problems - I am just looking for clues as to what is going on.

 

- Mark

 



Re: Creator 2 and CYREENTRANT

Bob Marlowe posted on 26 Jan 2012 10:30 AM PST
Top Contributor
1768 Forum Posts

That is a VERY interesting one: you say showing local vars in reentrant functions under Designer 2.0 for PSoC3 devices work for you - and not for me. I'll have to post a demo - project. Hold on, stay tuned, I'll be back right after the break

Bob



Re: Creator 2 and CYREENTRANT

Bob Marlowe posted on 26 Jan 2012 02:50 PM PST
Top Contributor
1768 Forum Posts

Here we are: set a breakpoint in "Function()" and look at the locals.

Hop you see the same as I do: nuts

Bob



Re: Creator 2 and CYREENTRANT

yfs posted on 30 Jan 2012 09:53 AM PST
Cypress Employee
77 Forum Posts

I think we have a defect. I tried a few different ways of tricking the debugger into showing me the locals but the use of CYREENTRANT seems to prevent them from showing up. I can see function arguments, but not locals. You sent a really simple example and my first thought was that the variables were getting optimized out... but it happens even when the locals are absolutely needed.

I have created an internal case to get this addressed. If you need/want to get notification when it is fixed please open a tech support case and refer your contact to "CDT 118339".

-- Mark.

 






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