HTTP client with RTEMS
Joel Sherrill
joel at rtems.org
Fri Oct 6 13:27:07 UTC 2017
On Fri, Oct 6, 2017 at 7:53 AM, Christian Mauderer <
christian.mauderer at embedded-brains.de> wrote:
> Hello Yie,
>
> 64k seems very few RAM.
>
> Maybe you are aware that there are currently two versions of the network
> stack: One (very old) fork of the FreeBSD stack that is integrated into
> RTEMS and a mostly up to date fork in libbsd.
>
> I'm really not sure about the old network stack but then new one needs
> at least a few megabytes of RAM.
>
The legacy stack originally ran on a target with 1MB RAM. It can be
pretty lean depending on the amount of buffers you want/need.
LWIP is another option. I don't know the memory footprint of it.
In all cases, there is the driver issues.
64k is definitely too small for the BSD based stacks. LWIP might
work if you have enough Flash for code. If you only have 64k code
and data space, it is going to be tough.
>
> The allocation that went wrong tries to allocate about 130kByte of RAM.
> (cpukit/libnetworking/rtems/rtems_glue.c line 199). And it's one that is
> called quite early in the initialization.
>
> Are you fixed to that emulated chip (due to some hardware) or did you
> just pick some random BSP? In the later case, I would suggest to pick
> some other (bigger) BSP.
>
> Kind regards
>
> Christian
>
>
> Am 06.10.2017 um 14:33 schrieb Hui Yie Teh:
> > Hi Christian,
> >
> > No, it's not an RTEMS based server. I have a simple server running on
> > python.
> >
> > I am emulating the LM3S6965 ARM board on Qemu, and I think it has 64kB
> > of RAM?
> >
> > On 6 October 2017 at 19:52, Christian Mauderer
> > <christian.mauderer at embedded-brains.de
> > <mailto:christian.mauderer at embedded-brains.de>> wrote:
> >
> >
> > Am 05.10.2017 um 22:44 schrieb Hui Yie Teh:
> > > I'm trying to initialize bsdnetwork using
> > > 'rtems_bsdnet_initialize_network()' as in the mghttpd example but
> it
> > > doesn't work.
> > >
> > > It is giving me an error "Can't get network cluster memory".
> > >
> > > Any help would be much appreciated.
> > >
> > > Thanks.
> > >
> > > On 6 October 2017 at 08:46, Hui Yie Teh <hteh703 at aucklanduni.ac.nz
> <mailto:hteh703 at aucklanduni.ac.nz>
> > > <mailto:hteh703 at aucklanduni.ac.nz <mailto:hteh703 at aucklanduni.
> ac.nz>>> wrote:
> > >
> > > Hi Christian,
> > >
> > > Thank you for the reply!
> > >
> > > My app will be doing some simple HTTP, with GET and POST
> requests
> > > that has a text response body, e.g. "Received". I think
> following
> > > the mghttpd test will suffice.
> > >
> > > However, I'm currently looking at the code for the mghttpd
> test and
> > > I was wondering if there is a way I can run it or get a
> non-test
> > > version of it? I can't really tell what I need or what the
> code does
> > > without running it.
> > >
> > > Cheers.
> > >
> > > On 6 October 2017 at 07:47, Christian Mauderer <
> list at c-mauderer.de <mailto:list at c-mauderer.de>
> > > <mailto:list at c-mauderer.de <mailto:list at c-mauderer.de>>>
> wrote:
> > >
> > > Am 05.10.2017 um 17:52 schrieb Hui Yie Teh:
> > > > Hi,
> > > >
> > > > I am trying to build a HTTP client using RTEMS. Is there
> any
> > > tutorials
> > > > that I can follow? I already have a server running, and
> > I just
> > > need to
> > > > send some GET and POST requests.
> > > >
> > > > I am new to RTEMS and embedded programming in general.
> Any
> > > help is much
> > > > appreciated.
> > > >
> > > > Cheers,
> > > > Yie
> > > >
> > >
> > > Hello Yie,
> > >
> > > it depends a little on your application.
> > >
> > > If you just want to learn a little about the HTTP protocol
> and
> > > only want
> > > to try some requests, you can just use a raw socket. The
> HTTP
> > > basics are
> > > really quite simple if you don't want to use things like
> > > compression or
> > > different MIME types. Writing a simple request for some
> > simple html
> > > document is quite easy. Something like that is done in the
> > test
> > > for the
> > > mghttpd in RTEMS:
> > >
> > >
> > >
> > https://git.rtems.org/rtems/tree/testsuites/libtests/mghttpd01
> > <https://git.rtems.org/rtems/tree/testsuites/libtests/mghttpd01>
> > >
> > <https://git.rtems.org/rtems/tree/testsuites/libtests/mghttpd01
> > <https://git.rtems.org/rtems/tree/testsuites/libtests/mghttpd01>>
> > >
> > > Note that there are most likely a lot of error cases that
> are
> > > not caught
> > > in that test (like unexpected HTTP responses).
> > >
> > > If you need your client for some more professional
> > application or
> > > something that should be more robust, I would suggest to
> > use some
> > > library that does most of the low level handling. I'm not
> > aware
> > > of one
> > > integrated into RTEMS but it shouldn't be hard to find one
> > that
> > > works.
> > >
> > > I think that I have seen some client functions in civetweb
> > (still
> > > MIT-licensed fork of mongoose httpd which has been forked
> off
> > > before the
> > > license change in mongoose). From my experience, civetweb
> > needs only
> > > very few modifications to work with RTEMS.
> > >
> > > Most likely you can also (with some more effort) compile
> some
> > > bigger C
> > > or C++ libraries like libcurl. But I haven't tried that
> > yet. By
> > > the way:
> > > there is also a large list of http client libraries on the
> > libcurl
> > > Homepage: https://curl.haxx.se/libcurl/competitors.html
> > <https://curl.haxx.se/libcurl/competitors.html>
> > > <https://curl.haxx.se/libcurl/competitors.html
> > <https://curl.haxx.se/libcurl/competitors.html>>
> > >
> > > Regards
> > >
> > > Christian
> > >
> >
> > Hello Yie,
> >
> > you said in your initial mail that you already have a server
> running. Is
> > that an RTEMS based server? In that case I would suggest to just use
> the
> > initialization from that one.
> >
> > The "Can't get network cluster memory" is printed if a malloc for a
> > cluster of mbufs fails in the initialization. A possible reason for
> that
> > is that there isn't enough memory. On what platform are you working?
> How
> > many RAM do you have?
> >
> > Regards
> >
> > Christian
> --
> --------------------------------------------
> embedded brains GmbH
> Christian Mauderer
> Dornierstr. 4
> D-82178 Puchheim
> Germany
> email: christian.mauderer at embedded-brains.de
> Phone: +49-89-18 94 741 - 18
> Fax: +49-89-18 94 741 - 08
> PGP: Public key available on request.
>
> Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
> _______________________________________________
> users mailing list
> users at rtems.org
> http://lists.rtems.org/mailman/listinfo/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20171006/80665f5a/attachment-0002.html>
More information about the users
mailing list