All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] Baremetal Netduino2 -- cannot output on UARTs 2-4
@ 2016-10-03 20:25 Seth K
  2016-10-04 16:59 ` Alistair Francis
  0 siblings, 1 reply; 4+ messages in thread
From: Seth K @ 2016-10-03 20:25 UTC (permalink / raw)
  To: qemu-devel

I have made a bare metal "Hello World" program for the Netduino2. I have
pushed it here:

https://github.com/skintigh/baremetal_netduino2

It should output "Test 1/4" to USART 1, "Test 2/4" to USART 2, "Test 3/4"
to USART 3 and "Test 4/4" to UART 4.

What actually happens in QEMU is only the first string is output. That may
be a command line argument error on my part, so for a sanity check I put
printf statements in the function stm32f2xx_usart_write in
qemu/hw/char/stm32f2xx_usart.c and recompiled qemu. The result is text sent
to UART1 and UART4 make is to the function (though only 1 is output), while
writes to 2 and 3 simply disappear and never make it to that function. I
assumed all writes to UARTs would go to that function.

Am I doing something dumb? Is this a bug? Any help would be greatly
appreciated.

Thanks,
Seth

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] Baremetal Netduino2 -- cannot output on UARTs 2-4
  2016-10-03 20:25 [Qemu-devel] Baremetal Netduino2 -- cannot output on UARTs 2-4 Seth K
@ 2016-10-04 16:59 ` Alistair Francis
       [not found]   ` <CAErn8fS_FhRBfXyb5iqYXbVYUAW+_TuuY9n8Zt219BcipfGuOw@mail.gmail.com>
  0 siblings, 1 reply; 4+ messages in thread
From: Alistair Francis @ 2016-10-04 16:59 UTC (permalink / raw)
  To: Seth K; +Cc: qemu-devel@nongnu.org Developers

On Mon, Oct 3, 2016 at 1:25 PM, Seth K <skintigh@gmail.com> wrote:
> I have made a bare metal "Hello World" program for the Netduino2. I have
> pushed it here:
>
> https://github.com/skintigh/baremetal_netduino2
>
> It should output "Test 1/4" to USART 1, "Test 2/4" to USART 2, "Test 3/4"
> to USART 3 and "Test 4/4" to UART 4.
>
> What actually happens in QEMU is only the first string is output. That may
> be a command line argument error on my part, so for a sanity check I put
> printf statements in the function stm32f2xx_usart_write in
> qemu/hw/char/stm32f2xx_usart.c and recompiled qemu. The result is text sent
> to UART1 and UART4 make is to the function (though only 1 is output), while
> writes to 2 and 3 simply disappear and never make it to that function. I
> assumed all writes to UARTs would go to that function.
>
> Am I doing something dumb? Is this a bug? Any help would be greatly
> appreciated.

Hello Seth,

I haven't looked at the multiple UART problem in a while. It sounds
like your command line arguments are incorrect.

Have a look at this wiki page for details on what the serial options
should look like:
https://github.com/alistair23/qemu/wiki/Getting-Started

If that doesn't work can you copypaste your command line arguments?

Thanks,

Alistair

>
> Thanks,
> Seth

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] Baremetal Netduino2 -- cannot output on UARTs 2-4
       [not found]     ` <CAKmqyKOmT1GQWZHAYtZFYLsosaywtkd8iZ2Oc52=-P_S28opjg@mail.gmail.com>
@ 2016-10-06 21:52       ` Seth K
  2016-10-06 23:54         ` Alistair Francis
  0 siblings, 1 reply; 4+ messages in thread
From: Seth K @ 2016-10-06 21:52 UTC (permalink / raw)
  To: Alistair Francis, qemu-devel

You're right, qemu was not happy with that command line, but your pointer
really helped me out, thank you!! I think a combination of my
misunderstanding what the arguments meant, and a weird bug with this chip,
resulted in my complete confusion.

Using the command line:
../qemu/arm-softmmu/qemu-system-arm -M netduino2 -nographic -kernel
output.bin -serial unix:///tmp/uart1,server -serial
unix:///tmp/uart2,server -serial unix:///tmp/uart3,server -serial
unix:///tmp/uart4,server

and opening 4 sockets:
socat - UNIX-CONNECT:/tmp/uart1 ...

