These are chat archives for machinekit/machinekit

16th
Aug 2016
zhivko
@zhivko
Aug 16 2016 12:01

@mhaberler: regarding small test case for: https://github.com/mhaberler/libzmtp/commits/xpub that should one day run on embedded RTOS platform - I get compiler error:

app/zmtp_channel.c:428:18: fatal error: poll.h: No such file or directory

Where should I get this poll.h from ? rtos doesn't provie it neither espressif... do oyu have any idea?

zhivko
@zhivko
Aug 16 2016 12:13
Probably I need to port this to my embeded platform socket fd reserve and send/recv calls ?
Michael Haberler
@mhaberler
Aug 16 2016 12:14
Read the linux manpage on poll(2) and then decide how to do something similar on your rtos
This is not just a lacking library header, it is a fundamental os function
Poll(2) is a out monitoring several fds for events, with a timeout
zhivko
@zhivko
Aug 16 2016 12:17
This are probably just network events?
Michael Haberler
@mhaberler
Aug 16 2016 12:17
Use linux and be done, use some rtos and reimplement significant functionality
Filedescriptor events
Fd is a superset of net connections
zhivko
@zhivko
Aug 16 2016 12:18
I am looking in: htps://espressif.com/sites/default/files/documentation/20a-esp8266_rtos_sdk_programming_guide_en_v1.4.0.pdf if there is something similar here already
Michael Haberler
@mhaberler
Aug 16 2016 12:18
You need to understand poll(2) first
zhivko
@zhivko
Aug 16 2016 12:20
OK - but I thought that libzmtp should be minimal - almost self contained...
Now I see it relies to linux stack...
Michael Haberler
@mhaberler
Aug 16 2016 12:42
well it uses poll - if you can work around that it should work
zhivko
@zhivko
Aug 16 2016 12:43
OK.thx - will see if I can make it...
Michael Haberler
@mhaberler
Aug 16 2016 12:53
seems this is a freertos derivative, maye select() can do it: http://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/API/select.shtml
zhivko
@zhivko
Aug 16 2016 12:53
yes I was just looking the select calls :)
Michael Haberler
@mhaberler
Aug 16 2016 12:53
select is an ancient precursor of poll(2)
zhivko
@zhivko
Aug 16 2016 13:01
struct pollfd pollfd;
still need to take poll.h from somewhere...
Michael Haberler
@mhaberler
Aug 16 2016 13:02
it wont help you taking this file from somewhere as your kernel doesnt support that system call
you need to emulate poll()
zhivko
@zhivko
Aug 16 2016 13:02
ah ok so I need to replace:
rc = poll (&pollfd, 1, -1);
with select(...
Michael Haberler
@mhaberler
Aug 16 2016 13:03
yes
zhivko
@zhivko
Aug 16 2016 14:26
ok trying to build my example I get:
16:19:34 **** Incremental Build of configuration Sming for project StepperDM542 ****
make all 
CC app/zmtp_endpoint.c
app/zmtp_endpoint.c: In function 'zmtp_endpoint_connect':
app/zmtp_endpoint.c:40:31: error: macro "connect" requires 3 arguments, but only 1 given
     return self->connect (self);
                               ^
app/zmtp_endpoint.c:40:5: warning: return makes integer from pointer without a cast [enabled by default]
/home/klemen/git/SmingRTOS/sming/Makefile-rboot.mk:416: recipe for target 'out/build/app/zmtp_endpoint.o' failed
     return self->connect (self);
     ^
app/zmtp_endpoint.c: In function 'zmtp_endpoint_listen':
app/zmtp_endpoint.c:53:30: error: macro "listen" requires 2 arguments, but only 1 given
     return self->listen (self);
                              ^
app/zmtp_endpoint.c:53:5: warning: return makes integer from pointer without a cast [enabled by default]
     return self->listen (self);
     ^
make: *** [out/build/app/zmtp_endpoint.o] Error 1

16:19:34 Build Finished (took 72ms)
Michael Haberler
@mhaberler
Aug 16 2016 14:27
that grandiose rtos defines listen and connect as macros.. need to rename those methods.
zhivko
@zhivko
Aug 16 2016 14:27
ok will try
but thinking about rtos and esp - the esp32 should run on 240MHz - i wonder what performance will be
zhivko
@zhivko
Aug 16 2016 14:58
Ugh... move forward but getting more errors like:
16:54:15 **** Incremental Build of configuration Sming for project StepperDM542 ****
make all 
CC app/zmtp_tcp_endpoint.c
app/zmtp_tcp_endpoint.c: In function 'zmtp_tcp_endpoint_new':
app/zmtp_tcp_endpoint.c:38:18: error: variable 'hints' has initializer but incomplete type
     const struct addrinfo hints = {
                  ^
app/zmtp_tcp_endpoint.c:39:9: error: unknown field 'ai_family' specified in initializer
         .ai_family   = AF_INET,
         ^
app/zmtp_tcp_endpoint.c:39:9: warning: excess elements in struct initializer [enabled by default]
app/zmtp_tcp_endpoint.c:39:9: warning: (near initialization for 'hints') [enabled by default]
app/zmtp_tcp_endpoint.c:40:9: error: unknown field 'ai_socktype' specified in initializer
         .ai_socktype = SOCK_STREAM,
         ^
app/zmtp_tcp_endpoint.c:40:9: warning: excess elements in struct initializer [enabled by default]
app/zmtp_tcp_endpoint.c:40:9: warning: (near initialization for 'hints') [enabled by default]
app/zmtp_tcp_endpoint.c:41:9: error: unknown field 'ai_flags' specified in initializer
         .ai_flags    = AI_NUMERICHOST | AI_NUMERICSERV
/home/klemen/git/SmingRTOS/sming/Makefile-rboot.mk:416: recipe for target 'out/build/app/zmtp_tcp_endpoint.o' failed
  • any idea what could be wrong ?
Michael Haberler
@mhaberler
Aug 16 2016 14:58
impossible to have one
zhivko
@zhivko
Aug 16 2016 15:00
Could it be it is related to my compiler options for sming rtos project?
# compiler flags using during compilation of source files
CFLAGS        = -Os -g -Wpointer-arith -Wl,-EL -nostdlib -mlongcalls -mtext-section-literals -finline-functions -fdata-sections -ffunction-sections -D__ets__ -DICACHE_FLASH -DARDUINO=106 -DCOM_SPEED_SERIAL=$(COM_SPEED_SERIAL) $(USER_CFLAGS) -std=c99# -Werror -Wundef 
CXXFLAGS    = $(CFLAGS) -fno-rtti -fno-exceptions -std=c99 -std=c++11 -felide-constructors -Wno-literal-suffix     #-std=c++11
Michael Haberler
@mhaberler
Aug 16 2016 15:01
sorry, I do not have any experience with FreeRTOS
zhivko
@zhivko
Aug 16 2016 15:02
ok