XC8 : Connot use defined variable

231 views Asked by At

I define a struct as following:

struct _connection_info_t{
char unique_name[5];
char ip[16];
char port[5];
}WIFI_connection_info_g[2],zz[3];

And use WIFI_connection_info_g[0] variable in "sprintf" function :

sprintf(buffer,"AT+CIPSTART=\"TCP\",\"%s\",%s",WIFI_connection_info_g[0].ip,WIFI_connection_info_g[0].port);

When i compile above code,the compiler generate following error :

wifi_tempalte.h:290: error: (1402) a pointer to eeprom cannot also point to other data types

But when i change "sprintf" function and use "zz" variable like following:

sprintf(buffer,"AT+CIPSTART=\"TCP\",\"%s\",%s",zz[0].ip,zz[0].port);

It compile successfully.

Note 1: My target device is 16f1829

Note 2: Compiler version is 1.30

1

There are 1 answers

0
user50619 On

Probably too big to declare in one go. You may have to declare different instances of it in different C files. xc8 can get confused. The compiler is targeting an 8 processor and it tends to keep things in the same page (256 RAM blocks) where it can. It can get confused though.