• AVR Freaks

Helpful ReplyLockedBuilding USB stack projects with XC8 compiler

Page: < 123 > Showing page 2 of 3
Author
mad_c
Super Member
  • Total Posts : 1202
  • Reward points : 0
  • Joined: 2010/12/12 17:48:27
  • Location: Brisbane, Australia
  • Status: offline
Re:Building USB stack projects with XC8 compiler 2013/04/18 15:06:09 (permalink)
+1 (1)
Hello,
PStechPaul
The zipfile I attached has everything needed to build the project.

 
Is this the ZIp file attached some time ago? I downloaded that. There is no project file or make file, some of the file have multiple copies (like usb_function_cdc.c usb_function_cdc (2).c and usb_function_cdc (3).c) and I have not idea which is being used, etc.
 
I am very happy to help people on these forums, but I do not work in a support capacity and so I can only dedicate a very limited time to this end. The post I responded to seemed to imply that simple absolute variables 'do not work'. Do you have a small test program that demonstrates this issue?
 

(From USB_descriptors.c)
#if defined(__18CXX) 
#pragma romdata
#endif
...
#if defined(__18CXX)
   #pragma code
#endif


Here are the error messages:
 
../usb_descriptors.c:162: warning: unknown pragma "romdata"
../usb_descriptors.c:302: warning: unknown pragma "code"


There was no USB_descriptors.c file in the ZIP (The usb_descriptors_ORTM4H.c file included in the ZIP does not contain the above code) , so I can't confirm what you compiled in this example. However, XC8 does not use any pragma (like romdata or code) for memory allocation. The code you quote above implies that these pragmas are only defined if __18CXX is defined, which is normally the case for C18. The XC8 compiler only defines this macro if it is running in C18 compatibility mode, which you should not be in. The __18CXX macro should not be manually defined if you are using XC8. Clearly something is defined which allows the pragmas to pass through.
 
The replacements for these pragmas are to make things const if they need to be in program memory. If they must be at a particular address, then you can either make the variable/function absolute, or use a section specifier, then supply an additional linker option to link the section at an address, if required. So, for example:
 
int __section("myPsect") foobar;
 
then supply the driver option:
 
-L-pmyPsect=0x300
 
for example. Only assign addresses to objects if you have to. If this code has been publish to work with XC8, the there is something not right in the code. This forum only deals with the compiler and the USB code is not written by the compiler group. If you have submitted a support ticket, then continue to work with them. They can work with groups responsible for the code.
 
I am sorry I can't help more. If there is evidence to suggest that absolute variables are not working, please let us know as I am not aware of this.
 
Jeff.
 
 
#21
PStechPaul
Super Member
  • Total Posts : 2427
  • Reward points : 0
  • Joined: 2006/06/27 16:11:32
  • Location: Cockeysville, MD, USA
  • Status: offline
Re:Building USB stack projects with XC8 compiler 2013/04/18 16:40:48 (permalink)
0
The zipfile I'm referring to was posted just yesterday, and contained all the stack files that I had to change.
 
You may have something about the __18XX but AFAIK I have not defined it anywhere in my projects. I used a new project:
USB Device - CDC - Basic Demo -  C18 - PICDEM FSUSB
 
I imported it into MPLABX - Maybe that's the problem? But I tried to keep everything as close to original as possible, and I only had problems with the PIC18F devices. I added some extra directives to bypass the #pragmas but I did not change them to sections as you suggest. So I was able to get it to compile, link, and load without errors, but when I programmed the demo board it did not work.
 
It's been a long time since I found the possible bug which located RAM variables in ROM space, and it may be that it was a problem with the older version of XC8, or perhaps I did not understand how to use sections as you show in your post.
 
I have not raised a new ticket for this. I'll try to find anyplace where __18XX may be defined. But I don't have much hope for success, since the selection of the PIC18F processors seems to be inside the __18XX blocks.
 
Thanks!

 
#22
mad_c
Super Member
  • Total Posts : 1202
  • Reward points : 0
  • Joined: 2010/12/12 17:48:27
  • Location: Brisbane, Australia
  • Status: offline
Re:Building USB stack projects with XC8 compiler 2013/04/18 17:34:23 (permalink)
+1 (1)
PStechPaul

