Hello,
the instruction
ValTable[117000] = 0;
causes this error:
...\cco7daaa.s:201: Error: A00041 Offset argument of ..globwrite directive is greater than 65535.
How would I modify .globwrite to accept higher indexes?
Thank you.
Regards,
Martin H.
.globwrite directive is greater than 65535
-
- Member++
- Posts: 19
- Joined: Thu Oct 01, 2015 10:55 am
-
- Respected Member
- Posts: 318
- Joined: Tue Dec 15, 2009 12:46 am
The mechanism the tools use to check for parallel usage errors in xC limits the maximum constant index you can use to access a global array to 2^16. A simple example which errors is as follows:
char a[0x10001];
int main() {
a[0x10000] = 0;
return 0;
}
One way to workaround this limitation is to access the array using an index that is not a constant expression:
int main() {
int i = 0x10000;
a = 0;
return 0;
}
Alternatively you could take a pointer to the array and access the elements indirectly via the pointer:
int main() {
char *p = a;
p[0x10000] = 0;
return 0;
}
char a[0x10001];
int main() {
a[0x10000] = 0;
return 0;
}
One way to workaround this limitation is to access the array using an index that is not a constant expression:
int main() {
int i = 0x10000;
a = 0;
return 0;
}
Alternatively you could take a pointer to the array and access the elements indirectly via the pointer:
int main() {
char *p = a;
p[0x10000] = 0;
return 0;
}