Skip to contentSkip to conversation

Serial console via USB (USBTTY) ...

DISCUSSION Herbert Poetzl 2 participants 5 messages Apr 1, 2021

lore
Share & tools
lore
#0 lore raw

I'm trying to get a serial console via USB working on STM32MP1 but I'm encountering some problems there ...

The u-boot README suggests to add the following config entries to the board specific .h file:

CONFIG_USB_DEVICE
CONFIG_USB_TTY
CONFIG_USBD_HS (for high speed support)
CONFIG_SYS_CONSOLE_IS_IN_ENV

... but when doing so, I get a number of linker errors which suggest that there is something missing:
https://pastebin.com/raw/bbpCu8jy

Marek (via IRC) suggested that this is because the USB_TTY seems to be based on the old gadget framework and needs to be updated to the new one.

It was also suggested that a port of the Linux serial function driver would be a good alternative to get CDC/ACM functionality into u-boot and that Andy might already be working on this ...

So my questions are:

- What is currently the best/easiest approach to get a serial console via USB working?

- Is the port from Linux in a stage that it can be tested and/or finalized within a easonable amount of time?

- Can I help getting this working?

Thanks in advance,
Herbert

#1 lore raw
Quoted 13 lines · Herbert Poetzl

I'm trying to get a serial console via USB working on STM32MP1 but I'm encountering some problems there ...

The u-boot README suggests to add the following config entries to the board specific .h file:

CONFIG_USB_DEVICE
CONFIG_USB_TTY
CONFIG_USBD_HS (for high speed support)
CONFIG_SYS_CONSOLE_IS_IN_ENV

Quoted 7 lines

... but when doing so, I get a number of linker errors which suggest that there is something missing:
https://pastebin.com/raw/bbpCu8jy

Marek (via IRC) suggested that this is because the USB_TTY seems to be based on the old gadget framework and needs to be updated to the new one.

Precisely!

Quoted 4 lines

It was also suggested that a port of the Linux serial function driver would be a good alternative to get CDC/ACM functionality into u-boot and that Andy might already be working on this ...