The zipfile I'm referring to was posted just yesterday, and contained all the stack files that I had to change.

You may have something about the __18XX but AFAIK I have not defined it anywhere in my projects. I used a new project:
USB Device - CDC - Basic Demo -  C18 - PICDEM FSUSB

I imported it into MPLABX - Maybe that's the problem? But I tried to keep everything as close to original as possible, and I only had problems with the PIC18F devices. I added some extra directives to bypass the #pragmas but I did not change them to sections as you suggest. So I was able to get it to compile, link, and load without errors, but when I programmed the demo board it did not work.

It's been a long time since I found the possible bug which located RAM variables in ROM space, and it may be that it was a problem with the older version of XC8, or perhaps I did not understand how to use sections as you show in your post.

I have not raised a new ticket for this. I'll try to find anyplace where __18XX may be defined. But I don't have much hope for success, since the selection of the PIC18F processors seems to be inside the __18XX blocks.

Thanks!

Hi,
 
If you click the verbose build option, then build, you will see the options passed to the preprocessor (CPP). The preprocessor is passed options by the driver as to what macros will be predefined. The preprocessor also uses a -D option to do this. This will show you what preprocessor macros are defined by the compiler, so to speak. Anything else defined has come from code, somewhere. Preprocessor macros only have scope in a module, so if a module is processed with a macro defined, the definition has to be in that module (which means either in that source file, or any file included into that file). You can use
 
#ifdef __18CXX
#warning the macro is currently defined
#endif
 
etc. to see at what point the macro comes into existence.
 
Jeff.
 
#23
PStechPaul
Super Member
  • Total Posts : 2427
  • Reward points : 0
  • Joined: 2006/06/27 16:11:32
  • Location: Cockeysville, MD, USA
  • Status: offline
Re:Building USB stack projects with XC8 compiler 2013/04/18 19:16:00 (permalink)
0
I found a definition for __18CXX in Compiler.h:

#if defined(__18CXX) && !defined(HI_TECH_C) 
 // PIC18 processor with Microchip C18 compiler
    #define COMPILER_MPLAB_C18
    #include <p18cxxx.h>
#elif defined(__PICC18__) && defined(HI_TECH_C) 
 // PIC18 processor with (Microchip) HI-TECH PICC-18 compiler
 #if !defined(__18CXX)
  #define __18CXX
 #endif
    #define COMPILER_HITECH_PICC18
 #include <htc.h>
#elif (defined(_PIC12) || defined(_PIC14) || defined(_PIC14E)) && defined(HI_TECH_C)
 // PIC10/12/16 processor with (Microchip) HI-TECH PICC compiler
    #define COMPILER_HITECH_PICC
    #include <htc.h>
#elif (defined(__PIC24F__) || defined(__PIC24FK__)) && defined(__C30__) // Microchip C30 compiler
 // PIC24F processor
    #define COMPILER_MPLAB_C30
 #include <p24Fxxxx.h>
#elif defined(__PIC24H__) && defined(__C30__) // Microchip C30 compiler
 // PIC24H processor
    #define COMPILER_MPLAB_C30
 #include <p24Hxxxx.h>
#elif defined(__PIC24E__) && defined(__C30__) // Microchip C30 compiler
 // PIC24E processor
    #define COMPILER_MPLAB_C30
 #include <p24Exxxx.h>
#elif defined(__dsPIC33F__) && defined(__C30__) // Microchip C30 compiler
 // dsPIC33F processor
    #define COMPILER_MPLAB_C30
 #include <p33Fxxxx.h>
#elif defined(__dsPIC33E__) && defined(__C30__) // Microchip C30 compiler
 // dsPIC33E processor
    #define COMPILER_MPLAB_C30
 #include <p33Exxxx.h>
#elif defined(__dsPIC30F__) && defined(__C30__) // Microchip C30 compiler
 // dsPIC30F processor
    #define COMPILER_MPLAB_C30
 #include <p30fxxxx.h>
