How use Ethernet connectivity with rtems-libbsd

Chris Johns chrisj at rtems.org
Fri Aug 4 01:24:19 UTC 2017


On 03/08/2017 21:30, mfg wrote:
> 
> Hello everyone!
> 
> I have a problem with compiling examples of rtems-libbsd. I just do not know how
> to do it. I have the example (Testsuite/ping01/test_main.c) . This is the report
> of terminal when I executed it:
> 
> ## Transferring control to RTEMS (at address 00104040) ...
> *** LIBBSD PING 1 TEST ***
> nexus0: <RTEMS Nexus device>
> cgem0: <Cadence CGEM Gigabit Ethernet Interface> on nexus0
> miibus0: <MII bus> on cgem0
> e1000phy0: <Marvell 88E1512 Gigabit PHY> PHY 0 on miibus0
> e1000phy0:  none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT-FDX,
> 1000baseT-FDX-master, auto
> cgem0: Ethernet address: 00:0a:35:00:01:22
> zy7_slcr0: <Zynq-7000 slcr block> on nexus0
> [zone: udpcb] kern.ipc.maxsockets limit reached
> notice: cgem0: link state changed to DOWN
> add host 192.168.100.11: gateway cgem0
> add net default: gateway 192.168.100.11
> PING 192.168.100.11 (192.168.100.11): 56 data bytes
> ping: sendto: Host is unreachable
> ping: sendto: Host is unreachable
> ping: sendto: Host is unreachable
> --- 192.168.100.11 ping statistics ---
> 3 paassertion "exit_code == EXIT_SUCCESS" failed: file
> "../../testsuite/ping01/test_main.c", line 57, function: test_ping
> 
> 
> I want to change the IP for ping to my PC. It is in the file
> (sandbox/rtems-libbsd/build/arm-rtems4.12-xilinx_zynq_zedboard/testsuite/include/rtems/bsd/test/network-config.h).
> But I never used Waf before. ¿Where is the makefile for the suitables examples?
> 
> By the way, I'm working on a zedboard and I'm trying to make Ethernet
> connectivity work. (If someone has a little manual I would appreciate it)
> 

The way I configure rtems-libbsd is to use '/etc/rc.conf'. I create or install a
'/etc/rc.conf' file then ask for the stack to be initialised. An example from a
zynq based board using the RTEMS shell is:

-------------------------
[/] # cat /etc/rc.conf
#
# My Zynq LibBSD Configuration
#

hostname="XXX-YYY-ZZZ"
ifconfig_cgem0="DHCP rxcsum txcsum"
ifconfig_cgem0_alias0="ether 00:aa:bb:cc:00:01"

dhcpcd_priority="200"
dhcpcd_options="--nobackground --timeout 10"

telnetd_enable="YES"
-------------------------

In my code I have:

  r = rtems_bsd_run_etc_rc_conf(15, true);
  if (r < 0)
    printf("error: loading BSD /etc/rc.conf failed: %s\n", strerror(errno));

There are other variants of this call you can use. Please refer to the header
file in the source for details.

You can find out more about 'rc.conf' from the FreeBSD man pages. Only a subset
of the documented and available options for FreeBSD are available on RTEMS.
Currently the source code is best place to see what is available.

These FreeBSD pages may help:

https://www.freebsd.org/doc/handbook/network-dhcp.html
https://www.freebsd.org/cgi/man.cgi?query=dhcpcd

Chris


More information about the users mailing list