GSoC 2020: [rtems/rsb]: Error while adding ptp support. This time building for xilinx_zynq_a9_qemu

junkes junkes at fhi-berlin.mpg.de
Thu Jun 4 19:38:45 UTC 2020


Hallo Mritunjay, 

You can't just take the github ptpd sources and make them work in RTEMS.
You have to make some configuration
and sources changes before you can build the with the rsb. 

Some things like the sys/cpuset.h seems not to be fully compatible yet
and so the configure simply makes
"wrong" decisions. E.g. defines HAVE_SYS_CPUSET_H = 1 as sys/cpuset.h
exists.I played a little bit with it and reset
the definition in ptpd-master/src/ptpd.h  (quick and dirty) and could
reduce the error messages because there is a query for
this variable in the code (src/dep/sys.c): 

in ptpd.h after the include of the created configs : 

...
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif /* HAVE_CONFIG_H */ 

#undef HAVE_NTP_GETTIME
#undef HAVE_SYS_CPUSET_H 

#ifdef linux
... 

in src/dep/sys.c  

...
#ifdef HAVE_SYS_CPUSET_H                                                
                                                                        
                            
       cpuset_t mask;                                                   
                                                                        
                           
       CPU_ZERO(&mask);                                                 
                                                                        
                           
       if(cpu >= 0) {                                                   
                                                                        
                           
           CPU_SET(cpu,&mask);                                          
                                                                        
                           
       } else {                                                         
                                                                        
                           
               int i;                                                   
                                                                        
                           
               for(i = 0;  i < CPU_SETSIZE; i++) {                      
                                                                        
                           
                       CPU_SET(i, &mask);                               
                                                                        
                           
               }                                                        
                                                                        
                           
       }                                                                
                                                                        
                           
       return(cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_PID,        
                                                                        
                           
                             -1, sizeof(mask), &mask));                 
                                                                        
                           
#endif /* HAVE_SYS_CPUSET_H */   

In src/dep/constants_dep.h  one can find: 

* platform dependent */ 

#if !defined(linux) && !defined(__NetBSD__) && !defined(__FreeBSD__) &&
\
!defined(__APPLE__) && !defined(__OpenBSD__) && !defined(__sun) &&
!defined(__QNXNTO__)
#error PTPD hasn't been ported to this OS - should be possible \
if it's POSIX compatible, if you succeed, report it to
ptpd-devel at sourceforge.net
#endif 

here I added "&& !defined(__rtems__)  

and here:
...                                                                     
                                                                        
                             
#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__APPLE__) ||
defined(__OpenBSD__) || defined(__sun) || defined(__QNXNTO__) ||
defined(__rtems__)                  
# include <sys/types.h>                                                 
                                                                        
                            
# include <sys/socket.h>                                                
                                                                        
                            
#ifdef HAVE_SYS_SOCKIO_H                                                
                                                                        
                            
#include <sys/sockio.h>                                                 
                                                                        
                            
#endif /* HAVE_SYS_SOCKIO_H */                                          
                                                                        
                            
# include <netinet/in.h>                                                
                                                                        
                            
# include <net/if.h>                                                    
                                                                        
                            
# include <net/if_dl.h>                                                 
                                                                        
                            
# include <net/if_types.h>                                              
                                                                        
                            
#ifdef HAVE_NET_IF_ETHER_H                                              
                                                                        
                            
#  include <net/if_ether.h>
... 

and so on... You'd have to bite through it once and then you will surely
get it compiled.      

HTH Heinz 

On 2020-06-04 20:29, Mritunjay Sharma wrote:

> On Thu, Jun 4, 2020 at 11:07 PM Sebastian Huber <sebastian.huber at embedded-brains.de> wrote: 
> 
>> On 04/06/2020 16:22, Gedare Bloom wrote:
>> 
>>>>> In the github version this code is conditional on sys/cpuset.h being present.
>>>>> 
>>> Well, we do have a sys/cpuset.h in newlib. It doesn't have these BSD
>>> definitions though. Probably either:
>>> 1. Add more stuff to sys/cpuset.h to make it support BSDisms. This
>>> would mean adding cpuset_setaffinity support in rtems, I guess.
>>> 2. Figure out how to disable the conditional code using the
>>> cpuset_setaffinity function.
>> The <sys/cpuset.h> is already as compatible as possible to glibc and 
>> FreeBSD. There is always room for improvement, however, in this area it 
>> will be difficult.
> 
> Please it would be kind of you all to guide on what is the best thing I can do next. It is looking 
> a little difficult. If something similar has been done earlier, sharing it can be a lot helpful to take a cue.  
> 
> Mritunjay 
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20200604/bc2363e7/attachment-0001.html>


More information about the devel mailing list