From: SourceForge.net <no...@so...> - 2007-10-23 06:14:13
|
Bugs item #1805167, was opened at 2007-09-30 19:19 Message generated for change (Comment added) made by borutr You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=1805167&group_id=599 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: pic16 target Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Stefan (stefan-tiger) Assigned to: Nobody/Anonymous (nobody) Summary: usb firmware: rom unknown, no backslashes in #include Initial Comment: target: pic18f2550 goal: compile the orginal microchip usb firmware with sdcc 2 issues: 1.) sdcc does not know the "rom" datatype-additive (e.g.: extern rom const unsigned char *rom USB_CD_Ptr[];) 2.) sdcc does not allow backslash "\" in a path in the #include command (like the normal directoryseperator under Windows is) (e.g.: #include "autofiles\usbcfg.h") (more issues could come to daylight if these two are solved) steps to reproduce (under Linux): 1.) use piklab 0.14.5 2.) use sdcc 2.7.0 3.) use wine 0.9.46 4.) get MCHPFSUSSB_Setup.zip from somewhere from http://www.microchip.com (look for USB and Microchip Custom Driver) 5.) extract the zip file and install the exe with wine 6.) locate in your fake root windows C: drive of wine under C:\MCHPFSUSB\fw\Demo\ the main.c and the .lkr script 7.) try to compile and link "main.c" and everything what is related to it. (I made a piklab project) ------- may be you can stop reading here if you detect the issues yourself because of the compiler output ----- steps within piklab: 1.) copy the C:\MCHPFSUSB\fw\Demo\ to a working directory 2.) open piklab 3.) project -> new 4.) Name: Demo, toolchain: sdcc and selesct the working directory 5.) next 6.) add existing file: main.c 7.) open main.c 8.) compile error at my pc: sdcc -mpic16 -p18f2550 -V -I/home/stefan/Entwicklung/PIC/Demo/ -c main.c main.c:38: error: p18cxxx.h: No such file or directory main.c:39: error: system\typedefs.h: No such file or directory + "/usr/bin/sdcpp" -nostdinc -Wall -std=c99 -I"/home/stefan/Entwicklung/PIC/Demo/" -Dpic18f2550 -D__18f2550 -DSTACK_MODEL_SMALL -obj-ext=.o -DSDCC_MODEL_SMALL -DSDCC=270 -DSDCC_pic16 -D__pic16 -I"/usr/bin/../share/sdcc/include/pic16" -I"/usr/share/sdcc/include/pic16" -I"/home/stefan/Entwicklung/PIC/Demo/" "main.c" main.c:40: error: system\usb\usb.h: No such file or directory In file included from main.c:41: io_cfg.h:41: error: autofiles\usbcfg.h: No such file or directory main.c:43: error: system\usb\usb_compile_time_validation.h: No such file or directory main.c:44: error: user\user.h: No such file or directory main.c:47: #pragma udata: bad argument(s); pragma ignored main.c:56: #pragma code: bad argument(s); pragma ignored main.c:60: token -> '}' ; column 1 main.c:61: #pragma code: bad argument(s); pragma ignored main.c:63: #pragma code: bad argument(s); pragma ignored main.c:69: #pragma code: bad argument(s); pragma ignored main.c:74: #pragma code: bad argument(s); pragma ignored main.c:77: #pragma code: bad argument(s); pragma ignored main.c:99: function 'ProcessIO' implicit declaration main.c:135: function 'mInitializeUSBDriver' implicit declaration main.c:137: function 'UserInit' implicit declaration at 125: error 20: Undefined identifier 'ADCON1' main.c:125: Undefined identifier 'ADCON1' main.c:161: function 'USBCheckBusStatus' implicit declaration main.c:163: function 'USBDriverService' implicit declaration main.c:162: Un main.c:162: Undefined identifier 'UCFGbits' main.c:162: Structure/Union expected left of '.->' 9.) change the code step by step, first in main.c: #include <p18cxxx.h> to #include <pic18f2550.h> 10.) then n main.c in the #includes: \ to / 11.) compile again error at my pc then: sdcc -mpic16 -p18f2550 -V -I/home/stefan/Entwicklung/PIC/Demo/ -c main.c In file included from main.c:40: usb.h:47: error: autofiles\usbcfg.h: No such file or directory usb.h:48: error: system\usb\usbdefs\usbdefs_std_dsc.h: No such file or directory usb.h:49: error: autofiles\usbdsc.h: No such file or directory usb.h:51: error: system\usb\usbdefs\usbdefs_ep0_buff.h: No such file or directory usb.h:52: error: system\usb\usbmmap.h: No such file or directory usb.h:54: error: system\usb\usbdrv\usbdrv.h: No such file or directory usb.h:55: error: system\usb\usbctrltrf\usbctrltrf.h: No such file or directory usb.h:56: error: system\usb\usb9\usb9.h: No such file or directory In file included from main.c:41: io_cfg.h:41: error: autofiles\usbcfg.h: No such file or directory In file included from main.c:43: usb_compile_time_validation.h:41: error: system\typedefs.h: No such file or directory usb_compile_time_validation.h:42: error: system\usb\usb.h: No such file or directory usb_compile_time_validation.h:46: error: token "\" is not valid in preprocessor expressions In file included from main.c:44: user.h:41: error: system\typedefs.h: No such file or directory + "/usr/bin/sdcpp" -nostdinc -Wall -std=c99 -I"/home/stefan/Entwicklung/PIC/Demo/" -Dpic18f2550 -D__18f2550 -DSTACK_MODEL_SMALL -obj-ext=.o -DSDCC_MODEL_SMALL -DSDCC=270 -DSDCC_pic16 -D__pic16 -I"/usr/bin/../share/sdcc/include/pic16" -I"/usr/share/sdcc/include/pic16" -I"/home/stefan/Entwicklung/PIC/Demo/" "main.c" typedefs.h:142: token -> 'rom' ; column 7 12.) now you get the "rom" issue the first time (typedefs.h:142: token -> 'rom' ; column 7) 13.) you can correct all the backslashes, but you will get more and more rom-issues 14.) my idea was: comment our all rom-code, but i stuck somewhere 15.) after i tried to change the code evrywhere in every file sdcc complained an error, the end result is (different project dir, does not matter): sdcc -mpic16 -p18f2550 -V -I/home/stefan/Entwicklung/PIC/PIC18_USB_mit_Bootloader_SDCC/ -c PIC18_USB_mit_Bootloader_SDCC.c usbmmap.h:94: duplicate union member 'BC8' usbmmap.h:84: previously defined here usbmmap.h:95: duplicate union member 'BC9' usbmmap.h:85: previously defined here usbmmap.h:101: duplicate union member 'UOWN' usbmmap.h:91: previously defined here + "/usr/bin/sdcpp" -nostdinc -Wall -std=c99 -I"/home/stefan/Entwicklung/PIC/PIC18_USB_mit_Bootloader_SDCC/" -Dpic18f2550 -D__18f2550 -DSTACK_MODEL_SMALL -obj-ext=.o -DSDCC_MODEL_SMALL -DSDCC=270 -DSDCC_pic16 -D__pic16 -I"/usr/bin/../share/sdcc/include/pic16" -I"/usr/share/sdcc/include/pic16" -I"/home/stefan/Entwicklung/PIC/PIC18_USB_mit_Bootloader_SDCC/" "PIC18_USB_mit_Bootloader_SDCC.c" *** Beendet mit Status: 1 *** or translated: *** exited with status: 1 *** ---------------------------------------------------------------------- >Comment By: Borut Ražem (borutr) Date: 2007-10-23 08:14 Message: Logged In: YES user_id=568035 Originator: NO Sefan, You are right that I'm wrong ;-) The problem is that the first level include works, but the second and higher level include fails. I'm still investigating the problem. The workaround is to add -I. to the sdcc command line: sdcc -mpic16 -p18f2550 -V -I/home/stefan/Entwicklung/PIC/Demo/ -I. -c main.c This solves only the first level of your problems :-( Borut ---------------------------------------------------------------------- Comment By: Stefan (stefan-tiger) Date: 2007-10-22 22:44 Message: Logged In: YES user_id=1902332 Originator: YES @borutr: You are wrong. As i described before replacing the \ with / works. If you would do the steps I descibed, you will excatly see this in step 10. and 11. @all: download the zip file (no costs, no registration required) and try it on your own, so many answers would be given to you and you see what the issues are which I descibed. PIC controllers are from Microchip, and getting their C-frameworks work with sdcc is required for using sdcc for larger projects. It is also required for me, until you have a framework for PICs which uses the USB and make e.g. a HID class device. (perhaps USB functions should be shipped with sdcc (-libraries)) ---------------------------------------------------------------------- Comment By: Borut Ražem (borutr) Date: 2007-10-22 21:37 Message: Logged In: YES user_id=568035 Originator: NO SDCC accepts backslash "\" as path delimiters in the #include directive. You probably didn't specify the correct location of include files, so you received the "No such file or directory" error. Try to specify the path with slashes as path delimiters. If I'm right, then you'll gel the same error message. If I'm wrong, then let me know ;-) Borut ---------------------------------------------------------------------- Comment By: Stefan (stefan-tiger) Date: 2007-10-10 16:01 Message: Logged In: YES user_id=1902332 Originator: YES You found the right file. But where is the error with the unions/structs? Does the sdcc something wrong, or is the code (C standard) invalid? What is the SDCCs equivalent to the (M18C) "rom" keyword? ---------------------------------------------------------------------- Comment By: Frieder Ferlemann (frief) Date: 2007-10-03 01:09 Message: Logged In: YES user_id=589052 Originator: NO Hi Stefan, for the "rom" keyword you could probably use either an empty #define or a define to SDCCs equivalent. I've not downloaded MCHPFSUSSB_Setup.zip and instead found: http://www.nuxie1.com/Hackaday_Entry/Bootloader/system/usb/usbmmap.h which I guess is near to your usbmmap.h. The errors about the "duplicate union member" seem to be real and related to: typedef union _BD_STAT { byte _byte; struct{ unsigned BC8:1; unsigned BC9:1; unsigned BSTALL:1; //Buffer Stall Enable unsigned DTSEN:1; //Data Toggle Synch Enable unsigned INCDIS:1; //Address Increment Disable unsigned KEN:1; //BD Keep Enable unsigned DTS:1; //Data Toggle Synch Value unsigned UOWN:1; //USB Ownership }; struct{ unsigned BC8:1; unsigned BC9:1; unsigned PID0:1; unsigned PID1:1; unsigned PID2:1; unsigned PID3:1; unsigned :1; unsigned UOWN:1; }; struct{ unsigned :2; unsigned PID:4; //Packet Identifier unsigned :2; }; } BD_STAT; //Buffer Descriptor Status Register If you'd f.e remove PID3:1; in the second struct the compiler would have to choose whether UOWN would be bit 6 or bit 7 of the union. To avoid this you should give the structs a name like: struct{ unsigned BC8:1; unsigned BC9:1; unsigned BSTALL:1; //Buffer Stall Enable unsigned DTSEN:1; //Data Toggle Synch Enable unsigned INCDIS:1; //Address Increment Disable unsigned KEN:1; //BD Keep Enable unsigned DTS:1; //Data Toggle Synch Value unsigned UOWN:1; //USB Ownership } a; Greetings, Frieder ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=1805167&group_id=599 |