I have been trying to make semi-hosting to work with my FRDM-K64F board, with mixed results so far. Before anyone starts pointing out some other similar threads here in the community forum or Erich Styger's blog, please let me assure you that I did read all of them, and no, the issue is not resolved yet. I also have some additional observations and information, which might be just enough for someone to figure out where the problem is, so please read on...
My setup is Windows 10 Pro x64, with Kinetis Design Studio 3.0 (with all recent updates, PE version is 3.0.2) and KSDK 1.3.0. I checked and this comes with GNU ARM Embedded v.4.8.4 from Launchpad. In addition, I also have a custom Mars.1 x64 Eclipse installation with the most recent GNU ARM Eclipse plugins, Processor Expert 3.0.2, KSDK 1.3.0 (same location as used with KDS 3.0), and GNU ARM Embedded GCC v. 4.9.3 from Launchpad. For programming and debugging I use J-Link EDU directly on the SWD header of the MK64FNxxxxx MCU.
Here is the tale of my woes:
In KDS 3.0.0, I created a new Kinetis project with KSDK 1.3.0 and no Processor Expert code. I changed the project linker settings to use -spec=rdimon.spec instead of -spec=nosys.spec and compiled the project. When I start a debugging session using the SEGGER launch configuration, printf debug messages started showing in the semihosting console window without problems. YAY!
The second test was almost the same with the only difference in the setup - adding Processor Expert with KSDK via the New Project wizard. I did not change any of the PE components settings, only replaced nosys.spec with rdimon.spec, added #include <stdio.h> to main.c and started spitting out printf in the for loop at the end of main.... but nothing showed up in the semihosting console.
I had even less success with the custom Eclipse installation: neither test (only KSDK 1.3.0, and KSDK + PE) produced any output. This is with the newer toolchain. When I replaced the toolchain location in the Eclipse project settings with the location from KDS 3.0.0, I had the same result as with KDS: in the *pure* KSDK project semihosting works, when I add Processor Expert, it doesn't.
At this point I wen't back to KDS 3.0.0 and did the very first test again, but replaced the version 4.8.4 toolchain with the newer one and recompiled the project. No printf output!!!
So it seems that semihosting stops working with newer toolchains than 4.8.4 (or maybe it's just gdb at fault only?) and/or after adding Processor Expert to the mix. I even tried using the 5.x GCC branch from Launchpad, bit it did not work at all. I cannot figure it out and would appreciate some help here. I am out of ideas...