qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Bruno Prado <bruno@dcomp.ufs.br>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: ARM semihosting issue
Date: Thu, 1 Oct 2020 18:20:29 -0300	[thread overview]
Message-ID: <CAD5UmjrjORJbP0sj-DnGQFaQ443-vYMBa-1qCBzJsnUG+gU=jw@mail.gmail.com> (raw)
In-Reply-To: <CAFEAcA_AjzNKzrHBU7QQzB=dxia9mYuw5oAsya3h42JEQAemaA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1420 bytes --]

Thanks for the reply... I am attaching some code and output:

#include <stdio.h>
int main() {
       char name[50] = "Nobody";
       FILE* file = fopen("name", "r");
       printf("What is your name?\n");
       fprintf(stdout, "Reading from file...\n");
       fscanf(file, "%s", name);
       fscanf(stdin, "%s", name);
       printf("My name is %s\n", name);
       fprintf(stderr, "I am alive!!!\n");
       fclose(file);
       return 0;
}

$ cat name
Turing
$ qemu-system-arm -M netduino2 -nographic -semihosting -kernel vp2.bin
What is your name?
Reading from file...
My name is Turing
I am alive!!!
$

Basically the scanf call has no effect. I was expecting a pause in
execution to input a string, but nothing happens.

Regards,
----
Bruno Prado


On Thu, Oct 1, 2020 at 5:38 PM Peter Maydell <peter.maydell@linaro.org>
wrote:

> On Thu, 1 Oct 2020 at 21:33, Bruno Prado <bruno@dcomp.ufs.br> wrote:
> > I was able to use stdout, stderr for output and files for
> > both input and output in qemu-system-arm, but stdin is not
> > working (always returns -1 from syscall). I found no
> > information and have already checked the code for possible hints.
>
> Rather hard to say what might be going on with this little
> information... what semihosting calls are you making, what
> do you expect them to do and what do they actually do?
> Do you have a minimal test case we can reproduce with?
>
> thanks
> -- PMM
>

[-- Attachment #2: Type: text/html, Size: 2940 bytes --]

  reply	other threads:[~2020-10-01 21:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-01 18:19 ARM semihosting issue Bruno Prado
2020-10-01 20:38 ` Peter Maydell
2020-10-01 21:20   ` Bruno Prado [this message]
2020-10-02 10:25     ` Peter Maydell
2020-10-02 11:09       ` Bruno Prado
2020-10-21 14:16         ` Bruno Prado
2020-10-21 15:45           ` Alex Bennée
2020-10-21 17:51             ` Bruno Prado

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAD5UmjrjORJbP0sj-DnGQFaQ443-vYMBa-1qCBzJsnUG+gU=jw@mail.gmail.com' \
    --to=bruno@dcomp.ufs.br \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).