I have to use freeRTOS for an assignment. I have never used it before. I found this piece of code my teacher has uploaded (see code). I think it would be useful for me to play around with this so I can get better practice with FreeRTOS. The code is supposed to tell me the number of stacks left after each function call. In this example, there is only one function (foo), and it calls itself foo(counter+1). There are 4096 stacks and they should reduce by 32 after each function call.
void foo(int counter) {
printf("foo() called ... count = %d\n", counter);
vTaskDelay(1000);
unsigned int temp = uxTaskGetStackHighWaterMark(nullptr) ;
printf("high stack water mark is %u\n", temp);
foo(counter+1) ;
printf("\n");
}
void task(void *ignore) {
foo(1);
}
void setup() {
// put your setup code here, to run once:
xTaskCreate(&task, "task", 4096, NULL, 5, NULL);
}
void loop() {
}
My problem is that I am getting this as an output from the serial monitor (see image below)
I should be getting something like this:

I know that the code is correct because it's a straight-up copy and paste from my professor's demo. so there must be something wrong with my setup. any ideas?
I'm using ESP32 board (DOIT ESP32 DEVKIT V1).