I abandoned that, but I can send what I have (it still doesn't properly work to me).

Quoted 4 lines

So my questions are:

- What is currently the best/easiest approach to get a serial console via USB working?

Create a support for it. You may consider it as there is no support.

Quoted 3 lines

- Is the port from Linux in a stage that it can be tested and/or finalized within a easonable amount of time?

Not from me (I started but encountered so many issues here and there, besides the fact that it's really time consuming).

Quoted 1 line

- Can I help getting this working?

If you do it yourself. I can help with testing on my platform.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#2 lore raw

Hello Andy!

Thanks for the quick feedback!

Quoted 18 lines · Andy Shevchenko
Quoted 14 lines · Herbert Poetzl

I'm trying to get a serial console via USB working on STM32MP1 but I'm encountering some problems there ...

The u-boot README suggests to add the following config entries to the board specific .h file:

CONFIG_USB_DEVICE
CONFIG_USB_TTY
CONFIG_USBD_HS (for high speed support)
CONFIG_SYS_CONSOLE_IS_IN_ENV

... but when doing so, I get a number of linker errors which suggest that there is something missing:
https://pastebin.com/raw/bbpCu8jy

Quoted 5 lines
Quoted 3 lines

Marek (via IRC) suggested that this is because the USB_TTY seems to be based on the old gadget framework and needs to be updated to the new one.

Precisely!

Are there any examples of such a conversion or is there some guide how to convert drivers from the 'old' framework to the 'new' one?

Quoted 7 lines
Quoted 4 lines

It was also suggested that a port of the Linux serial function driver would be a good alternative to get CDC/ACM functionality into u-boot and that Andy might already be working on this ...

I abandoned that, but I can send what I have (it still doesn't properly work to me).

Would definitely be interesting to see, as it seems that other function drivers (those are the f_* ones, as far as I understood) seem to work just fine.

Quoted 7 lines
Quoted 4 lines

So my questions are:

- What is currently the best/easiest approach to get a serial console via USB working?

Create a support for it.
You may consider it as there is no support.

Okay, how do I best start with that?

Quoted 6 lines
Quoted 3 lines

- Is the port from Linux in a stage that it can be tested and/or finalized within a easonable amount of time?

Not from me (I started but encountered so many issues here and there, besides the fact that it's really time consuming).

I understand ...

Quoted 3 lines
Quoted 1 line

- Can I help getting this working?

If you do it yourself. I can help with testing on my platform.

Great! Thanks in advance!

Best,
Herbert

Quoted 3 lines
Signature · 2 lines
With Best Regards,
Andy Shevchenko
#3 lore raw
Quoted 40 lines · Herbert Poetzl

Hello Andy!

Thanks for the quick feedback!

Quoted 18 lines · Andy Shevchenko
Quoted 14 lines · Herbert Poetzl

I'm trying to get a serial console via USB working on STM32MP1 but I'm encountering some problems there ...

The u-boot README suggests to add the following config entries to the board specific .h file:

CONFIG_USB_DEVICE
CONFIG_USB_TTY
CONFIG_USBD_HS (for high speed support)
CONFIG_SYS_CONSOLE_IS_IN_ENV

... but when doing so, I get a number of linker errors which suggest that there is something missing:
https://pastebin.com/raw/bbpCu8jy

Quoted 5 lines
Quoted 3 lines

Marek (via IRC) suggested that this is because the USB_TTY seems to be based on the old gadget framework and needs to be updated to the new one.

Precisely!

Are there any examples of such a conversion or is there some guide how to convert drivers from the 'old' framework to the 'new' one?

Quoted 4 lines
Quoted 4 lines

It was also suggested that a port of the Linux serial function driver would be a good alternative to get CDC/ACM functionality into u-boot and that Andy might already be working on this ...

Quoted 6 lines
Quoted 2 lines

I abandoned that, but I can send what I have (it still doesn't properly work to me).

Would definitely be interesting to see, as it seems that other function drivers (those are the f_* ones, as far as I understood) seem to work just fine.

Here you are: https://github.com/andy-shev/u-boot/tree/topic/f-serial

No guarantees or anything. It's a pile of something.
Tell me when you get it, so I will remove the branch (let's say I'll do it within 24 hours anyway).

Quoted 9 lines
Quoted 7 lines
Quoted 4 lines

So my questions are:

- What is currently the best/easiest approach to get a serial console via USB working?

Create a support for it.
You may consider it as there is no support.

Okay, how do I best start with that?

Try to read the code of existing functions in U-Boot and Linux kernel?

Quoted 24 lines
Quoted 6 lines
Quoted 3 lines

- Is the port from Linux in a stage that it can be tested and/or finalized within a easonable amount of time?

Not from me (I started but encountered so many issues here and there, besides the fact that it's really time consuming).

I understand ...

Quoted 3 lines
Quoted 1 line

- Can I help getting this working?

If you do it yourself. I can help with testing on my platform.

Great! Thanks in advance!

Best,
Herbert

Quoted 3 lines

--
With Best Regards,
Andy Shevchenko

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#4 lore raw
Quoted 46 lines · Andy Shevchenko
Quoted 37 lines · Herbert Poetzl

Hello Andy!

Thanks for the quick feedback!

Quoted 17 lines · Andy Shevchenko
Quoted 14 lines · Herbert Poetzl

I'm trying to get a serial console via USB working on STM32MP1 but I'm encountering some problems there ...

The u-boot README suggests to add the following config entries to the board specific .h file:

CONFIG_USB_DEVICE
CONFIG_USB_TTY
CONFIG_USBD_HS (for high speed support)
CONFIG_SYS_CONSOLE_IS_IN_ENV

... but when doing so, I get a number of linker errors which suggest that there is something missing:
https://pastebin.com/raw/bbpCu8jy

Quoted 5 lines
Quoted 3 lines

Marek (via IRC) suggested that this is because the USB_TTY seems to be based on the old gadget framework and needs to be updated to the new one.

Precisely!

Are there any examples of such a conversion or is there some guide how to convert drivers from the 'old' framework to the 'new' one?

Quoted 4 lines
Quoted 4 lines

It was also suggested that a port of the Linux serial function driver would be a good alternative to get CDC/ACM functionality into u-boot and that Andy might already be working on this ...

Quoted 6 lines
Quoted 2 lines

I abandoned that, but I can send what I have (it still doesn't properly work to me).

Would definitely be interesting to see, as it seems that other function drivers (those are the f_* ones, as far as I understood) seem to work just fine.

Quoted 5 lines

Here you are: https://github.com/andy-shev/u-boot/tree/topic/f-serial

No guarantees or anything. It's a pile of something. Tell me when you get it, so I will remove the branch (let's say I'll do it within 24 hours anyway).

Got it, thanks!

Quoted 5 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

So my questions are:

- What is currently the best/easiest approach to get a serial console via USB working?

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Create a support for it.
You may consider it as there is no support.

Okay, how do I best start with that?

Try to read the code of existing functions in U-Boot and Linux kernel?

Yeah, is there a specific function driver which was ported from Linux to U-Boot already or would the serial driver be the first one?

Quoted 7 lines
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines

- Is the port from Linux in a stage that it can be tested and/or finalized within a easonable amount of time?

Not from me (I started but encountered so many issues here and there, besides the fact that it's really time consuming).

Quoted 7 lines
Quoted 7 lines

I understand ...

Quoted 3 lines
Quoted 1 line

- Can I help getting this working?

If you do it yourself. I can help with testing on my platform.

Great! Thanks in advance!

Thanks a bunch,
Herbert

Quoted 12 lines
Quoted 6 lines

Best,
Herbert

Quoted 3 lines

--
With Best Regards,
Andy Shevchenko

Signature · 2 lines
With Best Regards,
Andy Shevchenko