CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Nube question

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
levelzero
Guest







Nube question
PostPosted: Fri Nov 05, 2004 4:03 pm     Reply with quote

I'm trying to compile some prewritten C code with the pcm ccs compiler on linux. The code has a section:
Code:

#define  set_packet(d,s) packet[d] = make8(s,3);   \
                           packet[d+1] = make8(s,2); \
                           packet[d+2] = make8(s,1); \
                           packet[d+3]= make8(s,0);

later, set_packet is used like:
set_packet32(TCP_seqnum,my_seqnum)

I don't actually know what set_packet is... is it a structure?...
The ccs compiler I have sits forever when the
set_packet32(TCP_seqnum,my_seqnum)
is executed. It doesn't give an error, but just spins away forever. I tested it by putting a garbage identifier in front and after the code. In front of it I got the appropriate error. Also, I verified the compiler functionality by compiling several example programs. I don't know what version of CCS I have, but the manual says July 2001.
I am not really a beginner programmer, but my C is not very good. Any help that anyone could offer would greatly reduce my blood presure.
Thanks!

L0
Ttelmah
Guest







Re: Nube question
PostPosted: Fri Nov 05, 2004 4:19 pm     Reply with quote

levelzero wrote:
I'm trying to compile some prewritten C code with the pcm ccs compiler on linux. The code has a section:
Code:

#define  set_packet(d,s) packet[d] = make8(s,3);   \
                           packet[d+1] = make8(s,2); \
                           packet[d+2] = make8(s,1); \
                           packet[d+3]= make8(s,0);

later, set_packet is used like:
set_packet32(TCP_seqnum,my_seqnum)

I don't actually know what set_packet is... is it a structure?...

No. It is a _macro_. As such it has no 'identity' itself. The line is replaced with the data in the definition. So in cour case, the single line given, is replaced with:
packet[TCP_segnum] = make8(myseqnum,3);
packet[TCP_segnum+1] = make8(myseqnum,2);
packet[TCP_segnum+2] = make8(myseqnum,1);
packet[TCP_segnum+3] = make8(myseqnum,0);

Quote:

The ccs compiler I have sits forever when the
set_packet32(TCP_seqnum,my_seqnum)
is executed. It doesn't give an error, but just spins away forever. I tested it by putting a garbage identifier in front and after the code. In front of it I got the appropriate error. Also, I verified the compiler functionality by compiling several example programs. I don't know what version of CCS I have, but the manual says July 2001.
I am not really a beginner programmer, but my C is not very good. Any help that anyone could offer would greatly reduce my blood presure.
Thanks!

L0


There is nothing in the code shown, that would cause the compiler to take more than a very few instruction cycles. The only likely problem, is if the definitions of TCP_seqnum, or my_seqnum, were pointing to data of the wrong type, or in the wrong location (there is no 'bounds' checking in this C).
The version number is available in the 'help about' pull down (on the windowed version). On the command line compiler, +V, gives the version. Though this does not sound lterribly ike a compiler problem, if the version is more than perhaps 6 months old, it could well be the problem...

Best Wishes
Guest








PostPosted: Fri Nov 05, 2004 4:25 pm     Reply with quote

Ahhh. A macro, that makes more sense. The version is:
PCM compiler version 3.055
If that helps.
Thanks for your reply.
L0
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Fri Nov 05, 2004 4:56 pm     Reply with quote

Not sure if this was a typo on your part but

set_packet(d,s) is not the same as set_packet32(TCP_seqnum,my_seqnum)
levelzero
Guest







PostPosted: Fri Nov 05, 2004 6:20 pm     Reply with quote

yeah, that was a typo. I'm going to try to replace all the macros with the code and see if that helps.
L0
levelzero
Guest







PostPosted: Fri Nov 05, 2004 6:53 pm     Reply with quote

Ok, so I reduced the code to:
Code:

#define  WpppL(pp_port,datum)    writeaddrport(pp_port);   \
                                 writedataport(datum);   \
                                 clr_aen;               \
                                 clr_iow;               \
                                 delay_cycles(1);       \
                                 set_iow;               \
                                 set_aen;
main() {

   int source;
   WpppL(0x02,0x02);
   
}

I'll include my defines if you would like, but they all appear to be fine. The compiler does the exact same thing, it just sits there and spins away.
Here's the command line response that it displays:
Code:

xxxx@xxxx > ./ccsc  +FM xp1.c
CCS PCM C Compiler
Registered to: Reference Number, xxxxx
Compiling: xp1.c
in /bin/picc/

I think those command line switches are good. I don't really see what's wrong. Is this a bug with my version. It's most likely a bug with me, however, all I'm trying to compile is the source from EDTP's packet whacker, so I'm pretty sure that it is good.
Thanks in advance.
L0
Ttelmah
Guest







PostPosted: Sat Nov 06, 2004 3:03 am     Reply with quote

Anonymous wrote:
Ahhh. A macro, that makes more sense. The version is:
PCM compiler version 3.055
If that helps.
Thanks for your reply.
L0

Unfortunately, 3.055, is very old. The 'late' version 2 compilers were fairly OK, for the 16 family chips, but when the version 3 compilers came out, a lot of problems were introduced. I'd rate low "70's", as being perhaps the earliest ones that were reasonably useable for the 16 chips, and mid "100's", as the lowest for the 18 chips (perhaps .148).
Hence it is possible that you are seeing a compiler problem.
Seperately, there is a question of whether the code was written for the chip you are using?. Though the compiler makes it fairly easy to 'port' code between chips, there are restrictions, and (for example), data structures can be larger on the 18 chips, than on the 16 units, and if you are trying to use code written for the bigger chips, this could cause problems.

Best Wishes
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group