I’m trying to split a string into substrings by using the strtok function, my Q2686H keeps on restarting when this part of the code is reached. At this point in time I assume it has something to do with memory, please help
The incoming string will look something like this:
Most likely, it’s a standard ‘C’ issue to do with bad pointers and/or running off the end of the string - not specifically Wavecom-related.
Note that strtok is part of the ANSI standard library - so have you checked that your basic algorithm is correct by running it on another ‘C’ platform; eg, MSVC, Borland, MINGW, etc…?
I have, as a matter of fact, tried running it on a PIC micro and it works fine, no problems. Any suggestions? Should I not maybe use adl_memGet to allocate memory to my string named str? str is however, a 2d array! I’m a little confused right now Has no one on this forum tried splitting a string with strtok, or am I missing something?
Hi Jeroen, I conclude with your comment. str1 should be char str1[4][30], just a typo from my side. My mistake or error lies somewhere else in my code then, off to find that bug! Will update you on my progress!
char term[3];
char *ptr;
char str1[4][30];
int cnt = 0;
Hi guys, there seems to be an error with the above variable declarations. It is somewhere in those four lines, where the Q2686H hangs and the WDT resets the hardware. Where can I find some good GCC compiler & ADL documentation as I find the quality of the Wavecom docs terrible.
It seems very unlikely that just variable definitions would cause a fault - unless they are local (automatic) variables, and you are overflowing the stack?
For the GCC compiler, it’s just the standard GNU documentation.
AFAIK, there is nothing special about the GCC used by Wavecom - so any general materials from anywhere about the same GCC version will be applicable.
ADL is entirely Wavecom-proprietary - so the Wavecom documentation is all there is, I’m afraid.
Unfotunately, this is true.
Open-AT is a great thing; it has only 3 problems:
Documentation;
Documentation;
Documentation.
Having said that, I did find that GNU’s GCC documentation - particularly the library documentation - was not at all easy to find!