You could add
"${MCUToolsBaseDir}/ARM_GCC_Support/ewl/EWL_Runtime/include"
to your ARM gcc compiler include path directories (project options).
I did this, but then I got tons of other errors. It looks like that part of the EWL libraries is not adopted for gcc.
Anyway, atoi() is not part of the ANSI standard libraries, so using/depending on it will not be portable. That's why I ended up to have my own version of it. For this, I have added it to my Utility Processor Expert component (based on an open source version of ChaN (yes, the same famous person who wrote that FatFs :smileyhappy:). Below is the source:
/*------------------------------------------------------------------------/
/ Universal string handler for user console interface
/-------------------------------------------------------------------------/
/
/ Copyright (C) 2010, ChaN, all right reserved.
/
/ * This software is a free software and there is NO WARRANTY.
/ * No restriction on use. You can use, modify and redistribute it for
/ personal, non-profit or commercial products UNDER YOUR RESPONSIBILITY.
/ * Redistributions of source code must retain the above copyright notice.
/
/-------------------------------------------------------------------------*/
byte UTIL1_xatoi(const unsigned char **str, long *res)
{
/* 123 -5 0x3ff 0b1111 0377 3.25 w "
^ 1st call returns 123 and next ptr
^ 2nd call returns -5 and next ptr
^ 3rd call returns 1023 and next ptr
^ 4th call returns 15 and next ptr
^ 5th call returns 255 and next ptr
^ 6th call returns 3 and next ptr, caller needs to read '.'
^ 7th call returns 25 and next ptr
^ 8th call fails and returns ERR_FAILED
*/
unsigned long val;
unsigned char c, r, s = 0;
*res = 0;
while (**str==' ') {
(*str)++; /* Skip leading spaces */
}
c = **str;
if (c == '-') { /* negative? */
s = 1;
c = *(++(*str));
}
if (c == '0') {
c = *(++(*str));
switch (c) {
case 'x': /* hexadecimal */
r = 16; c = *(++(*str));
break;
case 'b': /* binary */
r = 2; c = *(++(*str));
break;
default:
if (c <= ' ' || c == '.') {
return ERR_OK; /* single zero */
}
if (c < '0' || c > '9') {
return ERR_FAILED; /* invalid char */
}
r = 8; /* octal */
break;
} /* switch */
} else {
if (c < '0' || c > '9') {
return ERR_FAILED; /* EOL or invalid char */
}
r = 10; /* decimal */
}
val = 0;
while (c > ' ' && c != '.') {
if (c >= 'a') c -= 0x20;
c -= '0';
if (c >= 17) {
c -= 7;
if (c <= 9) return ERR_FAILED; /* invalid char */
}
if (c >= r) return ERR_FAILED; /* invalid char for current radix */
val = val * r + c;
c = *(++(*str));
} /* while */
if (s) val = 0 - val; /* apply sign if needed */
*res = (long)val;
return ERR_OK;
}
You can use zero for ERR_OK, and non-zero for ERR_FAILED. Or use the Utility component. The Utility module contains other functions to scan or convert numbers, just in case. The sources for it are on GitHub.