sends data written to UART1 to /tmp/uart1 and UART4 to /tmp/uart4. 2 and 3
still disappear but that seems to be a bug and I have reported it. Now to
test this on a chip with 8 UARTS...

Thanks again!

On Wed, Oct 5, 2016 at 5:21 PM, Alistair Francis <alistair23@gmail.com>
wrote:

> On Wed, Oct 5, 2016 at 10:45 AM, Seth K <skintigh@gmail.com> wrote:
> > Thanks for that link.
> >
> > I tried that command line and it output UART4 but UART 1 disappeared and
> > UART2-3 are still missing. That page doesn't seem to have an explanation
> of
> > what that command line is doing nor why /dev/null is used twice, so I'm a
> > little lost. Removing the first /dev/null made UART4 disappear but UART1
> > came back. In the past I've looked for documentation that explained the
> > command line but everything I found was very vague.
>
> Hey Seth,
>
> Each -serial option is used to specify where to send the serial
> output. These are parsed in order when passed into QEMU. So the first
> -serial option controls where to send UART0 data and so on.
>
> That example I sent you is for a Netduino 2 so you will need to
> changed the -serial options to match what you want to print, but it is
> a good example you can use. Especially for muxing multiple serial
> devices.
>
> It sounds like you want something like:
> -chardev stdio,mux=on,id=terminal -serial chardev:terminal -serial
> chardev:terminal -serial chardev:terminal -serial chardev:terminal
> -monitor chardev:terminal
>
> Which will output everything to the terminal. I can image that will
> cause some problems though, so you might want to output some to
> telnet/sockets instead to stop everything being mixed together.
>
> Remember that -chardev creates the output device but doesn't connect
> it to a UART. You need the -serial option to do that.
>
> Thanks,
>
> Alistair
>
> >
> > build.sh has a bunch of command lines I've found online and tried:
> >
> > $QEMU/arm-softmmu/qemu-system-arm -M netduino2 -nographic -kernel
> output.bin
> >
> >
> > #this one sends UART1 to a socket but not UART2
> > #../qemu/arm-softmmu/qemu-system-arm -M netduino2 -m 128M -nographic
> -kernel
> > output.bin -serial unix:///tmp/uart,server -serial
> unix:///tmp/uart2,server
> > #socat - UNIX-CONNECT:/tmp/uart
> >
> > #../../qemu/arm-softmmu/qemu-system-arm -M netduino2 -m 128M -nographic
> > -kernel output.bin -serial unix:///tmp/uart1,server,id=uart2 -serial
> > unix:///tmp/uart2,server,id=uart1
> > #didn't redirect
> >
> > #other desperation
> > #../qemu/arm-softmmu/qemu-system-arm -M netduino2 -m 128M -nographic -s
> -d
> > cpu,in_asm -kernel output.bin
> > #../qemu/arm-softmmu/qemu-system-arm -M netduino2 -m 128M -nographic
> -serial
> > unix:///tmp/uart,server -kernel output.bin
> > #../qemu/arm-softmmu/qemu-system-arm -M netduino2 -m 128M -nographic
> > -chardev socket,id=usar0,host=localhost,port=31337,server -kernel
> output.bin
> > #../qemu/arm-softmmu/qemu-system-arm -M netduino2 -m 128M -nographic
> > -chardev socket,id=chardev,host=localhost,port=31337,server -kernel
> > output.bin
> > #../../qemu/arm-softmmu/qemu-system-arm -M netduino2 -m 128M -nographic
> > -kernel output.bin -s -S
> >
> > On Tue, Oct 4, 2016 at 12:59 PM, Alistair Francis <alistair23@gmail.com>
> > wrote:
> >>
> >> On Mon, Oct 3, 2016 at 1:25 PM, Seth K <skintigh@gmail.com> wrote:
> >> > I have made a bare metal "Hello World" program for the Netduino2. I
> have
> >> > pushed it here:
> >> >
> >> > https://github.com/skintigh/baremetal_netduino2
> >> >
> >> > It should output "Test 1/4" to USART 1, "Test 2/4" to USART 2, "Test
> >> > 3/4"
> >> > to USART 3 and "Test 4/4" to UART 4.
> >> >
> >> > What actually happens in QEMU is only the first string is output. That
> >> > may
> >> > be a command line argument error on my part, so for a sanity check I
> put
> >> > printf statements in the function stm32f2xx_usart_write in
> >> > qemu/hw/char/stm32f2xx_usart.c and recompiled qemu. The result is text
> >> > sent
> >> > to UART1 and UART4 make is to the function (though only 1 is output),
> >> > while
> >> > writes to 2 and 3 simply disappear and never make it to that
> function. I
> >> > assumed all writes to UARTs would go to that function.
> >> >
> >> > Am I doing something dumb? Is this a bug? Any help would be greatly
> >> > appreciated.
> >>
> >> Hello Seth,
> >>
> >> I haven't looked at the multiple UART problem in a while. It sounds
> >> like your command line arguments are incorrect.
> >>
> >> Have a look at this wiki page for details on what the serial options
> >> should look like:
> >> https://github.com/alistair23/qemu/wiki/Getting-Started
> >>
> >> If that doesn't work can you copypaste your command line arguments?
> >>
> >> Thanks,
> >>
> >> Alistair
> >>
> >> >
> >> > Thanks,
> >> > Seth
> >
> >
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] Baremetal Netduino2 -- cannot output on UARTs 2-4
  2016-10-06 21:52       ` Seth K
@ 2016-10-06 23:54         ` Alistair Francis
  0 siblings, 0 replies; 4+ messages in thread
