On Win10, I write a Java program to start qemu-system-gnuarmeclipse.exe, show below:
String cmd = "C:/Users/DELL/AppData/Roaming/xPacks/@xpack-dev-tools/qemu-arm/7.0.0-1.1/.content/bin/qemu-system-gnuarmeclipse.exe --verbose --board STM32F429I-Discovery --mcu STM32F429ZI -d unimp,guest_errors --semihosting-config enable=on,target=native -nographic --image C:/Users/DELL/Documents/Debug/TestUsartb.elf";
Process process = Runtime.getRuntime().exec(cmd, null, null);
the TestUsartb.elf just receive the command through standard input and print it out again. I get output stream from the process and send command.
BufferedOutputStream out = (BufferedOutputStream)process.getOutputStream();
out.write("commandA".getBytes());
out.flush();
But when I see the output from the elf, I find it doesn't return the complete command. I send with commandA, it may return ommandA, it ignore the first character.
Or sometimes, it will return: (qemu) unknown command: 'commandA'
In the elf program, I use gets() to receive the command.
I just want to send with commandA, and my elf program receive it and pirnt commandA again.
Thanks.