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 support@ccsinfo.com

First USB Program fail to compile

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



Joined: 22 Dec 2004
Posts: 78

View user's profile Send private message

First USB Program fail to compile
PostPosted: Tue Jan 18, 2005 9:29 pm     Reply with quote

Hi..

I got CCS USB Development Kit. And I am trying to run following first program
for testing USB enumeration.

Though it is simple it is giving list of errors which I have also posted at the last.
I think there might be some path missing or some thing missing it the code.

Can anybody figure out the problem?

Quote:


#include <16F877a.h>
#device *=16
#fuses HS, NOWDT, NOPROTECT, NOLVP
#use delay(clock=20000000)

#define LED_1 PIN_B5
#define LED_2 PIN_B4
#define LED_3 PIN_B3
#define BUTTON PIN_A4

#include <usbn960x.c>
#include <usb.c>

void main(void)
{

/*
output_low(LED_1);
output_high(LED_1);

usb_init();

while(TRUE)
{
while(!usb_enumerated()) {}
output_low(LED_3);

while(!usb_enumerated()) {}
output_high(LED_3);

}

*/

}






And while I tried to compile this, it is giving following errors.

Quote:


Clean: Deleting intermediary and output files.
Clean: Deleted file "CCSBoard4.$$$".
Clean: Deleted file "CCSBoard4.ERR".
Clean Warning: File "C:\prashant\CCSUSB\CCSUSBTest4\CCSBoard4.o" doesn't exist.
Clean: Done.
Executing: "C:\Program Files\PICC\Ccsc.exe" "CCSBoard4.C" +FM +DF +LN +T -A +M +Z +Y=9 +EA
*** Error 125 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 49(12,34): Duplicate #define
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 49(35,36): Expecting a declaration
*** Error 12 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 66(10,29): Undefined identifier USB_DEVICE_DESC_LEN
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 67(10,14): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 67(14,15): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 68(10,14): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 68(14,15): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 68(15,19): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 68(19,20): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 69(10,14): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 69(14,15): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 70(10,14): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 70(14,15): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 71(10,14): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 71(14,15): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 72(35,36): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 72(35,36): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 73(10,14): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 73(14,15): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 73(15,19): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 73(19,20): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 74(10,14): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 74(14,15): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 74(15,19): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 74(19,20): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 75(10,14): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 75(14,15): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 75(15,19): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 75(19,20): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 76(10,14): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 76(14,15): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 77(10,14): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 77(14,15): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 78(10,14): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 78(14,15): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 79(32,33): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 80(4,5): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 80(5,6): Expecting a declaration
*** Error 12 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 91(10,29): Undefined identifier USB_CONFIG_DESC_LEN
*** Error 48 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 92(10,29): Expecting a (
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 93(30,31): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 93(30,31): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 93(31,32): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 93(32,33): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 94(28,29): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 94(28,29): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 95(10,14): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 95(14,15): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 96(10,14): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 96(14,15): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 97(10,14): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 97(14,15): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 98(10,14): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 98(14,15): Expecting a declaration
*** Error 48 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 101(10,32): Expecting a (
*** Error 48 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 102(10,32): Expecting a (
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 103(10,14): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 103(14,15): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 104(10,14): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 104(14,15): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 105(27,28): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 105(27,28): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 106(10,14): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 106(14,15): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 107(10,14): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 107(14,15): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 108(10,14): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 108(14,15): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 109(10,14): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 109(14,15): Expecting a declaration
*** Error 48 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 112(10,28): Expecting a (
*** Error 48 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 113(10,28): Expecting a (
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 114(10,14): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 114(14,15): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 114(15,19): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 114(19,20): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 115(10,14): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 115(14,15): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 116(10,14): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 116(14,15): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 117(10,14): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 117(14,15): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 118(26,27): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 118(26,27): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 118(28,32): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 118(32,33): Expecting a declaration
*** Error 48 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 121(10,31): Expecting a (
*** Error 48 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 122(10,31): Expecting a (
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 123(10,14): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 123(14,15): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 124(10,14): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 124(14,15): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 125(10,14): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 125(14,15): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 125(15,19): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 125(19,20): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 126(10,12): Expecting a declaration
*** Error 43 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 126(12,13): Expecting a declaration
*** Error 48 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 129(10,31): Expecting a (
*** Error 48 "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 130(10,31): Expecting a (
*** "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 131: Error #43: Expecting a declaration
*** "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 131: Error #43: Expecting a declaration
*** "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 132: Error #43: Expecting a declaration
*** "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 132: Error #43: Expecting a declaration
*** "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 133: Error #43: Expecting a declaration
*** "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 133: Error #43: Expecting a declaration
*** "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 133: Error #43: Expecting a declaration
*** "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 133: Error #43: Expecting a declaration
*** "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 134: Error #43: Expecting a declaration
*** "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 136: Error #43: Expecting a declaration
*** "C:\PROGRA~1\PICC\drivers\usb_desc.h" Line 136: Error #43: Expecting a declaration
*** "C:\PROGRA~1\PICC\drivers\usb.c" Line 849: Error #12: Undefined identifier USB_STRING_DESC_OFFSET
*** "C:\PROGRA~1\PICC\drivers\usb.c" Line 850: Error #12: Undefined identifier USB_STRING_DESC
*** "C:\PROGRA~1\PICC\drivers\usb.c" Line 923: Error #12: Undefined identifier USB_STRING_DESC
Halting build on first failure as requested.
BUILD FAILED: Wed Jan 19 16:27:46 2005

Guest








Compiled OK here
PostPosted: Tue Jan 18, 2005 9:41 pm     Reply with quote

I copy/pasted your code and it compiled error free.
I'm using V3.216
Mark



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

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

PostPosted: Tue Jan 18, 2005 9:49 pm     Reply with quote

Code compiled just fine for me.
prayami



Joined: 22 Dec 2004
Posts: 78

View user's profile Send private message

PostPosted: Thu Jan 20, 2005 4:56 pm     Reply with quote

Hi..

I found the reason but don't know what to do with that.
It is the problem in the driver files which are with me.

I purchased PCH compiler on 1st December 2004. I don't know which
version is it because I got it by downloading it from the site.
And in the software(PCH Compiler) I got, no where written about the
version.

Let me take only two files USB.H and USR_DESC.H

In the file USB.H, I found the following #define statements. It seems that the old
version of the compiler got different define variable name than in the new version.
Because it is written in the comment on right.

Quote:

//Key which identifies descritpors
#DEFINE USB_DESC_DEVICE_TYPE 0x01 //#DEFINE USB_DEVICE_DESC_KEY 0x01
#DEFINE USB_DESC_CONFIG_TYPE 0x02 //#DEFINE USB_CONFIG_DESC_KEY 0x02
#DEFINE USB_DESC_STRING_TYPE 0x03 //#DEFINE USB_STRING_DESC_KEY 0x03
#DEFINE USB_DESC_INTERFACE_TYPE 0x04 //#DEFINE USB_INTERFACE_DESC_KEY 0x04
#DEFINE USB_DESC_ENDPOINT_TYPE 0x05 //#DEFINE USB_ENDPOINT_DESC_KEY 0x05
#DEFINE USB_DESC_CLASS_TYPE 0x21 //#DEFINE USB_CLASS_DESC_KEY 0x21
#DEFINE USB_DESC_HIDREPORT_TYPE 0x22

//The length of each descriptor
#DEFINE USB_DESC_DEVICE_LEN 18 //#DEFINE USB_DEVICE_DESC_LEN 18
#DEFINE USB_DESC_CONFIG_LEN 9 //#DEFINE USB_CONFIG_DESC_LEN 9
#DEFINE USB_DESC_INTERFACE_LEN 9 //#DEFINE USB_INTERFACE_DESC_LEN 9
#DEFINE USB_DESC_CLASS_LEN 9 //#DEFINE USB_CLASS_DESC_LEN 9
#DEFINE USB_DESC_ENDPOINT_LEN 7 //#DEFINE USB_ENDPOINT_DESC_LEN 7



But in the file USB_DESC.H, the defined key wrods used are of old version:
Quote:

e.g.

"USB_DEVICE_DESC_LEN" is used instead of "USB_DESC_DEVICE_LEN".

And so on....for all defined key words.

I can make the same defination in both files but there are some other files which are having
same mistake. And it seems hard to change and make all those same.

I also expect following variable to be define in USB.H but they are not there. As they are declare Undefined identifier in the above error.

USB_STRING_DESC_OFFSET
USB_STRING_DESC


Can anybody help me some way?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Jan 20, 2005 5:10 pm     Reply with quote

There are three ways to find the compiler version.

1. Compile a test file, and look at the top of the .LST file.
It will show the version.

2. Click on Start/ Programs, and then find the CCS directory.
It might be "PIC-C". Then click on the icon for "Compiler Version".

2. Open a DOS window and go to c:\Program Files\Picc
and run this command line: CCSC +v

-----------------
With respect to your problem:

Is it possible that you had an older version of PCH or maybe the
USB developers kit. Then maybe you copied some source files
into your own project folder. Then you modified them a little.

Then, you updated the compiler to a new version. But maybe
CCS has changed all the constants in the .h file. So when you
try to re-compile the .c files in your project folder, the compiler
#includes the new versions of the .h files, and you get tons of
errors. Is it possible that this is happening ?
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