How to format UV_DBG_EXEC_CMD KAN198

I would like to see a worked example of a printf command being sent using this command as its not clear from the documentation.

It would be great if someone documented the endianess of the data types but I've been assuming little endian and this seems to work.

My problem is with this one command

echo is a 4 byte little endian uint = 1U

pad0is a 4 byte little endian uint = 0U

reserved is a 4*7 byte zero filled array

nLength is a 4 byte little endian uint  = 256U, the size of the fixed array, if you make it anything else it causes a syntax error

szStr[256] is a 256 byte array containing the null terminated ASCII format string. No matter what command I put in here, nothing happens. I would like to see some string command which has been proven to work both as a readable string and an ascii array.

  • Hi there, I have moved your question to the Keil forum. Many thanks.

  • I have some questions and some corrections to your statements regarding this topic:

    • You are right, the endianess is little-endian. µVision is Windows only and x86 only. x86 is little endian.
    • I assume that you have read the application note 198. The function UV_DBG_EXEC_CMD has 3 parameters, an int handle, a pointer to the structure EXECCMD and  an int that specifies the size of the structure EXECCMD.
    • What return value do you get when you call UV_DBG_EXEC_CMD? Is it UVSC_STATUS_SUCCESS?
    • Most of your questions are regarding the structure EXECCMD. Please note that this is a structure with some bitfields. If you are using the header files that come with the application note, you should be safe.
      • bEcho is the least significant bit of a 4 byte UINT
      • __pad__ is the remaining 31 bits of the previous 4 byte UINT that contains bEcho
      • nRes[7] are 7 unused UINTs.
      • The structure SSTR consists of
        • an int that specifies the length of the command string including the Null terminator
        • an array of 256 characters which needs to be filled with the command that should be executed.

    Does that explain your questions?

  • That is the missing piece of undocumented information!

    The pad0 is documented like a separate UINT but thanks to you I now learn that it is not a separate field, but merely the remaining 31 bits. That needs to be added to the documentation.

    Thanks you so much for your help Hans! I spent two days trying to crack that, but after reading your reply I deleted my pad0 field and immediately everything works :-) ich liebe dich ;-)

  • I think the documentation is complete in this respect. The bitfields are specified in the manual and in the source code. Please see:


    and the definition in UVSOCK.h also specifies the bitfield:

    Do you not use the header files that are provided in our application note 198?

  • I still think that if it is in the same variable, it should only have one entry.

    My code is in C# .NET8  not C++/C so I can't use the header files.

  • It is not "the same variable".  You're projecting your lack of understanding of the difference between C/C++, which this interface is expressed in, and C#, whcih you chose to use, into a supposed deficiency of the documentation.  There is none.  You're just misunderstanding it because your're reading it in a different language than the one it's written in.