- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I often find the variable inspector shows 0 values. However, immediately after inspection I printf the values and they are not 0. I can't trust the inspector during breakpoint inspection.
In the attached image, The accel and gyro structures are not in fact all zeros and immediately after the breakpoint they are printed without modification and the output is valid numbers.
The acell/gyro structures contain a union of shorts, raw[3] and {roll,pitch,yaw}, I.e. I can view the roll/pitch/yaw as individual members or as a combined array. Could the union be throwing off the Inspector?
C
- Labels:
-
PSoC 5LP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm not sure to relation Inspector with PSoC5 compiler but,
There might be some difference of them.
In Build Setting, ARM GCC/Compiler/Code Generation
Selective option of Struct Return Method are Register and Memory.
You would like to change this to various options and check it.
For another Custum Option is -fpack-struct[=n]
Following are nonetheless GCC4.1.1 descriptions.
-fpcc-struct-return
Return “short” struct and union values in memory like longer ones,
rather than in registers. This convention is less efficient,
but it has the advantage of allowing intercallability between
GCC-compiled files and files compiled with other compilers,
particularly the Portable C Compiler (pcc).
The precise convention for returning structures in memory
depends on the target configuration macros.
Short structures and unions are those whose size and alignment match that of some integer type.
Warning: code compiled with the -fpcc-struct-return switch
is not binary compatible with code compiled with the -freg-struct-return switch.
Use it to conform to a non-default application binary interface.
-freg-struct-return
Return struct and union values in registers when possible.
This is more efficient for small structures than -fpcc-struct-return.
If you specify neither -fpcc-struct-return nor -freg-struct-return,
GCC defaults to whichever convention is standard for the target.
If there is no standard convention, GCC defaults to -fpcc-struct-return,
except on targets where GCC is the principal compiler. In those cases,
we can choose the standard, and we chose the more efficient register return alternative.
Warning: code compiled with the -freg-struct-return switch is not binary compatible with code compiled with the -fpcc-struct-return switch. Use it to conform to a non-default application binary interface.
-fpack-struct[=n]
Without a value specified, pack all structure members together without holes.
When a value is specified (which must be a small power of two),
pack structure members according to this value,
representing the maximum alignment (that is,
objects with default alignment requirements larger than
this will be output potentially unaligned at the next fitting location.
Warning: the -fpack-struct switch causes GCC to generate code
that is not binary compatible with code generated without
that switch. Additionally, it makes the code suboptimal.
Use it to conform to a non-default application binary interface.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Bob, Thanks. I did make sure all optimizations were off in the compiler and went through all the settings. I am very familiar with GCC and I didn't see anything that could relate to it. I could try adding the volatile keyword or something. This is a global variable so could it be in a different memory bank or so? I have a lot of embedded experience but not on the cypress yet...pretty new.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Psoc73: I tried the Struct Return option both ways. No change. Good one though. The only one I didnt try was the pack-struct. I am not sure if that would work with the Cypress ABI.
I tried the volative keyword too, no luck. No matter what it just won't inspect my structures. Same with another structure that prints out timing info. My printfs work great, but inspecting it in the debugger it's all zeros.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Whether did you use JTAG debugger or SWD debugger?
If SWD, I can make re-examination for that.
I have no idea from my experience.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Bob