[arm-gnu] With arm-none-eabi atoi and strtol don't work
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[arm-gnu] With arm-none-eabi atoi and strtol don't work
- To: arm-gnu@xxxxxxxxxxxxxxxx
- Subject: [arm-gnu] With arm-none-eabi atoi and strtol don't work
- From: Gene Smith <gds@xxxxxxxxxxxxx>
- Date: Fri, 03 Jul 2009 16:15:07 -0400
For some reason when I build a project for arm7tdmi everything seems to
build and work except calls to atoi or strtol don't decode the string to
an integer but always return 0. For example if the string is "128" the
return value is 0 for atoi or strtol.
Atoi or strtol works fine for an arm cortex M3 projects.
I compiled the newlib code for strtol inline with my program and I can
see with the debugger that isdigit() always returns false. If I fake
isdigit to return 1 for the characters in the string "128" it works and
strtoul returns 128 as it should.
It appears that the value of the pointer __ctype_ptr__ at 0x20000008 in
ram is zero. So when isdigit() macro in ctypes.c attempts to access the
lookup table for the ascii value index to determine the "ctype", e.g.,
_N, it never detects a "digit" character type.
I realize this is a bit sketchy and more information is probably needed,
but any suggestions on where to look or what I could be doing wrong
would be appreciated.
The code is based on the str71x_demo1 project found here:
http://www.siwawi.arubi.uni-kl.de/avr_projects/arm_projects/index_str.html
Thanks,
-gene