How to enable debug output in mbedtls_selftest sample?

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

How to enable debug output in mbedtls_selftest sample?

2,224 Views
TomGibson
Contributor III

I am attempting to find out how to enable mbedtls debug output, I have imported the mbedtls_selftest sample to mcuxpresso and in the mbedtls/include/port/ksdk/ksdk_mbedtls_config.h uncommented the #define MBEDTLS_DEBUG_C line. I have also called mbedtls_debug_set_threshold from my main function. However, at no point during execution of the code sample does mbedtls_debug_print_msg appear to be called. Despite defining MBEDTLS_DEBUG_C the IDE still greys out most of the contents of mbedtls/library/debug.c. What am I missing, why is defining MBEDTLS_DEBUG_C and setting the output level not enough to generate debug output?

0 Kudos
Reply
3 Replies

2,219 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @TomGibson 

 

Please run the mbedtls_selftest example by default, without any change, open a terminal on PC,

you can see the debug log.

Also you need confirm connected to the right UART port. You can see readme.txt under project , and check from below codes in main() function:

BOARD_InitBootPins();

BOARD_InitDebugConsole();

 

BR

Alice

0 Kudos
Reply

2,217 Views
TomGibson
Contributor III

Thanks for your reply @Alice_Yang.

I can already see the output you mention from mbedtls_printf in the UART, the issue is that I have set the debug threshold via the appropriate library function and defining the appropriate constant in the KSDK MbedTLS config file, but this does not appear to enable the mbedtls debug output from within the library itself (the debug output is not the same as the printfs I can see on the UART which the code sample sends and all originate in the selftest.c file).

Enabling the debug output should mean the library prints appropriate debug/trace messages from its internal code via the MBEDTLS_SSL_DEBUG_MSG macro, but this function appears to never be called and the IDE editor appears to show that it is not enabled despite my defining MBEDTLS_DEBUG_C in the header file mentioned above.

0 Kudos
Reply

2,191 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @TomGibson 

 

About MBEDTLS usage, how about ask help from arm MBED-TLS:

https://www.arm.com/technologies/mbed-tls   

 

BR

Alice

0 Kudos
Reply