MCUXpresso IDE and Semihosting

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MCUXpresso IDE and Semihosting

MCUXpresso IDE and Semihosting

Semihosting printf with MCUXpresso IDE

When importing MCUXpresso SDK projects into MCUXpresso IDE, they will be configured by default to use “semihosting” for the terminal output. This means the project will use the debugger connection to send terminal characters instead of the UART. More information on semihosting can be found on this Community document and in Section 11.4 of the MCUXpresso User Guide.

 

Note that the information in this post is only applicable when using the MCUXpresso IDE, as the projects for other IDEs will use the UART by default when opening up their respective MCUXpresso SDK projects. Also semihosting only works when there is an active debug connection to the device. 

 

printf with semihosting:

 180548_180548.PNGsemihosting.PNG

printf with UART Terminal (with TeraTerm):

180549_180549.pnguart.png

 

How to choose UART output during the project import

In order to use the UART for MCUXpresso IDE projects, some configuration settings need to be modified when importing in the project. First, you will need to uncheck the “Enable semihosting” option to clear the box. This will tell the project to use the normal libraries and not the semihosting libraries.

 180550_180550.pngenable_semi.png

Then on the next screen, you’ll want to uncheck the “Redirect SDK “PRINTF” to C library “printf”” box to clear it. This will tell the project to use the MCUXpresso SDK source files for printf instead of the generic C files. This allows you to debug, and modify if desired, the printf functionality found inside the MCUXpresso SDK. Section 5.1.2 of the MCUXpresso IDE User Guide describes the options on this screen in more detail.

 180551_180551.pngredirect.png

 

Switching between semihosting and UART

If you’re already imported the project and wish to switch between using semihosting or the UART, you can do this from the “Quick Settings” menu inside the Quickstart panel. 

180552_180552.pngswitch.png

 

If moving from semi-hosting to UART, this will change the library used to “nohost-nf” and set SDK_DEBUGCONSOLE define to 1 inside the pre-processor settings.

If moving from UART to semi-hosting, this will change the library to “semihost-nf” and set SDK_DEBUGCONSOLE define to 0. 

 

If you're not seeing any printf output, double check you have the right settings. 

 

Note that when importing the project initially and “Enable semihosting” is deselected and “Redirect SDK “PRINTF” to C library “printf”” is deselected in order to use the UART for terminal output, there is no SDK_DEBUGCONSOLE defined in the project settings. However inside the debug console SDK code itself, there is a #if statement so that if that value is not defined, then that define is set to 1, and hence why the SDK debug console is still used in that case.

Comments

As of 10.3, information on semihosting is not "in Section 11.4 of the MCUXpresso User Guide" any longer. Try section 16.4.

[showing once again why forums are basically useless for maintaining useful information]

100% helpful (2/2)
Version history
Last update:
‎03-30-2017 02:14 PM
Updated by: