Skip to content

Use cyw43 macros for bluetooth logging #2490

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

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

peterharperuk
Copy link
Contributor

CYW43_PRINTF is used for errors
CYW43_DEBUG is for messages in debug builds only
CYW43_VDEBUG is disabled by default

Fixes #2253

@peterharperuk peterharperuk requested a review from kilograham May 29, 2025 17:25
@kilograham
Copy link
Contributor

not yet convinced as CYW43_PRINTF seems to be on by default (?) which means we're now getting a bunch more logging

@peterharperuk
Copy link
Contributor Author

I've replaced calls to cybt_printf with calls to CYW43_PRINTF. So as far as I can see this should NOT produce more logging. I don't see extra logging when I test bluetooth.

@kilograham
Copy link
Contributor

I'm confused (from cyw43_config.h)

#ifndef CYW43_PRINTF
#include <stdio.h>
#define CYW43_PRINTF(...) printf(__VA_ARGS__)
#endif

#ifndef CYW43_VDEBUG
#define CYW43_VDEBUG(...) (void)0
#define CYW43_VERBOSE_DEBUG 0
#endif

#ifndef CYW43_DEBUG
#ifdef NDEBUG
#define CYW43_DEBUG(...) (void)0
#else
#define CYW43_DEBUG(...) CYW43_PRINTF(__VA_ARGS__)
#endif
#endif

#ifndef CYW43_INFO
#define CYW43_INFO(...) CYW43_PRINTF(__VA_ARGS__)
#endif

#ifndef CYW43_WARN
#define CYW43_WARN(...) CYW43_PRINTF("[CYW43] " __VA_ARGS__)
#endif

Which is why i thought CYW43_PRINTF is supposed to print, and you should use the other macros to route to it.

I don't see anything in pico-sdk at least that disables CYW43_PRINTF by default

@kilograham
Copy link
Contributor

Note also that the cyw43_driver only uses it directly in a dump_ debugging method

@peterharperuk
Copy link
Contributor Author

peterharperuk commented May 30, 2025

You're saying that my change enables more logging. I'm just telling you that it behaves the same.
Also there are other uses of CYW43_PRINTF in the sdk. I think the idea is that you define CYW43_PRINTF to something else if you don't want to see error messages.

@kilograham
Copy link
Contributor

I'm saying you are compiling more printf strings into the binary, not necessarily that they are being printed

the driver itself seems to use CYW43_WARN for such error strings (which seems to be where we're mostly using them)

Also there are other uses of CYW43_PRINTF in the sdk.

so i think these are wrong too - i just hadn't noticed before ;-)

@peterharperuk
Copy link
Contributor Author

ok, you're right cybt_printf was off in release.

@peterharperuk
Copy link
Contributor Author

Second attempt...

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.

2 participants