Debug Messages in A7 application in iMX7D

Hi,

We have used various debug messages(using simple printf statement) in A7 side application for debugging purpose. Later on we want to access these messages and also want options to categorise the debug messages at run time so that we can get a set of messages( like error messages, warning messages etc.) only from the application.
We want the logging of these messages and access of these messages at run time simultaneously.

What are the possible options to achieve this functionality ?

Regards
Bipin Kumar

Dear @bipin7301,

Please read our debug message documentation from here : https://developer.toradex.com/knowledge-base/enable-the-debug-messages
If you want to control on your debug message that would do that by dynamically enabling and disabling the sections that can be implemented in various methods. One simple approach would use DWORD control bit flags. it gives you 32 options. That can be kept in the registry and keep pool the registry to get the latest value in a thread and pass control bit flags to your application to act on debug messages.
Please read this document for concept details : https://guruce.com/blogpost/atemplatefordebugmessages

Please let us know if you have any other questions.

Hi Raja,

Is it possible to store the Debug messages of “Debug Message Buffer” in a separate file in NVM(SD card or Flash disk) ?
Can we use our own custom messages in application that can be directed to “Debug Message Buffer” and one could view them in “Debug Message Logger” ? and if it is possible then how to accomplish this ?

Our system is without any display and interface available is LAN. We want our application debug messages to somehow be available on LAN. It will also be required in field also. so we can not depend on visual studio for debug messages.

Regards
Bipin Kumar

Hi Raja,

I have tried the DEBUGMSG and RETAILMSG functionality of winCE with your example project " DbgMsgToFile" and it is working too.
I have few questions:

  1. Is there any way by which one can get the event whenever there is new msg comes in Debug message buffer ?

  2. I have noticed that debug messages comes on serial debug port (UART A) are same that are available in debug message buffer. On Debug serial port there are only system boot up messages however in Debug message buffer has system boot up messages + other messages + my application messages. I want to understand how this thing happned ? PFA Debug serial port messages and Debug message buffer messages files for your reference.link text

  3. I have referred the Microsoft link Debug messages and debug zones in Windows CE | Microsoft Learn
    for better understanding of the DEBUGMSG functionality. I want to enable/disable the Zones at run time.And tried the registry edit method but unable to do that. Can you please guide me to enable/disable the debug zones at run time.

4.Is there any feature available like DEBUGMSG to take the user input ?

Regards
Bipin Kumar

Dear @bipin7301,

Please see our answers below.

  • Is there any way by which one can get the event whenever there is new msg comes in Debug message buffer ?

Toradex: There are no events default, but you would implement such one using the Debug message logger application with events

  • I have noticed that debug messages comes on serial debug port (UART A) are same that are available in debug message buffer. On Debug serial port there are only system boot up messages however in Debug message buffer has system boot up messages + other messages + my application messages. I want to understand how this thing happned ? PFA Debug serial port messages and Debug message buffer messages files for your reference.link text

Toradex: You need to enable serial debug message to get all the debug prints on the serial port.

  • I have referred the Microsoft link Debug messages and debug zones in Windows CE | Microsoft Learn for better understanding of the DEBUGMSG functionality. I want to enable/disable the Zones at run time.And tried the registry edit method but unable to do that. Can you please guide me to enable/disable the debug zones at run time.

Toradex: You need to implement and build the source code to get that feature in your source code. Refer here for some information : http://geekswithblogs.net/BruceEitman/archive/2008/07/07/windows-ce-stream-interface-driver-dllentry.aspx
https://guruce.com/blogpost/atemplatefordebugmessages
or Do you want to control existing messages? You need to do debug build or checked build and use that image on the module. Please be remember that it will reduce performance. Ideally, it is useful for debugging purpose.

  • Is there any feature available like DEBUGMSG to take the user input ?

Toradex: Maybe you would try http://geekswithblogs.net/BruceEitman/archive/2008/05/09/windows-ce–using-the-debug-serial-port-for-input.aspx or https://www.toradex.com/community/questions/11480/route-wec7-command-line-to-serial-port.html

Please let us know if you have any other questions?

Hi Raja,

  • “Toradex: There are no events default, but you would implement such one using the Debug message logger application with events.”
    In case of a release build configuration, will the DEBUGMSG be written to the Debug message buffer? Our understanding is that the DEBUGMSG only work in case of a debug build. Is that correct?
    Also in release build configuration, if we use RETAILMSG, then will the RETAILMSG strings be available in the debug message buffer? And will the debug zones functionality available with the RETAILMSG.

  • Also while testing our application we would also need a user input. So we have a thread that displays a menu on the standard output and reads input from the standard input. The desktop version of windows allows us to redirect the standard I/O to another file using the SetStdioPath() function. But I am not able to use it in my application, I am not able to find the headers that declare this function. If I can redirect the standard input and output to a custom driver, then I have full flexibility to use it my way.

Serial port does not seem to be a good option as it will Slow down our system.

Dear @bipin7301,

In case of a release build configuration, will the DEBUGMSG be written to the Debug message buffer? Our understanding is that the DEBUGMSG only work in case of a debug build. Is that correct? Also in release build configuration, if we use RETAILMSG, then will the RETAILMSG strings be available in the debug message buffer? And will the debug zones functionality available with the RETAILMSG.

Toradex: DEBUGMSG will work for debug build only. RETAILMSG strings will be available in the debug message buffer. Debug zones won’t work with RETAILMSG.

Also while testing our application we would also need a user input. So we have a thread that displays a menu on the standard output and reads input from the standard input. The desktop version of windows allows us to redirect the standard I/O to another file using the SetStdioPath() function. But I am not able to use it in my application, I am not able to find the headers that declare this function. If I can redirect the standard input and output to a custom driver, then I have full flexibility to use it my way.

SetStdioPath is avilable for Windows Embedded Compact also.

Hi Raja,

To use SetStdioPath(), we need pkfuncs.h. However I am not able to locate this file in Toradex SDK. Where can we get the header file and library for SetStdioPath.

Also our query regarding DEBUGMSG in previous comment is still unanswered.

Note: We have a legacy application that we are trying to port on Toradex. In this application we have used printf and output of printf redirected to a file. So same kind of functionality we want to achieve in Toradex system also.

Regards
Bipin

Dear @bipin7301,

To use SetStdioPath(), we need pkfuncs.h. However I am not able to locate this file in Toradex SDK. Where can we get the header file and library for SetStdioPath.

Toradex: Maybe it is not part of our SDK. Could you install the Windows Embedded Compact and include the $WINCEROOT\public(findpath)\inc path in your application. This should solve the build error.

Also our query regarding DEBUGMSG in previous comment is still unanswered.

Could you check there now, I replied already there.

Note: We have a legacy application that we are trying to port on Toradex. In this application we have used printf and output of printf redirected to a file. So same kind of functionality we want to achieve in Toradex system also.

Thanks for the response Raja,

Now I am able to use SetStdioPath.

Regards
Bipin