From: Kustaa Nyholm <Kustaa.Nyholm@pl...> - 2010-02-19 20:04:18
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; // Fill out to same size as Endpoint 0 max buffer
#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  Value of symbol "_setup_packet" differs on second pass
pass 1=0, pass 2=160
./obj/usbcdc.asm:333:Error  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
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)
From: Bodo Wenzel <bodowenzel@we...> - 2010-02-20 09:26:08
Sorry, on the first part I can't help you.
> static data unsigned char at 0x100 *out_ptr;
Without any try I think the "at" should be placed between the type and the
static data unsigned char * at 0x100 out_ptr;