Closed carllocos closed 1 year ago
A potential cause is that when you write to the file descriptor. The content buffers, thus it does not get flushed by default. Since there is no standard function that flushes based on a file descriptor, I rewrote thus the FileDescriptorChannel::write
method to use the write
standard function, which by default does not buffer:
int FileDescriptorChannel::write(const char *fmt, ...) const {
char buffer[256]{};
va_list args;
va_start(args, fmt);
int size = vsnprintf(buffer, 256, fmt, args);
int written = 0;
if( size > 0 && size < 256){
written = ::write(this->fd, buffer, size);
}
va_end(args);
return written;
}
Unfortunately, this also does not solve the problem
The problem comes from not correctly configuring the serial connection (e.g., the baudrate needs to be specified). Commit 76439b76a8ae20bae7a0e8bf7d1b7b8683c6d52c should fix the issue.
Now it is also possible to specify which baudrate
to use when connecting the local VM to a MCU via serial. This is actually mandatory when using a serial connection. To provide this, start the local VM with an extra argument of the form --baudrate 115200
When event-based out-of-place debugging, the local VM connects to the MCU via serial so as to pull primitives and receive generated events. However, the local VM does not receive any generated event nor can it perform remote function calls.
I connected to the MCU via
arduino-cli monitor
and manually created events as well as rfc interrupts. And in both cases, I receive the expected output:so I believe there is something wrong with
read
and/orwrite
to the file descriptor associated with the serial connection when performed from within the local VM.I doubled checked the number of bytes written when calling
write
. It corresponds with the expected number. https://github.com/TOPLLab/WARDuino/blob/3981b3d0e7abb0aa55bfb9e27ba2effdc732a186/src/Edward/proxy_supervisor.cpp#L129