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

feat(kernel): add proper console abstraction #25

Merged
merged 8 commits into from
Jan 15, 2025
Merged

feat(kernel): add proper console abstraction #25

merged 8 commits into from
Jan 15, 2025

Conversation

d4ilyrun
Copy link
Owner

@d4ilyrun d4ilyrun commented Jan 13, 2025

  • Dissociate the console and the underlying device
  • Make it possible to switch the console's output device
  • Less verbose logger prefix system
  • Log level filtering

@d4ilyrun d4ilyrun linked an issue Jan 13, 2025 that may be closed by this pull request
To make the distinction between the two, this commit also renames the
previosuly called printf to printk. The underlying implementation stays
unchanged for now.
Until now the printk implementation was forced to write to the UART
output. We now write to the currently active console, thus allowing us
to dynamically change the output location of our logs.
Instead of passing in the domain name for each call to the log API
we now define a single LOG_DOMAIN macro at the top of a translation
unit. This macro is automatically inserted into each log API calls,
if present.

We also took this opportunity to stop always expanding the level macros
into their respective ANSI code + prefix, and instead use an enum which
is in term translated into the same representation. This reduces the
size of the final binary.
This attribute allows the compiler to know that these functions use
the same format string as the printf function. This lets it raise
warnings and errors on mis-matched argument types.
LOG_FMT_16 -> FMT16 (for uint16_t)
LOG_FMT_IP -> FMT_IP (for ip addresses)
@d4ilyrun d4ilyrun marked this pull request as ready for review January 15, 2025 22:50
@d4ilyrun d4ilyrun merged commit 33a7bf8 into master Jan 15, 2025
2 checks passed
@d4ilyrun d4ilyrun deleted the 10-console branch January 15, 2025 23:02
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.

console: Create a console abstraction
1 participant