I'm having problems configuring semihosting for my project. I'm using MQX and a PEMicro debugger in MCUXpresso. I want to note that is not a problem with the code and how the UART and debug ports are configured because semihosting works perfectly fine using a Segger JLink probe. Unfortunately, all the rest of the team are using PEmicro probes so I have to configure the project for semihosting using those.
In MCUXpresso IDE and Semihosting it is explained how to make semihosting work in MCUXpresso but using KSDK and that is totally different than using MQX so it didn't help.
K60 PE Micro debugging not working console using printf seems more about printf not working on a UART port which is not what I need and the referenced thread KDS printf issues with -nanolibc explains how the presence of -nanolibc may cause the problem, but I'm not using -nanolibc in my project so that is also not the issue.
ErichS Semihosting with Eclipse and the NXP Kinetis SDK V2.0 article explains it with eclipse in general but I'm not using -Xlinker -z and -Xlinker muldefs Linker flags. Changing ‘-specs=nosys.specs’ with ‘specs=rdimon.specs’ doesn't help either. Finally, I'm not using KSDK, I'm using MQX and those two are completely different.
Does anyone know how to configure semihosting in MCUXpresso with MQX and a PEMicro debugger? Or point me in the right direction.
Thanks!
If Semihosting works for your project with the SEGGER probe, then it should work with the P&E one too, as there are two parts:
a) the library part which uses a breakpoint to call the debugger via an exception
b) the probe which catches the breakpoint/exception
So a) obviously works for you, so the question might be about b).
One thing to notice is that (at least in the past) P&E only implemented part of the semihosting protocol, for example file I/O was not possible, while normal 'printf' style worked well.
I would suggest that P&E probes (Multilink Universal?) are using the latest firmware. If you use MCUXpresso IDE (recommned latest version which is 10.3.1) it will automatically udpate the firmware, and in the IDE you can automatically download the latest drivers from the P&E website.
I hope this helps,
Erich
ErichS thanks for helping. And yes, I'm working with 10.3.1 and Multilink Universal which as you mention, was updated by the IDE once I plugged it to my computer.
Nevertheless, it still doesn't work. I think we are just going to get rid of the PEMicros and get the whole team JLinks, that's cheaper, faster and easier.
Hi Manuel,
Thank you for bringing this to our attention. Any chance you can share your MQX project with me off line: zahar "dot" raskin "at" pemicro "dot" com. It would be helpful for us to take a look at the configurations of your project in order to determine what could be the reason for semi-hosting not working.
What is the name and revision of PEmicro interface are you using?
What plugin version number are you working with? You can find it out by going to Help -> About MCUXpresso IDE -> Installation Details -> read the version number of GNU ARM PEMicro Interface Debugging Support plugin.
Best Regards,
Zahar
P&E
Thank you very much for jumping in!
I'm using a PEMicro Multilink Universal Rev C. and the plugin version is 4.1.3.201905161939
Also, I'm working on a Linux Machine in case that's important.
Unfortunately, I can't share the project but you can tell me what is the correct configuration when working with the following setup:
As I mentioned before, semihosting is working fine with the JLink probe so I don't think it's the project configuration or the compilation options on the BSP and PSP. I think is more from the debug options, but I'm not sure, I can't find the correct combination of checkboxes.
Regards
Manuel Malagon
Hi Manual,
Please take a screen capture of the PEmicro Startup tab under debug configuration with your telnet settings in place. In order to get to it, you can click Debug under Debug your project tab which will automatically create a debug configuration. Once it is created, please go to Debug Configurations -> select GDB PEMicro Interface Debug configuration -> go to Startup tab and make sure that Enable semihosting/Console routed to Telnet/Enable Telnet console are checked and Telnet Port is assigned to an available port number.
Please run sudo netstat -nlp in a terminal window to confirm that the default Telnet port is not used by a different program on your PC, otherwise you can always change it to a different number.
When you look for the printf outputs, are you specifically looking in the PE Debug Semihosting Console?
Which device are you currently working with?
If you create a default hello world project with MCUXpresso SDK, do you see semihosting data being printed in PE Debug Semihosting console?
Best Regards,
Zahar
P&E
That is the exact configuration I'm using.
Also, I don't know if it matters but this is what I have in the "Debugger" tab:
When I'm running the debug session I get this for netstat -nlp
I can see the pegdbserver listening to the configured Telnet port 51794 as well as the GDBMI Port (6224), the Server Port Number (7224), and the Streaming Server Port (10224). But why is it also listening from the configured port 7224 up to the 7234 in increments of two for a total of 10 ports?
If I create a hello world with MCUXpresso the semihosting works, but this is a project with the KSDK2.0 so is not applicable, nevertheless, I wonder what is different, I would make a comparison but the code bases are completely different, also, for MQX it should work for the PEMicro the same way it does for the JLink with the same configuration. The only thing I can think of is that maybe semihosting for the PEMicro involves more changes in other header files I'm not aware of.
Could this be possible?
Thanks for helping.
Hi Manuel,
Our semihosting support relies on the project/compiler inserting a software breakpoint into a printf routine. Once the breakpoint is hit, we check whether the semi-hosting message is ready and then output it to our semi-hosting console.
We have a way to enable debug log capture, which will tell us whether this semi-hosting message is properly detected by PEmicro plugin. In order to enable it, please insert -outputdebugfile command into Server Parameter box under Debugger tab in Debug Configurations.
In order for this file to be generated, you have to make sure that the following directory in your MCUXpresso layout has corresponding write permissions: {MCUXpresso installation folder}/ide/plugins/com.pemicro.debug.gdbjtag.pne_4.1.3xxxx/lin
please run the following command to grant these permissions accordingly: sudo chmod 777 -R lin
The next time you run a debug session, you will find gdbserverdebug.out file in corresponding lin directory. Can you please email it to me for further analysis: zahar "dot" raskin "at" pemicro "dot" com.
I downloaded and installed MQX 4.1.1 to try and replicate your base setup, but could not find an eclipse MQX plugin that should help to import MQX example projects into the IDE. If this is something that you are using in your setup, can you please point me to location where this MQX plugin can be downloaded from.
Best Regards,
Zahar
P&E
There is no MQX plugin that I'm aware of for MCUXpresso. But you can refer to a small Guide for working with MQX in MCUXpresso I have created with the procedure I use to work with MQX in MCUXpresso.
I'll work in the changes and get back to you with the requested file.
Thanks!