From: Alistair Francis @ 2016-10-06 23:54 UTC (permalink / raw)
  To: Seth K; +Cc: qemu-devel@nongnu.org Developers

On Thu, Oct 6, 2016 at 2:52 PM, Seth K <skintigh@gmail.com> wrote:
> You're right, qemu was not happy with that command line, but your pointer
> really helped me out, thank you!! I think a combination of my
> misunderstanding what the arguments meant, and a weird bug with this chip,
> resulted in my complete confusion.
>
> Using the command line:
> ../qemu/arm-softmmu/qemu-system-arm -M netduino2 -nographic -kernel
> output.bin -serial unix:///tmp/uart1,server -serial unix:///tmp/uart2,server
> -serial unix:///tmp/uart3,server -serial unix:///tmp/uart4,server
>
> and opening 4 sockets:
> socat - UNIX-CONNECT:/tmp/uart1 ...
>
> sends data written to UART1 to /tmp/uart1 and UART4 to /tmp/uart4. 2 and 3
> still disappear but that seems to be a bug and I have reported it. Now to
> test this on a chip with 8 UARTS...

What is the bug? Can you CC me on it?

Thanks,

Alistair

>
> Thanks again!
>
> On Wed, Oct 5, 2016 at 5:21 PM, Alistair Francis <alistair23@gmail.com>
> wrote:
>>
>> On Wed, Oct 5, 2016 at 10:45 AM, Seth K <skintigh@gmail.com> wrote:
>> > Thanks for that link.
>> >
>> > I tried that command line and it output UART4 but UART 1 disappeared and
>> > UART2-3 are still missing. That page doesn't seem to have an explanation
>> > of
>> > what that command line is doing nor why /dev/null is used twice, so I'm
>> > a
>> > little lost. Removing the first /dev/null made UART4 disappear but UART1
>> > came back. In the past I've looked for documentation that explained the
>> > command line but everything I found was very vague.
>>
>> Hey Seth,
>>
>> Each -serial option is used to specify where to send the serial
>> output. These are parsed in order when passed into QEMU. So the first
>> -serial option controls where to send UART0 data and so on.
>>
>> That example I sent you is for a Netduino 2 so you will need to
>> changed the -serial options to match what you want to print, but it is
>> a good example you can use. Especially for muxing multiple serial
>> devices.
>>
>> It sounds like you want something like:
>> -chardev stdio,mux=on,id=terminal -serial chardev:terminal -serial
>> chardev:terminal -serial chardev:terminal -serial chardev:terminal
>> -monitor chardev:terminal
>>
>> Which will output everything to the terminal. I can image that will
>> cause some problems though, so you might want to output some to
>> telnet/sockets instead to stop everything being mixed together.
>>
>> Remember that -chardev creates the output device but doesn't connect
>> it to a UART. You need the -serial option to do that.
>>
>> Thanks,
>>
>> Alistair
>>
>> >
>> > build.sh has a bunch of command lines I've found online and tried:
>> >
>> > $QEMU/arm-softmmu/qemu-system-arm -M netduino2 -nographic -kernel
>> > output.bin
>> >
>> >
>> > #this one sends UART1 to a socket but not UART2
>> > #../qemu/arm-softmmu/qemu-system-arm -M netduino2 -m 128M -nographic
>> > -kernel
>> > output.bin -serial unix:///tmp/uart,server -serial
>> > unix:///tmp/uart2,server
>> > #socat - UNIX-CONNECT:/tmp/uart
>> >
>> > #../../qemu/arm-softmmu/qemu-system-arm -M netduino2 -m 128M -nographic
>> > -kernel output.bin -serial unix:///tmp/uart1,server,id=uart2 -serial
>> > unix:///tmp/uart2,server,id=uart1
>> > #didn't redirect
>> >
>> > #other desperation
>> > #../qemu/arm-softmmu/qemu-system-arm -M netduino2 -m 128M -nographic -s
>> > -d
>> > cpu,in_asm -kernel output.bin
>> > #../qemu/arm-softmmu/qemu-system-arm -M netduino2 -m 128M -nographic
>> > -serial
>> > unix:///tmp/uart,server -kernel output.bin
>> > #../qemu/arm-softmmu/qemu-system-arm -M netduino2 -m 128M -nographic
>> > -chardev socket,id=usar0,host=localhost,port=31337,server -kernel
>> > output.bin
>> > #../qemu/arm-softmmu/qemu-system-arm -M netduino2 -m 128M -nographic
>> > -chardev socket,id=chardev,host=localhost,port=31337,server -kernel
>> > output.bin
>> > #../../qemu/arm-softmmu/qemu-system-arm -M netduino2 -m 128M -nographic
>> > -kernel output.bin -s -S
>> >
>> > On Tue, Oct 4, 2016 at 12:59 PM, Alistair Francis <alistair23@gmail.com>
>> > wrote:
>> >>
>> >> On Mon, Oct 3, 2016 at 1:25 PM, Seth K <skintigh@gmail.com> wrote:
>> >> > I have made a bare metal "Hello World" program for the Netduino2. I
>> >> > have
>> >> > pushed it here:
>> >> >
>> >> > https://github.com/skintigh/baremetal_netduino2
>> >> >
>> >> > It should output "Test 1/4" to USART 1, "Test 2/4" to USART 2, "Test
>> >> > 3/4"
>> >> > to USART 3 and "Test 4/4" to UART 4.
>> >> >
>> >> > What actually happens in QEMU is only the first string is output.
>> >> > That
>> >> > may
>> >> > be a command line argument error on my part, so for a sanity check I
>> >> > put
>> >> > printf statements in the function stm32f2xx_usart_write in
>> >> > qemu/hw/char/stm32f2xx_usart.c and recompiled qemu. The result is
>> >> > text
>> >> > sent
>> >> > to UART1 and UART4 make is to the function (though only 1 is output),
>> >> > while
>> >> > writes to 2 and 3 simply disappear and never make it to that
>> >> > function. I
>> >> > assumed all writes to UARTs would go to that function.
>> >> >
>> >> > Am I doing something dumb? Is this a bug? Any help would be greatly
>> >> > appreciated.
>> >>
>> >> Hello Seth,
>> >>
>> >> I haven't looked at the multiple UART problem in a while. It sounds
>> >> like your command line arguments are incorrect.
>> >>
>> >> Have a look at this wiki page for details on what the serial options
>> >> should look like:
>> >> https://github.com/alistair23/qemu/wiki/Getting-Started
>> >>
>> >> If that doesn't work can you copypaste your command line arguments?
>> >>
>> >> Thanks,
>> >>
>> >> Alistair
>> >>
>> >> >
>> >> > Thanks,
>> >> > Seth
>> >
>> >
>
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-10-06 23:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-03 20:25 [Qemu-devel] Baremetal Netduino2 -- cannot output on UARTs 2-4 Seth K
2016-10-04 16:59 ` Alistair Francis
     [not found]   ` <CAErn8fS_FhRBfXyb5iqYXbVYUAW+_TuuY9n8Zt219BcipfGuOw@mail.gmail.com>
     [not found]     ` <CAKmqyKOmT1GQWZHAYtZFYLsosaywtkd8iZ2Oc52=-P_S28opjg@mail.gmail.com>
2016-10-06 21:52       ` Seth K
2016-10-06 23:54         ` Alistair Francis

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.