AnsweredAssumed Answered

Need help understanding CDE's User Types editor

Question asked by Joe Planisky on Jun 3, 2014
Latest reply on Jun 18, 2014 by Petr_H

Hi everyone,


I'm relatively new to Processor Expert and CodeWarrior MCU and have some questions about creating a new component with the Component Development Environment.  I'm using CW MCU Professional Suite 10.6. I've read through the CDE Getting Started and User Guides.


To keep things simple for now, I want to create a simple software-only component.  That is, a component that just does some operations on some data without accessing any MCU features. 


I have many questions, but for now, I'll limit it to questions about the User Types editor.


1. In the list of user-defined types (i.e. the "This defines:" field), is "Alias" essentially the same as a typedef of a simple type?  For example, if I set "Type Name" to "INDEX" and "Is type" to "int", is that the same as having "typedef int INDEX;" somewhere in my code?


2. If my understanding of #1 is correct, how does that affect the generated code?  That is, does PEX generate the "typedef" for me somewhere?  Or do I have to manually add it myself somewhere?  And if so, where?


3. Is the type "Record" just a C struct? 


4. Same as above, does PEX generate the struct definition for me, or do I have to put it in somewhere?  (If it DOESN'T generate the code, why does it need to know about the fields of the struct?)


5. The type "User" seems to be a catch-all for anything that doesn't quite fit any of the other types.  However, the examples given in the User Guide ("typedef int *TIntPtr;" and "typedef struct { float real; float imaginary; } TComplex") seem like they would be handled by "Alias" and "Record" types if my understanding of them is correct, which makes me think my understanding ISN'T correct.  So what is the point of the "User" type?


6. I don't seem to understand what the "Generate to driver" option does.  The User Guide says "If the declaration is generated in the drivers", which makes me think it means that PEX will insert the declarations for me.  But that doesn't seem to be happening.  When I generate code for my component in a project, I don't see the declarations of my structs anywhere.  That makes me think I don't understand what this checkbox is supposed to do.


That's all my questions for now.  I greatly appreciate any help.