Hi all,

I'd like to use the uC simulation uCsim for test automation, and my use-case requires the uCsim serial port simulation to exchange information through a script.

Entering commands through `netcat` works fine for the emulator console, it fails for the simulated serial interface (which works fine as an interactive telnet "serial console").

Here is an example script that demonstrates my use-case:

```

#!/bin/bash
# requires SSTM8 >= https://svn.code.sf.net/p/sdcc/code/trunk/?p=9924

./sstm8 -w -g -C/tmp/sstm8-start.txt -Z10001 -tS103 -Suart=1,port=10000 out/MINDEV/MINDEV.ihx &
sleep 1

nc localhost 10000 <<EOF >out-console.txt
1 .

EOF

nc localhost 10001 <<EOF >out-memory.txt
dch 0x8000 0x9FFF 16

EOF

nc localhost 10001 <<EOF
kill

EOF

```

There is no noticeable difference of behaviour between interactive "simulation console" and "serial console" sessions, and some control character "garbage" appears on the output of a scripted "simulation console".

```

<FF><FB>^A<FF><FB>^C^@uCsim 0.6-pre30, Copyright (C) 1997 Daniel Drotos.
uCsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
3> dch 0x8000 0x9FFF 16

0x08000 82 00 80 83 82 00 80 a3 82 00 00 00 82 00 00 00 ................
0x08010 82 00 00 00 82 00 81 6f 82 00 81 6f 82 00 81 6f .......o...o...o
0x08020 82 00 81 6f 82 00 00 00 82 00 00 00 82 00 00 00 ...o............
0x08030 82 00 00 00 82 00 00 00 82 00 00 00 82 00 80 b6 ................
0x08040 82 00 00 00 82 00 00 00 82 00 00 00 82 00 00 00 ................

```

I can work around control characters, and the input echo in the output. However, even in a non-interactive "serial console" session, I can only enter text lines by inserting `CTRL-lowercase_L` after `new-line` (and that means working around a feature that's not needed in a complicated way).

It appears to me that the interactive `telnet` behaviour is by design (e.g. `sim.src/serial_hw.cc` has a line `i->set_telnet(true);`). There is also an (undocumented?) "simulation console" accessible through the "serial console" which makes no sense in non-interactive mode (`CTRL-x` in a "serial console" session).

For test automation the following features would be beneficial (in the order from "required" to "nice to have"):

* working non interactive "serial console" (at least like it's now in the "simulation console")

* proper non-interactive behaviour of "simulation console" and "serial console" (i.e. no echo, no telnet control characters)

* command line option for disabling console mode selection (`CTRL-x`) in the "serial console"

Thanks in advance!

/Thomas


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to