Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Porting gensio to an embedded system #7

Closed
matswebjorn opened this issue Jan 22, 2020 · 9 comments
Closed

Porting gensio to an embedded system #7

matswebjorn opened this issue Jan 22, 2020 · 9 comments

Comments

@matswebjorn
Copy link

matswebjorn commented Jan 22, 2020

It turns out that the makesystem does not produce an executable. Instead it produces an extensive bash script which makes it very hard to understand

  1. How to debug the code with a debugger
  2. How to port the code to an embedded system as dependencies are unclear

It would really help if the build system was simplified so that it became clear what dependancies the package has to external sources. And so that code can be debugged.

Also, the complete lack of detailed documentation of functions and datastructures makes the package literally unusable to anything else than to use the predefined tools as is which is unfortunate since there is a great need for a usable package with this functionality.

@jameshilliard
Copy link
Contributor

I added a gensio package to buildroot here. It appears that gensio doesn't have any required dependencies other than a toolchain with fork() support.

@cminyard
Copy link
Owner

cminyard commented Jan 25, 2020 via email

@cminyard
Copy link
Owner

cminyard commented Jan 25, 2020 via email

@jameshilliard
Copy link
Contributor

To run a program in the debugger or in valgrind, or something like that,
the format is:

Embedded build systems usually have a cross debug setup that can be used, for example with buildroot you can use the gdbserver setup for debugging remote processes running on a target board.

@matswebjorn
Copy link
Author

matswebjorn commented Jan 27, 2020

I just changed i tool/Makefile.am

-gensiot_LDADD = libgensiotool.a $(top_builddir)/lib/libgensio.la \
-	$(OPENSSL_LIBS)
+gensiom_LDADD = libgensiotool.a $(top_builddir)/lib/.libs/libgensio.a \
+	$(OPENSSL_LIBS)

And now I get a statically linked app which can be executed/debugged directly

@matswebjorn
Copy link
Author

This is my POC design which once it is running should be ported to my ucLinux embedded target.

  putty(1)   putty(2)     putty(3)   putty(4)
      |        |              |        |
/dev/tnt2   /dev/tnt4   /dev/tnt6   /dev/tnt8
      |        |              |        |
/dev/tnt3   /dev/tnt5   /dev/tnt7   /dev/tnt9
      |        |              |        |
      gensio-mux              gensio-mux
          |                      |
  gensio-serialdev       gensio-serialdev
          |                      |
      /dev/tnt0              /dev/tnt1
          |                      |
          +------- tty0tty ------+

I’ve taken gensiot.c and modified it (as I believe is how it should be done) to a gensiomux.c which only handles serialdev’s (to simplify the case).

But I quickly end up inside gensio with runtime errors due which seems to be caused by an incorrect setup.

  • Am I totally wrong in setting up the mux?
  • Should there also be serialdev’s on each upstream port of the mux?

gensiomux.c.tar.gz

Gensiotool.c has on line 459 the following lines

    userdata1.user_io = userdata1.io;
    userdata2.user_io = userdata1.io;

which seems to link upstream serialdev with downstream serialdev, but I don’t know if this is required in the mux case, and how to do it.

@cminyard
Copy link
Owner

cminyard commented Jan 27, 2020 via email

@cminyard
Copy link
Owner

Also, the complete lack of detailed documentation of functions and datastructures makes the package literally unusable to anything else than to use the predefined tools as is which is unfortunate since there is a great need for a usable package with this functionality.

Just to comment on this: everything is extensively documented in the man pages. That may not be how you are wanting to read it (and indeed, it's not my favorite way to document things) but that's standard on unix type systems. I really don't want to document things in multiple places; that's a recipe for inconsistency and confusion.

If you build gensio on your host and install it (installing in /usr/local works fine for me, but I'm not sure about other distros) then you can do "man gensio_open" to see documentation on that function.

The package is new, so it's going to have some rough edges. I covet any specific comments people have on improving it. Especially documentation.

@cminyard
Copy link
Owner

Note that gensios exist that can do reliable transport over a serial port, and you could run the mux on top of that. Anyway, I think this discussion is complete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants