avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] "initializer is not constant"


From: Robert Rozman
Subject: [avr-gcc-list] "initializer is not constant"
Date: Fri, 20 Feb 2004 12:44:52 +0100

Hi,

after some time I took out of dust some code that compiled ok under previous
version (in 2002) and now with latest (from winavr) avrgcc get errors:

node5_0.c:86: error: initializer element is not constant
node5_0.c:86: error: (near initialization for
`sensor_inputs[0].port_address')
node5_0.c:86: error: initializer element is not constant
node5_0.c:86: error: (near initialization for `sensor_inputs[0].shifter')
node5_0.c:86: error: initializer element is not constant
node5_0.c:86: error: (near initialization for `sensor_inputs[0]')
node5_0.c:87: error: initializer element is not constant
node5_0.c:87: error: (near initialization for
`sensor_inputs[1].port_address')
node5_0.c:87: error: initializer element is not constant
node5_0.c:87: error: (near initialization for `sensor_inputs[1].shifter')
.......


I have in global.h ---------------------------------------

//inputs sensing structure

typedef struct          {
//                const uint8_t  port_address;
                uint8_t  port_address;
                u08  start_pin;
                u08  num_pins;
                u08  state;
                u08  shifter[4];
                u08  mask;
                u08  type;
                char znak; }   input_sensors ;


And then in node5.c this: (beggining with line
86) --------------------------------------------

volatile input_sensors        sensor_inputs [MAX_SENSOR_GROUPS] = {
        LCD_KEYS_PORT, LCD_KEYS_START, LCD_KEYS_NUM, 0x0f, {0xff, 0xff,
0xff, 0xff}, LCD_KEYS_MASKA, INP_KEY, 'K',
        PIR_PORT     , PIR_START     , PIR_NUM     , 0x00, {0x00, 0x00,
0x00, 0x00}, PIR_MASKA     , INP_PIR, 'P',
        SWITCH_PORT  , SWITCH_START  , SWITCH_NUM  , 0x07, {0xff, 0xff,
0xff, 0xff}, SWITCH_MASKA  , INP_SWITCH, 'S',
        SENSORS_PORT , SENSORS_START , SENSORS_NUM , 0x00, {0x00, 0x00,
0x00, 0x00}, SENSORS_MASKA , INP_SWITCH+INP_ANALOG_PORT, 'A',
 };
----------------------------------------------------------------------------
---------------


All constants are defined with #define (for instance)
#define LCD_KEYS_PORT PIND


It seems like definitions in avr/io.h changed from PIND 0xwhatever
to this:
_SFR_IO8(0xwhatever)

And it seems like PIND is not constant anymore ? Do I have to add something
to take into accound _SFR_IO8 macro ?

Any help, advice how to solve this error ? Sorry for ugly code, but I'm only
now and then C programmer :-)

I'm but rusty, and small help will get me on again...

Regards,

Robert.




_______________________________________________
avr-gcc-list mailing list
address@hidden
http://www.avr1.org/mailman/listinfo/avr-gcc-list


reply via email to

[Prev in Thread] Current Thread [Next in Thread]