#elif defined(__C30__)  // Microchip C30 compiler, but targeting "generic-16bit" processor.
    #define COMPILER_MPLAB_C30
 #include <p30sim.h>
 // Define some useful inline assembly functions which are normally in the
 // processor header files, but absent from the generic p30sim.h file.
 #if !defined(Nop)
  #define Nop()    __builtin_nop()
  #define ClrWdt() {__asm__ volatile ("clrwdt");}
  #define Sleep()  {__asm__ volatile ("pwrsav #0");}
  #define Idle()   {__asm__ volatile ("pwrsav #1");}
 #endif
#elif defined(__PIC32MX__) // Microchip C32 compiler
 #if !defined(__C32__)
  #define __C32__
 #endif
    #define COMPILER_MPLAB_C32
 #include <p32xxxx.h>
 #include <plib.h>
#else
 #error Unknown processor or compiler.  See Compiler.h
#endif

I switched back to the XC8 compiler and tried building again. I had to restore the include paths because it seems they are cleared when the compiler is changed. Now (as before) I am getting this in the LST file:
 
  108                           opt pagewidth 120
   109  0000                     SPPDATA equ 0F62h ;#
   110                           opt subtitle "HI-TECH Software Omniscient Code Generator (Lite mode) build 49521"

So I had to activate (again) the Workstation License to use the PRO version, but the "Lite Mode" messages are still there. I found that I had to select the PRO mode from the compiler options (which I also thought I did before), and I also set verbose mode to get more information.
 

 
#24
PStechPaul
Super Member
  • Total Posts : 2427
  • Reward points : 0
  • Joined: 2006/06/27 16:11:32
  • Location: Cockeysville, MD, USA
  • Status: offline
Re:Building USB stack projects with XC8 compiler 2013/04/20 22:37:07 (permalink)
+1 (3)
Whew, I finally got the Serial Emulator project for PICdem FSUSB (PIC18F4550) to compile, link, load, and actually enumerate and is reported as working properly as COM6 or COM15 depending on which USB port is used.
 
I have attached the modified stack files as well as the main.c and the MPLAB.X project file (which I renamed MPLAB1.X). I had to remove and separate the build and production folders.
USBstack.zip   MPLAB1.zip   build.zip   dist.zip
 
Basically, I used the File Registers output to get the absolute addresses of the USB variables and defined them for the PIC18F4550. It probably won't work for the PIC18F2450 which has only one bank for USB variables (ox400-0x4ff). Here are the absolute locations that finally worked:
 
 
volatile CTRL_TRF_SETUP SetupPkt@0x430; //CTRL_TRF_SETUP_ADDR_TAG;
volatile BYTE CtrlTrfData[USB_EP0_BUFF_SIZE]@0x438;
USB_VOLATILE USB_DEVICE_STATE USBDeviceState@0x591;
USB_VOLATILE BYTE USBActiveConfiguration@0x592;
USB_VOLATILE BYTE USBAlternateInterface[USB_MAX_NUM_INT]@0x593;
volatile BDT_ENTRY *pBDTEntryEP0OutCurrent@0x595;
volatile BDT_ENTRY *pBDTEntryEP0OutNext@0x597;
volatile BDT_ENTRY *pBDTEntryOut[USB_MAX_EP_NUMBER+1]@0x599;
volatile BDT_ENTRY *pBDTEntryIn[USB_MAX_EP_NUMBER+1]@0x59f; //4
USB_VOLATILE BYTE shortPacketStatus@0x5a5; //4
USB_VOLATILE BYTE controlTransferState@0x5a6; //1
USB_VOLATILE IN_PIPE inPipes[1]@0x5A7; //1
USB_VOLATILE OUT_PIPE outPipes[1]@0x5AC; //5
USB_VOLATILE BYTE *pDst@0x5B3; //7
USB_VOLATILE BOOL RemoteWakeup@0x5B5; //2
USB_VOLATILE BOOL USBBusIsSuspended@0x5B6; //1
USB_VOLATILE USTAT_FIELDS USTATcopy@0x5B7; //1
USB_VOLATILE BYTE endpoint_number@0x5B8; //1
USB_VOLATILE BOOL BothEP0OutUOWNsSet@0x5B9; //1
USB_VOLATILE EP_STATUS ep_data_in[USB_MAX_EP_NUMBER+1]@0x5Ba; //1
USB_VOLATILE EP_STATUS ep_data_out[USB_MAX_EP_NUMBER+1]@0x5Bd; //2
USB_VOLATILE BYTE USBStatusStageTimeoutCounter@0x5c0; //2
volatile BOOL USBDeferStatusStagePacket@0x5C1; //1
volatile BOOL USBStatusStageEnabledFlag1@0x5C2; //1
volatile BOOL USBStatusStageEnabledFlag2@0x5C3; //1
volatile BOOL USBDeferINDataStagePackets@0x5C4; //1
volatile BOOL USBDeferOUTDataStagePackets@0x5C5; //1

