Hi,

I'm converting a USB CDC  sample that I found in the net to run on my 18F4550.

At preset the code is too big to fit into my memory, so I need to squeeze it
a bit. On inspecting the source code and generated code I noticed
quite a bit of code gets emitter because of the use of generic pointers.

For example there is:

static unsigned char *out_ptr;           // Data to send to the host
static unsigned char *in_ptr;            // Data from the host

which gets used like:

        for (i=0;i<bufferSize;i++)
        {
                *in_ptr++ = *out_ptr++;
        }


and like:

code config_struct config_descriptor = {

    <snip>

      out_ptr = (unsigned char *)&config_descriptor;
      count = *(out_ptr + 2);

So the data pointed to is sometimes in ROM/code (the USB descriptors)
and some times in RAM.

Quite a lot of code and some library calls gets emitted for all this.

What would be my best strategy to rework this?

br Kusti

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Sdcc-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to