cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
vibishna
Visitor
Visitor
4,590 Views
Registered: ‎05-03-2016

XAPP1172: Error: initializer element is not constant

Jump to solution

I was trying to run the xapp1172 for reading the values from XADC using a Makefile (running on the target):

 

CC=gcc

# Executable name
TARGET=xadc

# GCC compiling & linking flags
CFLAGS=-g -std=gnu99 -Wall
CFLAGS += -DVERSION=$(VERSION) -DREVISION=$(REVISION)
CFLAGS += -Ixadc_lib/include
CFLAGS += -Ixadc_lib/src
CFLAGS += -Ixadc_lib/linux_include
#CFLAGS += -I../../tmp/linux-xlnx-xilinx-v2015.2.01/include

LIBS=-lm -lpthread

# List of compiled object files (not yet linked to executable)
OBJS = xadc_lib/src/xadc_core.c xadc_read_cmd/src/xadc_main.c
# List of raw source files (all object files, renamed from .o to .c)
SRCS = $(subst .o,.c, $(OBJS)))

$(TARGET): $(OBJS)
$(CC) -o $@ $^ $(CFLAGS) #$(LIBS)

 

But I am getting the following error:

 

xadc_lib/src/xadc_core.c:121:111: error: initializer element is not constant
xadc_lib/src/xadc_core.c:121:111: error: (near initialization for 'gXadcAlarm[0].callback')
make: *** [xadc] Error 1

 

I checked the 121th line of xadc_core.c:

struct XadcThreshold gXadcAlarm[EAlarmMAX] = {
[EAlarmVccInt_TH] = { EAlarmVccInt_TH, "in_voltage0_vccint_thresh", 0, 0, conv_voltage, false,(struct Xadc_callback){0,0}, NULL},
[EAlarmVccAux_TH] = { EAlarmVccAux_TH, "in_voltage4_vccpaux_thresh", 0, 0, conv_voltage, false,(struct Xadc_callback){0,0}, NULL}, // todo: workaround
[EAlarmVccBRam_TH]= { EAlarmVccBRam_TH, "in_voltage2_vccbram_thresh", 0, 0, conv_voltage, false,(struct Xadc_callback){0,0}, NULL},
[EAlarmTemp_TH] = { EAlarmTemp_TH, "in_temp0_thresh", 0, 0, conv_temperature, false,(struct Xadc_callback){0,0}, NULL}
};

 

I have no clue! Any help in this regard will be great!

0 Kudos
1 Solution

Accepted Solutions
vibishna
Visitor
Visitor
8,198 Views
Registered: ‎05-03-2016

I modified the code and it is working!

View solution in original post

0 Kudos
1 Reply
vibishna
Visitor
Visitor
8,199 Views
Registered: ‎05-03-2016

I modified the code and it is working!

View solution in original post

0 Kudos