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

New improved printk implementation #101

Merged
merged 1 commit into from
Oct 20, 2023

Conversation

josecm
Copy link
Member

@josecm josecm commented Oct 13, 2023

The quality of the previous printk implementation was less than desirable. This PR introduces a new improved, and more robust printk implementation that allows to print strings larger than the allocated print buffers and also adds the "format printf" attribute so that incorrect type identifiers in the format string are detected at compile-time.

@josecm josecm force-pushed the feat/new_printk_implementation branch 2 times, most recently from 93edbbb to 924c4d8 Compare October 13, 2023 19:39
DavidMCerdeira
DavidMCerdeira previously approved these changes Oct 14, 2023
@DavidMCerdeira DavidMCerdeira self-assigned this Oct 14, 2023
@DavidMCerdeira
Copy link
Member

@josecm at least one CI check is failing

@danielRep danielRep self-requested a review October 16, 2023 10:16
danielRep
danielRep previously approved these changes Oct 16, 2023
A from-sratch improved implementation of printk that allows printing
strings larger than the allocated print buffer. It also makes this
buffer statically allocated instead of allocating it on the printing cpu
stack.

Finally, it removes the per-uart implementation uart_puts function as this is
essnetially replicated behavior, only the uart_putc is needed. This
logic is now part of the console itself.

The format printf attribute is also added so that errors in the format
string type identifiers are detected at compile time.

Signed-off-by: Jose Martins <josemartins90@gmail.com>
@josecm josecm dismissed stale reviews from danielRep and DavidMCerdeira via 1201159 October 18, 2023 10:18
@josecm josecm force-pushed the feat/new_printk_implementation branch from 924c4d8 to 1201159 Compare October 18, 2023 10:18
@josecm
Copy link
Member Author

josecm commented Oct 18, 2023

@DavidMCerdeira

@josecm at least one CI check is failing

The error was due to an "undefined reference to __aeabi_uldivmod" error in 32-bit arm architectures since we don't link the GCC lib. I don't fully understand why this intrinsic was being invoked for one of the divisions but not for the others. Anyway, I believe I fixed this by removing the use of long long since the print functions don't support these types in the first place.

Copy link
Member

@danielRep danielRep left a comment

Choose a reason for hiding this comment

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

I have tested console_printk locally with some unit tests and it seems to been working properly.

@josecm
Copy link
Member Author

josecm commented Oct 18, 2023

I have tested console_printk locally with some unit tests and it seems to been working properly.

Thanks!

@DavidMCerdeira DavidMCerdeira merged commit 6805eee into main Oct 20, 2023
12 checks passed
@DavidMCerdeira DavidMCerdeira deleted the feat/new_printk_implementation branch October 20, 2023 09:22
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