and (from usb_hal_pic18.h and usb_device.c)
 
#define BDT_BASE_ADDR_TAG   __attribute__ ((aligned (512))) // This is not used because it is not supported in XC8
#define USB_BDT_ADDRESS 0x400     //All other PIC18 devices place the BDT in usb4:0x400-0x4FF(256-byte)
#define CTRL_TRF_SETUP_ADDR_TAG
#define CTRL_TRF_DATA_ADDR_TAG
volatile BDT_ENTRY BDT[BDT_NUM_ENTRIES]@USB_BDT_ADDRESS;
volatile CTRL_TRF_SETUP SetupPkt CTRL_TRF_SETUP_ADDR_TAG;
volatile BYTE CtrlTrfData[USB_EP0_BUFF_SIZE] CTRL_TRF_DATA_ADDR_TAG;

It should be possible to locate and align these variables using sections, but I did not have any success. It should work like this (from the help):
 
int foo __attribute__((section("mysection"),address(0x900)));
int bar __attribute__((section("mysection")));
int baz __attribute__((section("mysection")));

But I tried it:
volatile CTRL_TRF_SETUP SetupPkt __attribute__((section("mysection"),address(0x430)));
volatile BYTE CtrlTrfData[USB_EP0_BUFF_SIZE] __attribute__((section("mysection")));
USB_VOLATILE USB_DEVICE_STATE USBDeviceState __attribute__((section("mysection")));

and the map file showed:
_SetupPkt                                 bssCOMRAM    000039
_CtrlTrfData                              bssBANK0     0000A7
_USBDeviceState                           bssBANK0     000066

post edited by PStechPaul - 2013/04/20 23:08:50

 
#25
cesar.ls
New Member
  • Total Posts : 1
  • Reward points : 0
  • Joined: 2013/04/26 10:02:40
  • Location: 0
  • Status: offline
Re:Building USB stack projects with XC8 compiler 2013/04/26 10:05:59 (permalink)
0
You just saved me ;-)
#26
obama
New Member
  • Total Posts : 21
  • Reward points : 0
  • Joined: 2009/07/25 05:15:53
  • Location: 0
  • Status: offline
Re:Building USB stack projects with XC8 compiler 2013/05/12 01:54:40 (permalink)
0
PStechPaul Whew, I finally got the Serial Emulator project for PICdem FSUSB (PIC18F4550) to compile, link, load, and actually enumerate and is reported as working properly as COM6 or COM15 depending on which USB port is used.
Thank you for your work.
I have a problem. I tried this simple echo:
 
void ProcessIO(void)
{  
    if((USBDeviceState < CONFIGURED_STATE)||(USBSuspendControl==1)) return;

    LastRS232Out = getsUSBUSART(USB_Out_Buffer,64); //until the buffer is free.
    if(LastRS232Out > 0)
    {
        if((USBUSARTIsTxTrfReady()))
        {
                //USB_Out_Buffer[0] = 'a';
                putUSBUSART(USB_Out_Buffer, 64);
        }
    }
    CDCTxService();
}//end ProcessIO

With this code I should be to see every char I transmit to virtual COM, but I receive strange char. When I put the USB_Out_Buffer[0] = 'a' I receive always char a, so reception from CDC is working, but trasmission has a problem for me. I compiled with XC8 1.12 and MLA 2-2013.
Is it happen only to me?
 
#27
davekw7x
Entropy++
  • Total Posts : 1827
  • Reward points : 0
  • Joined: 2012/01/16 12:01:07
  • Location: Second star on the right, straight on till morning
  • Status: offline
