I've been going crazy trying to debug a problem with using some of the standard string functions, particularly strstr() and strchr(). When I use these under certain conditions (see below), my program always crashes, as indicated by lack of any output on the serial monitor and the need to press the button on the Teensy 4.0 to load any subsequent programs.

Configuration:
Teensy 4.0 with nothing attached except USB for download and serial monitor
Latest versions of VS Code and PlatformIO (latest version of Teensy40)
Teensy Loader 1.52

I'm using the string functions four function calls deep from setup(). To isolate the problem, I commented out most of my actual code and use the following as a test:
Code:
char *p;
p = strstr("Test String", "str");
I used literal strings to eliminate the possibility I was passing in a NULL pointer. This always causes a crash, but when I comment it out and put the same code into any of the three higher-level calling functions...no crash.

I thought it might be a stack overflow problem, since I had been using a 300-byte buffer as a local variable in the one of the three calling functions. I haven't yet been able to find the default stack allocation, but I saw some clues that it might be quite large. Anyway, I changed the buffer to a global and that didn't have any effect on the problem.

I'll keep plugging away at this (and maybe I'll just write my own version of strstr()), but I thought it was time to run the flag up for some help. Thanks!