Hi @mohd_
In this case, this is the behaviour of the PRINTF function.
if the number for the left padding is greather than the number to be printed, the PRINTF function will pad blank spaces.
Please, take a look at the below snapshot:
https://mcuxpresso.nxp.com/api_doc/dev/116/group__debugconsole.html
I hope this could help you!
If you have any comment of further question, let me know!
All the best,
Diego
Hello Diego,
That is true the row above in the table states that a 0 prefix replaces space with zero padding and the format give was "%02X", as would be the case with standard C printf formatting.
Might this be a size optimization option to trimming down the set of formatting variants supported?
@mohd_: Have you considered rolling your own simple zero-extended tracing function as a workaround? Below is one such straightforward and entirely untested implementation
void PrintZeroExtended(uint32_t value, uint32_t radix, int32_t width) {
char buffer[sizeof "01234567"];
char *textptr = &buffer[sizeof buffer];
*--textptr = '\0';
do {
*--textptr = "0123456789ABCDEF"[value % radix];
value /= radix;
} while(--width >= 0 || value);
PRINTF("%s", textptr);
}
Regards,
Johan