Re:Building USB stack projects with XC8 compiler 2013/05/12 07:20:24 (permalink)
0
    
/*
 * Call this function once per main loop.
 *
 * Simply echo USB serial data back to the USB connection.
 *
 * davekw7x
 */
void ProcessIO()
{
    unsigned char numBytesRead;

    /*
     *  From Microchip demo programs
     */
    BlinkUSBStatus();

    /*
     *  Don't do anything unless USB is plugged in and the host
     *  CPU has the CDC connection open.
     */
    if ((USBDeviceState < CONFIGURED_STATE) || (USBSuspendControl == 1)) {
        return;
    }
    /*
     * Don't do anything if previous transfers haven't been
     * completed.
     */
    if (USBUSARTIsTxTrfReady()) {
        numBytesRead = getsUSBUSART(USB_Out_Buffer, 64);
        if (numBytesRead > 0) {
            putUSBUSART(USB_Out_Buffer, numBytesRead);
        }
    }
    CDCTxService();
} /* End ProcessIO() */

 
 
Regards,

Dave
post edited by davekw7x - 2013/05/12 07:25:33

Sometimes I just can't help myself...
#28
obama
New Member
  • Total Posts : 21
  • Reward points : 0
  • Joined: 2009/07/25 05:15:53
  • Location: 0
  • Status: offline
