From: Josh S. <jo...@4s...> - 2003-07-14 19:53:07
|
Sorry, it seems I forgot to mention the little idiosyncrasies I ran into in porting the project. I have included a zip with a working version so you don't have to go through the same hassle. But it may help you to understand what was done, so I'll try to explain. If you got it to compile, then you must have fixed the curly braces, so I'll move on. The next (and last, I think) issue for you to resolve is the "endian"-ness of the compilers and protocol. The USB protocol is little-endian, SDCC is little-endian, and Keil is big-endian. If you need an explanation of endian, see this link: http://www.webopedia.com/TERM/B/big_endian.html What this means is that the developers who wrote the example hard-coded a few places where it flips the bytes. For example, in USB_Descriptor.h, you have the line: {0xC410}, // idVendor Cygnal's VID is actually 0x10C4 - but the developer flipped it since Keil and USB interpret int's differently. USB and SDCC, however, are both little-endian, so the correction goes: {0x10C4}, // idVendor You'll also see a MSB and LSB next to the definition of WORD, which I now changed to this: // WORD type definition, for SDCC Compiler #ifndef _WORD_DEF_ #define _WORD_DEF_ typedef union {unsigned int i; unsigned char c[2];} WORD; #define LSB 0 #define MSB 1 #endif /* _WORD_DEF_ */ Going through the code, I also found a few places where they were manually flipping bytes on transmissions to/from the host... most of these code sections I removed. I realize this is a pretty brief description of the changes needed, but if you use the version I have attached, you should be ready to go. I made sure that this version does compile correctly, and when you download it to the board, you should be able to use Cygnal's USBTest.exe to talk to the board. Hope this helps, Josh Stone PS - Incidentally, this version of my code was actually shortly after I had started modifying it for my own purposes. All of the functionality is still the same as the original, but you'll notice that the headers at the top of each file are now listed with my name. Sorry if this is an inconvenience - feel free to change that... :-D -----Original Message----- From: sdc...@li... [mailto:sdc...@li...]On Behalf Of Bert Schiettecatte Sent: Monday, July 14, 2003 12:57 PM To: sdc...@li... Subject: RE: [Sdcc-user] Cygnal IDE and SDCC Hi Josh, I tried porting Cygnal's USB_INT example to SDCC but no luck. I finally managed to make it all compile using your Makefile.dat and I flashed the development Board using FLASHProg. Unfortunately the USB device is now no longer recognized by Windows...! Do you have any idea what's happening? This is of course related to my post about the curly braces. Thanks, Bert Schiettecatte --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.500 / Virus Database: 298 - Release Date: 10/07/2003 ------------------------------------------------------- This SF.Net email sponsored by: Parasoft Error proof Web apps, automate testing & more. Download & eval WebKing and get a free book. www.parasoft.com/bulletproofapps1 _______________________________________________ Sdcc-user mailing list Sdc...@li... https://lists.sourceforge.net/lists/listinfo/sdcc-user |