weAutSys' system software partly contains debugging instructions and calls that can be turned on at compile time by means of macros called DEBUG_<module> (DEBUG_NTP etc.) with values in the range 0..5. The higher the value the more debug information is usually supplied.
Undefined (or defined as 0 for clarity) means no debugging at all for that module throwing out all concerned calls and constants at compile time.
weAutSys supplies two handful functions that simplify the formatting of debug information and outputting them to the serial (UART) output. UART output allows almost any PC or laptop to be used as observation and logging instrument therefore.
User software is free to use the same (recommended) schema and — with care — those supporting functions.
As the production rate of debugging info may be quite high and UART speed and buffer space is limited, all these debugging helpers for UART output do spin waiting for enough space. This, of course, violates all rules for CPU usage.
Hence the use of those functions must really be restricted to debugging only.
And, by defining all said DEBUG_.. macros to 0 or other means, debugging has to be turned out completely for production software (quite in contrast to software instrumentation).
The formatters used by the debugging functions may, of course, be utilised directly without any restrictions.
The test / debug switches (macros) allow special code — mainly test outputs via standard / serial output — to be compiled in for development purposes. The higher the value the more verbose is the respective output. For an online productive system all test / debug switches should be off or 0.
The settings shown in this documentation might differ from the single weAut_01 module's generated code. If in doubt check the RS232 output with a terminal (emulator program).
Functions | |
void | bufLog2Dec_P (char const *src, uint16_t info1, uint16_t info2) |
Log a program space string + two 3 digit decimal numbers to buffered log output. | |
void | bufLog4HexBE (uint16_t const info) |
Log a four digit big endian hex number to buffered log output. | |
void | bufLog8HexBE (uint32_t const info) |
Log an eight digit big endian hex number + one space to buffered log output. | |
void | bufLogDec (uint16_t const info) |
Log a 4 digit decimal number to buffered log output. | |
void | bufLogDec3 (uint8_t const info) |
Log a three decimal digit number with leading zeroes to buffered log output. | |
void | bufLogDec_P (char const *src, uint16_t info) |
Log a string from program space + a 4 digit decimal number to buffered log output. | |
void | bufLogDecB (uint8_t const info) |
Log a two decimal digit number with leading zeroes to buffered log output. | |
void | bufLogDecHex_P (char const *src, uint16_t info1, uint32_t info2) |
Log a program space string + a 3 digit decimal + an 8 digit hex number to buffered log output. | |
void | bufLogHex (uint8_t const info) |
Log a two digit hex number to buffered log output. | |
void | bufLogHex_P (char const *src, uint8_t info) |
Log a string from program space + a two digit hex number to buffered log output. | |
void | bufLogHexHex_P (char const *src, uint8_t info1, uint32_t info2) |
Log a program space string + a 2 digit and an 8 digit hex number to buffered log output. | |
void | bufLogLF (uint8_t n) |
Log space and linefeed to buffered log output. | |
void | bufLogMark (char *info, uint8_t const len) |
Output a (debug) marker text. | |
void | bufLogTThex_P (char const *tx1, char const *tx2, uint8_t info) |
Log two flash strings + a two digit hex number to buffered log output. | |
void | bufLogTxt (char *src, uint8_t n) |
Log some characters from RAM to buffered log output. | |
void | bufLogTxt_P (char const *src) |
Log some characters from program space to buffered log output. |
void bufLogTxt_P | ( | char const * | src | ) |
Log some characters from program space to buffered log output.
This debugging function does essentially the same as bufLogPutSt_P but it will not drop anything if not enough output buffer space is available. Instead it will just overwrite the oldest output.
Anyway the number of characters output will be restricted to BUF_STREAMS_CAP. And, of course, the output stops at the first 0 in src
.
src | the characters to be output in flash memory (0-terminated) |
void bufLogTxt | ( | char * | src, |
uint8_t | n | ||
) |
Log some characters from RAM to buffered log output.
This debugging function does the same as bufLogTxt_P except that the string to be output is in RAM and the extra length limit n
. Anyway the output will stop at the first 0 (zero) character.
All the restrictions and warnings are the same as for bufLogTxt_P .
src | the characters to be output in RAM |
n | the maximum number of characters to be output |
void bufLogDec_P | ( | char const * | src, |
uint16_t | info | ||
) |
Log a string from program space + a 4 digit decimal number to buffered log output.
This debugging function outputs the flash memory text src
and appends directly a four digit decimal number /c info right aligned.
The same restrictions and warnings apply as for bufLogTxt_P.
src | the characters to be output in Flash memory (not NULL !) |
info | the four digit number as extra info (right aligned) |
void bufLog2Dec_P | ( | char const * | src, |
uint16_t | info1, | ||
uint16_t | info2 | ||
) |
Log a program space string + two 3 digit decimal numbers to buffered log output.
This debugging function is similar to bufLogDec_P. It outputs the flash memory text (src, n) appends directly two three digit decimal numbers info1
and info2
with leading zeroes + a line feed.
The same restrictions and warnings apply as for bufLogTxt_P.
src | the characters to be output in Flash memory |
info1 | the three digit number as extra info (right aligned, 0..999) |
info2 | the second three digit number, 0..999 |
void bufLogDecHex_P | ( | char const * | src, |
uint16_t | info1, | ||
uint32_t | info2 | ||
) |
Log a program space string + a 3 digit decimal + an 8 digit hex number to buffered log output.
This debugging function is similar to bufLogDec_P. It outputs the flash memory text src
) appends directly a three digit decimal number info1
with leading zeroes and an 8 digit hex number info2
The same restrictions and warnings apply as for bufLogTxt_P.
src | the characters to be output in Flash memory |
info1 | the three digit number as extra info (right aligned 0..999) |
info2 | the eight digit hex number |
void bufLogHexHex_P | ( | char const * | src, |
uint8_t | info1, | ||
uint32_t | info2 | ||
) |
Log a program space string + a 2 digit and an 8 digit hex number to buffered log output.
This debugging function is similar to bufLogDec_P. It outputs the flash memory text src
appends directly a two digit haxadecimal number info1
, a blank and an 8 digit hex number info2
The same restrictions and warnings apply as for bufLogTxt_P.
src | the characters to be output in Flash memory |
info1 | the two digit hex number as extra info |
info2 | the eight digit hex number |
void bufLogHex_P | ( | char const * | src, |
uint8_t | info | ||
) |
Log a string from program space + a two digit hex number to buffered log output.
This debugging function outputs the flash memory text src
and appends directly a two digit hexadecimal number info
.
The same restrictions and warnings apply as for bufLogTxt_P.
src | the characters to be output in Flash memory |
info | the hex number (two digits) |
void bufLogTThex_P | ( | char const * | tx1, |
char const * | tx2, | ||
uint8_t | info | ||
) |
Log two flash strings + a two digit hex number to buffered log output.
This debugging function outputs the flash memory texts tx1
and tx2
directly concatenated. After a space the two digit hexadecimal number info
+ a line feed is output.
The same restrictions and warnings apply as for bufLogTxt_P.
tx1 | the characters to be output from flash memory (not NULL !) |
tx2 | more characters to be output from flash memory (not NULL !) |
info | the hex number (two digits) |
void bufLogDec | ( | uint16_t const | info | ) |
Log a 4 digit decimal number to buffered log output.
This debugging function outputs a four digit decimal number /c info right aligned + a space.
info | the four digit number |
void bufLogDec3 | ( | uint8_t const | info | ) |
Log a three decimal digit number with leading zeroes to buffered log output.
This debugging function outputs a three digit decimal number /c info with leading zeros ("000" .. "255").
info | the three digit number |
void bufLogDecB | ( | uint8_t const | info | ) |
Log a two decimal digit number with leading zeroes to buffered log output.
This debugging function outputs a two digit decimal number /c info with leading zero. A value 0..99 will be output as two characters " 0" .. "99". Values of 100 and above will get " *".
info | the two digit number |
void bufLogHex | ( | uint8_t const | info | ) |
Log a two digit hex number to buffered log output.
This debugging function logs a two digit hexadecimal number.
info | the hex number (two digits) |
void bufLog4HexBE | ( | uint16_t const | info | ) |
Log a four digit big endian hex number to buffered log output.
This debugging function logs a 4 digits two big endian bytes hexadecimal number.
info | the hex number (4 digits, big endian) |
void bufLog8HexBE | ( | uint32_t const | info | ) |
Log an eight digit big endian hex number + one space to buffered log output.
The same restrictions and warnings apply as for bufLogTxt_P.
info | the hex number (8 digits, big endian) |
void bufLogMark | ( | char * | info, |
uint8_t const | len | ||
) |
Output a (debug) marker text.
The text output is " # # @ <ms-stamp>/<12,8 µs> : <info>"
Both time stamps are hexadecimal. The first one is the system run time in ms since start / reset. The second is a 12,8µs tick counter that wraps independently about every 3,27 ms.
info | marker text (short !, might be NULL) |
len | info's length (0..31) |
void bufLogLF | ( | uint8_t | n | ) |
Log space and linefeed to buffered log output.
This debugging function outputs a space + a linefeed at least once to max. 16 times if n is in the range 2..16.
The same restrictions and warnings apply as for bufLogTxt_P.
n | the number of lines |