Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace ipconfigHAS_PRINTF by FreeRTOS_debug_printf in the ipARP_REPLY debug print #1048

Merged
merged 1 commit into from
Nov 30, 2023

Conversation

microcris
Copy link
Contributor

Replace ipconfigHAS_PRINTF by FreeRTOS_debug_printf in the ipARP_REPLY debug print

Description

The comment in the "#endif" directive states that it belongs to "ipconfigHAS_DEBUG_PRINTF". I'm changing the "#if" directive conditional expression to "ipconfigHAS_DEBUG_PRINTF". And besides that, it is quite annoying to have "ipARP_REPLY from c0a8026dip to c0a8026dip end-point c0a80272ip" all the time int the serial console.

Test Steps

It is just print replacement.
The existing comment states that " /* Some extra logging while still testing. */". In order to have that extra logging, let us must enable the ipconfigHAS_DEBUG_PRINTF flag.

Checklist:

Not applicable

Related Issue

Not applicable

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

The comment in the "#endif" directive states that it belongs to "ipconfigHAS_DEBUG_PRINTF". I'm changing the "#if" directive conditional expression to "ipconfigHAS_DEBUG_PRINTF". And besides that, it is quite annoying to have "ipARP_REPLY from c0a8026dip to c0a8026dip end-point c0a80272ip" all the time int the serial console.
@microcris microcris requested a review from a team as a code owner November 27, 2023 23:08
@htibosch
Copy link
Contributor

htibosch commented Nov 30, 2023

@microcris wrote:

And besides that, it is quite annoying to have "ipARP_REPLY from c0a8026dip to c0a8026dip end-point c0a80272ip" all the time int the serial console.

As you possibly know, there is an alterative implementation of the [vsn]printf() functions called printf-stdarg.c. These functions are reentrant, they are thread- and interrupt-safe, and they use a small stack. They do not implement floating point numbers.

I added two special formats that allow to print IPv4 and IPv6 IP-addresses: %xip and %pip:

    uint32_t ulSourceAddress;
    printf( ( "IPv4 address is %xip\n", ulSourceAddress ) );

    IPv6_Address_t xSourceAddress;
    printf( ( "IPv6 address is %pip\n", ( void * ) xSourceAddress.ucBytes ) );

/* Output: */
    IPv4 address is 192.168.02.109
    IPv6 address is 2600:70ff:c066::2001

So the address c0a8026dip stands for 192.168.02.109

If you link printf-stdarg.c into your project, you will also see the proper IP-addresses.

Copy link
Contributor

@htibosch htibosch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @microcris for this PR. I agree that an ARP reply is not a very interesting event, and it should be printed at debug level only.

@moninom1 moninom1 merged commit 8133702 into FreeRTOS:main Nov 30, 2023
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants