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

logging: uart: get device from dedicated zephyr,log-uart node #65001

Closed
wants to merge 2 commits into from

Conversation

ycsin
Copy link
Collaborator

@ycsin ycsin commented Nov 9, 2023

Changes the UART log backend to use a new dedicated zephyr,log-uart node instead of the chosen zephyr,console node, just like the zephyr,shell-uart.

This helps with the development of cleaner multi-instance UART log backend implementation, see #64917.

Devicetree modified using the following command, with a few exceptions:

grep -rl 'zephyr,console = ' ./ | xargs sed -i 's/\(.*\)zephyr,console = \&\(.*\)\;/\1zephyr,console = \&\2\;\n\1zephyr,log-uart = \&\2\;/'

The compilation of the log_backend_uart now depends on having an enabled serial driver & chosen zephyr,log-uart node in the devicetree instead of UART_CONSOLE

  • migration notes for out-of-tree boards

Add a new `zephyr,log-uart` chosen entry to be used by
UART log backend later.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Change the chosen UART device from `console` to the dedicated
`log-uart` node, and removed the dependency on `UART_CONSOLE`.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Copy link
Member

@henrikbrixandersen henrikbrixandersen left a comment

Choose a reason for hiding this comment

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

This change will break pretty much all board configurations.

Please state the nature of the problem this is solving.

@henrikbrixandersen henrikbrixandersen added the Release Notes Required Release notes required for this change label Nov 9, 2023
@ycsin
Copy link
Collaborator Author

ycsin commented Nov 9, 2023

Please state the nature of the problem this is solving.

Updated OP, this is required to have cleaner implementation in #64917

@cfriedt
Copy link
Member

cfriedt commented Nov 9, 2023

Changes the UART log backend to use a new dedicated zephyr,log-uart node instead of the chosen zephyr,console node, just like the zephyr,shell-uart.

I don't think it should be necessary for all boards to switch.

Many boards are fine simply using the existing zephyr,console, a singleton.

For those who want multiple instances, the previous approach that I used was probably the least invasive; adding a child node with the Zephyr,log-uart compatible; the backing UART device is implicitly the parent of that node.

It could also be added to any existing configuration without requiring a lot of change.

@dcpleung
Copy link
Member

dcpleung commented Nov 9, 2023

Maybe use zephyr,log-uart if it's defined, else use zephyr,console? Shell requires interactivity so it may want to use another UART dedicated to it. However, logging simply requires output, which can be on console.

@cfriedt
Copy link
Member

cfriedt commented Nov 9, 2023

Maybe use zephyr,log-uart if it's defined, else use zephyr,console? Shell requires interactivity so it may want to use another UART dedicated to it. However, logging simply requires output, which can be on console.

Exactly.

The associated pr has changed a bit since I wrote it originally. I don't think we need a tree-wide change, but probably what is above (which I believe was @ycsin's original submission) would be fine.

@ycsin ycsin closed this Nov 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Logging Release Notes Required Release notes required for this change treewide 🧹
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

4 participants