Re:Building USB stack projects with XC8 compiler 2013/05/13 11:52:27 (permalink)
0
Thank you Dave for your reply. I think the problem is with XC8 and USB on PIC18F.
The patch of PStechPaul resolve the problem with enumeration but I have some problems with trasmission PC -> PIC.
I tested the same source code my and dave with C18 and the same PIC18F2550 and works without problems. (It's a simple echo).
EDIT
I discovered which was my problem. When I have USB_CDC_SET_LINE_CODING_HANDLER enabled the trasmission PC -> PIC is not working and PIC -> PC is ok. With USB_CDC_SET_LINE_CODING_HANDLER disabled all works very well. I hope is useful. I believe I'm not alone with this problem (XC8 + USB PIC18F). I don't know how to resolve, in this moment line_coding is useless for me.
 
post edited by obama - 2013/05/13 12:42:10
#29
jtemples
عُضْوٌ جَدِيد
  • Total Posts : 11391
  • Reward points : 0
  • Joined: 2004/02/13 12:31:19
  • Location: Southern California
  • Status: offline
Re:Building USB stack projects with XC8 compiler 2013/06/27 11:52:29 (permalink) ☄ Helpful
+4 (4)
The "could not find space" error is caused by the use of the "far" qualifier in the declaration.  Simply remove "far" and the stack compiles, though the USB variables in usb_device.c aren't in the right location.  That's due to an error in usb_hal_pic18.h, which can be fixed like this:
 
#ifdef __XC8  

#define BDT_ENTRY_SIZE      ((USB_MAX_EP_NUMBER + 1) * 4 * 4)

#define BDT_BASE_ADDR_TAG   @ USB_BDT_ADDRESS
#define CTRL_TRF_SETUP_ADDR_TAG @ USB_BDT_ADDRESS + BDT_ENTRY_SIZE
#define CTRL_TRF_DATA_ADDR_TAG @ USB_BDT_ADDRESS + BDT_ENTRY_SIZE + 8

#else

#define BDT_BASE_ADDR_TAG
#define CTRL_TRF_SETUP_ADDR_TAG
#define CTRL_TRF_DATA_ADDR_TAG

#endif

 
This avoids hard-coding addresses on all of the USB variables, and the modified stack will work with any PIC18.
 
The #pragma warnings are fixed by changing __18CXX to COMPILER_MPLAB_C18 around each of the #pragma directives (__18CXX should not be changed to COMPILER_MPLAB_C18 in other places).
 
The attached files were tested with XC8 V1.12 and V2013-02-15 of MAL.
post edited by jtemples - 2013/07/01 09:10:01
#30
sparkybg
New Member
  • Total Posts : 25
  • Reward points : 0
  • Joined: 2011/04/11 04:38:22
  • Location: 0
  • Status: offline
Re:Building USB stack projects with XC8 compiler 2013/07/01 04:40:35 (permalink)
0
Can someone please upload all the files that need to be changed? Sample XC8 MPLAB.X project will also be helpful.
 
I've tried the "ported" bootloader from the other thread, it compiles and runs, the device is enumerated and can receive data from the PC, but refuses to send to PC from EP1.
#31
jtemples
عُضْوٌ جَدِيد
  • Total Posts : 11391
  • Reward points : 0
  • Joined: 2004/02/13 12:31:19
  • Location: Southern California
  • Status: offline
Re:Building USB stack projects with XC8 compiler 2013/07/01 09:06:14 (permalink)
+1 (1)
I've attached the corrected files to my original post.  You should be able to replace the existing files in MAL with these.  There are no changes to the sample applications or projects.
#32
MCPUSB
New Member
  • Total Posts : 2
  • Reward points : 0
  • Joined: 2013/07/17 22:49:12
  • Location: 0
  • Status: offline
Re:Building USB stack projects with XC8 compiler 2013/07/17 23:08:47 (permalink)
0 (2)
I was getting "could not find space" error and tried jtemples's attached files from post #30.  Now CDC-Basic Demo compiles without error with V2013-02-15 of MAL, MPLab IDE v8.91, and C18 v9.80.  However, I am getting this error msg at the link step:
 

Executing: "E:\Engineering\Microchip\xc8\bin\mplink.exe" /p18F4550 "rm18f4550 - HID Bootload.lkr" "Objects\PICDEM FSUSB\usb_descriptors.o" "Objects\PICDEM FSUSB\main.o" "Objects\PICDEM FSUSB\usb_function_cdc.o" "Objects\PICDEM FSUSB\usb_device.o" /u_CRUNTIME /z__MPLAB_BUILD=1 /o"K USB Device - CDC - Basic Demo -  C18 - PIC18F2455.cof" /M"K USB Device - CDC - Basic Demo -  C18 - PIC18F2455.map" /W
: 0: (500) undefined symbols: __pUSB_VARIABLES(K USB Device - CDC - Basic Demo -  C18 - PIC18F2455.obj) __pUSB_BDT(K USB Device - CDC - Basic Demo -  C18 - PIC18F2455.obj)
 rm18f4550 - HID Bootload.lkr: 15: (0) the LIBPATH directive is not supported (warning)
rm18f4550 - HID Bootload.lkr: 17: (0) the FILES directive is not supported (warning)
rm18f4550 - HID Bootload.lkr: 18: (0) the FILES directive is not supported (warning)
rm18f4550 - HID Bootload.lkr: 19: (0) the FILES directive is not supported (warning)
rm18f4550 - HID Bootload.lkr: 42: (0) the STACK directive is not supported (warning)
(908) exit status = 1
(908) exit status = 1Link step failed.

 
Could anyone please tell me where or what is __pUSB_VARIABLES and __pUSB_BDT?  Device is still PIC18F4550.  Although I would like to use PIC18F2455 eventually.  If I were to compile it with XC8, then I get bunch of unknown pragma errors.
 
 
#33
jtemples
عُضْوٌ جَدِيد
  • Total Posts : 11391
  • Reward points : 0
  • Joined: 2004/02/13 12:31:19
  • Location: Southern California
  • Status: offline
Re:Building USB stack projects with XC8 compiler 2013/07/17 23:49:55 (permalink)
+2 (2)
The changes above are for XC8, not C18.  The "C18" that's bundled with XC8 seems to be some sort of wrapper for XC8, and I know nothing about it, but I'd be surprised if it supported .lkr files in any useful way.
 
Does it build if you remove the .lkr file from the project?
#34
MCPUSB
New Member
  • Total Posts : 2
  • Reward points : 0
  • Joined: 2013/07/17 22:49:12
  • Location: 0
  • Status: offline
Re:Building USB stack projects with XC8 compiler 2013/07/18 00:17:33 (permalink)
+1 (1)
jtemples 
 Does it build if you remove the .lkr file from the project? 
 
Try it already, I get the same link error messages.  However this is fixed if I use the real C18, see below.
 
jtemples
 The changes above are for XC8, not C18.  The "C18" that's bundled with XC8 seems to be some sort of wrapper for XC8, and I know nothing about it, but I'd be surprised if it supported .lkr files in any useful way.
 
I guess I was kind of confused.  It turns out that your are right that the C18 compiler that I have been using is actually \xc8\bin\mcc18.exe.  So I change everything to C18 v3.42 and it compiles and links (v4.43) fine.  Now I just need to figure out how to get it to work with XC8.  Thanks
 
#35
Renbo
New Member
  • Total Posts : 12
  • Reward points : 0
  • Joined: 2013/10/07 11:52:03
  • Location: 0
  • Status: offline
Re:Building USB stack projects with XC8 compiler 2013/12/14 17:05:32 (permalink)
0
Greetings!
 
I know this is a response to a VERY old thread.  I was trying to utilize the updated project files in order to get USB working in the CDC Serial Emulator project included in the Microchip library demos.  The difference is that I am on the library release "microchip_solutions_v2013-06-15", so I updated the include directories accordingly.
 
I am also using a PIC18F4455 in my project.
 
I am receiving the following exceptions on build:
../../../../Microchip/USB/CDC Device Driver/usb_function_cdc.c:187: error: could not find space (64 bytes) for variable _cdc_data_tx
../../../../Microchip/USB/CDC Device Driver/usb_function_cdc.c:188: error: could not find space (64 bytes) for variable _cdc_data_rx
../../../../Microchip/USB/CDC Device Driver/usb_function_cdc.c:191: error: could not find space (10 bytes) for variable _cdc_notice
C:/microchip_solutions_v2013-06-15/Microchip/Include\./USB/usb_function_cdc.h:1032: error: could not find space (10 bytes) for variable _cdc_notice
I've already had the PCB manufactured and gone through the work of assembling the board for this project, and have successfully been able to program the board using the PICKit2, so changing the device type at this point would be a huge step back.
 
The PIC18F4455 appears to have the same same amount of SRAM as the PIC18F2455, PIC18F2550 and PIC18F4550, so I am at a loss where my problem is.
 
Any assistance would be very helpful.  I am a software engineer by trade, but in the higher-level language arena.  This micro-controller stuff is a new experience!
#36
Renbo
New Member
  • Total Posts : 12
  • Reward points : 0
  • Joined: 2013/10/07 11:52:03
  • Location: 0
  • Status: offline
Re:Building USB stack projects with XC8 compiler 2013/12/14 17:10:24 (permalink)
0
Sorry!
 
I found the part of this thread that addresses the out of memory problem!  Please disregard my inquiry!
#37
embpic
Starting Member
  • Total Posts : 34
  • Reward points : 0
  • Joined: 2014/01/24 01:15:23
  • Location: 0
  • Status: offline
Re:Building USB stack projects with XC8 compiler 2014/04/02 23:37:33 (permalink)
-2 (2)
hello sir i also need PIC18f4550 usb communication using CDC for virtual com. plz provide me working CDC project in xc8 compiler

 
 
Regards,
Embpic.
#38
CCP1CON
Super Member
  • Total Posts : 469
  • Reward points : 0
  • Joined: 2007/04/15 12:49:28
  • Location: good old Germany
  • Status: offline
Re:Building USB stack projects with XC8 compiler 2014/04/03 06:07:36 (permalink)
0 (2)
But I found that anything with the qualifier "@" gets located in program ROM space rather than RAM.

 
I use with 18F2550 and XC8 v1.30:
 
volatile BDT_ENTRY ep0Bo @ 0x400;
volatile BDT_ENTRY ep0Bi @ 0x404;

 
and it works ...
#39
Rohit tandle
New Member
  • Total Posts : 19
  • Reward points : 0
  • Joined: 2014/03/28 06:15:39
  • Location: 0
  • Status: offline
Re:Building USB stack projects with XC8 compiler 2014/08/07 07:02:56 (permalink)
-2 (2)
HI
I am using USB Stack with PIC32MX795F512L it is working fine.
I want to through some data into USB but the data getting written into .txt in single line only.
Data should be written on next line after few char but it is getting written on one line only.
I have used line feed 0x0A and carriage return i.e 0X0D but no luck please help me to resolve the issue.
#40
Page: < 123 > Showing page 2 of 3
Jump to:
© 2019 APG vNext Commercial Version 4.5