Hi

I'm exploring ways to reduce my usb cdc stack size. One of the things I'm 
trying is 
manually assigning address for variable using the 'at' directive. This indeed
seems to reduce to code size, I guess the compiler has more opportunities 
to optimize the code.

However the following variable definition:

typedef struct _setup_packet_struct
{
    unsigned char bmrequesttype; // D7: Direction, D6..5: Type, D4..0: Recipient
    unsigned char brequest;      // Specific request
    unsigned char wvalue0;       // LSB of wValue
    unsigned char wvalue1;       // MSB of wValue
    unsigned char windex0;       // LSB of wIndex
    unsigned char windex1;       // MSB of wIndex
    unsigned short wlength;       // Number of unsigned chars to transfer if 
there's a data stage
    unsigned char extra[56];     // Fill out to same size as Endpoint 0 max 
buffer
} setup_packet_struct;

#pragma udata usbram5 setup_packet control_transfer_buffer
static volatile setup_packet_struct at 0xA0 setup_packet;

results in this error:

/obj/usbcdc.asm:333:Error [116] Value of symbol "_setup_packet" differs on 
second pass
 pass 1=0,  pass 2=160
./obj/usbcdc.asm:333:Error [115] Duplicate label or redefining symbol that 
cannot be redefined. (_setup_packet)
make: *** [../obj/usbcdc.o] Error 1

without the 'at 0xA0' this compiles clean.

Also this gives me headache:

static data unsigned char at 0x100 *out_ptr;           // Data to send to the 
host

and error:

usbcdc.c:53: error 20: Undefined identifier 'out_ptr'
usbcdc.c:53: error 2: Initializer element is not constant
usbcdc.c:53: warning 166: useless declaration (possible use of keyword as 
variable name)

I guess I should have parentheses there some where but I can't figure this out.

SDCC : mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/ds400/hc08 2.89 # 
(Feb 10 2009) (Mac OS X i386)


br Kusti


------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Sdcc-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to