Hi Mark,
so I ran a couple of tests which I think confirms your point that this is really a semi-hosting issue.
1st Test:
I kept configMINIMAL_STACK_SIZE to 8192, which is roughly 32 kb and the value of configTOTAL_HEAP_SIZE to 50 kb. I went through the debugger one step at a time, and as soon as pvPortMalloc() was for the 1st time inside vTaskStartScheduler(), pvReturn returned a value of 0. When pvPortMalloc() was called twice before vTaskStartScheduler() was called, pvReturn returned a valid memory address (verified via printf() ) each of those two times, however as soon as pvPortMalloc() was called inside vTaskStartScheduler(), it returned a value of 0.
2nd Test:
I changed configMINIMAL_STACK_SIZE to 500 which is about 2 kb and I kept the value of configTOTAL_HEAP_SIZE at 50 kb. In this 2nd run, pvPortMalloc() was called twice before vTaskStartScheduler() was called, which pvReturn returned a valid memory address (verified via printf() ) each of those two times. When vTaskStartScheduler() was called, pvPortMalloc() was called 5 times within that function, each time returning a valid memory address ( verified via printf() ), however after the 5th call of pvPortMalloc(), the debugger hitted line 1997 in vTaskStartScheduler(), the following line was:
if (xPortStartScheduler() != pdFALSE)
this resulted in a semi-host hard fault in the semi-host hard fault handler.c file.
After performing these two tests, I changed the SDK debug console to UART, I opened up TeraTerm, selected the serial COM port that said" mbed Serial Port", in my case COM4, then I changed the serial port settings to 115200 for speed, 8 bit for data, none for parity, 1 bit for stop bits, and none for flow control. I also went to the Terminal settings and set "Receive" value to "LF". When I tried running my code again in MCUXpresso IDE, I didn't see anything printed in the console (expected behavior), however I did not see anything printed out in TeraTerm either. Not only that, but I still received a semi-host hard fault.
I feel like the heap issue is resolved after those 2 tests (I now use 500 words for stack size and keep HEAP size at 50 kb). It is now my configuration settings in regards to switching from semi-hosting to UART. I followed the tutorial here on this site for that process, it was pretty straight forward. I'm not sure what I could have missed or done wrong.