Folks, I'm using Gaisler's pre-compiled rcc-1.3-rc6-gcc GR712RC SMP BSP library (rtemsbsp.a in the gr712rc_smp/lib directory). I'm trying to integrate the SMP compatible version of the greth ethernet driver that is built into the gr712rc BSP library. When I use the code listed in rtems_net.c and rtems_net_config.h, I get a linker error "rtems_net.c:198: undefined reference to greth_interface_driver_attach" even though greth_interface_driver_attach is listed as a local symbol in the symbol table within the text segment. Is there some reference code that I can follow that shows how to leverage the driver manager to install the SMP version greth driver. Or can someone point out the error in my ways? Code attached below.
Thanks, Pete Cunningham Astrobotic Technology -- Notice: This message is intended solely for use of the individual or entity to which it is addressed and may contain information that is proprietary, privileged, company confidential and/or exempt from disclosure under applicable law. If the reader is not the intended recipient or agent responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. This communication may also contain data subject to the International Traffic in Arms Regulations or U.S. Export Administration Regulations and cannot be disseminated, distributed or copied to foreign nationals, residing in the U.S. or abroad, without the prior approval of the U.S. Department of State or appropriate export licensing authority. If you have received this communication in error, please notify the sender by reply e-mail or collect telephone call and delete or destroy all copies of this email message, any physical copies made of this e-mail message and/or any file attachment(s).
/**************************************************************** ** rtems_net.c ** ** Author: Alan Cudmore ** ** This module is responsible for RTEMS specific network initialization. ** ** */ #include "rki_config.h" /* ** This is not defined in RTEMS 5.x */ #define MCLBYTES 2048 /* ** If the Network subsystem is not selected, just ifdef the whole thing out */ #ifdef RKI_INCLUDE_NETWORK #include <string.h> #include <stdio.h> #include <sys/socket.h> #include <sys/un.h> #include <netinet/in.h> #include <arpa/inet.h> #include <unistd.h> #include <fcntl.h> #include <errno.h> #include <stdlib.h> #include <rtems/rtems_bsdnet.h> #include <sys/domain.h> #include <sys/mbuf.h> #include <sys/socketvar.h> #include <sys/socket.h> #include <sys/sockio.h> #include <sys/callout.h> #include <sys/proc.h> #include <sys/ioctl.h> #include <net/if.h> #include <net/route.h> #include <netinet/in.h> #include <vm/vm.h> #include <arpa/inet.h> #include <net/netisr.h> #include <net/route.h> #include <rtems/libio.h> /* ** include network configuration */ #include "rtems_net_config.h" /* ** Declare the network configuration structure */ struct rtems_bsdnet_config rtems_bsdnet_config; #if 0 /* ** Loopback interface config */ struct rtems_bsdnet_ifconfig loopback_config __attribute__((aligned(16))); extern int rtems_bsdnet_loopattach(void * dummy); #endif /* ** ethernet interface config */ struct rtems_bsdnet_ifconfig if1_config __attribute__((aligned(16))); extern int RTEMS_BSP_NETWORK_DRIVER_ATTACH (struct rtems_bsdnet_ifconfig *, int); /* ** Ethernet address */ static char ethernet_address[6] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; /* ** Convert an ethernet address string ** from a form of "00:00:00:00:00:00" to a binary byte array. */ int rtems_convert_ethernet_addr( char ethernet_address[], char *AddressString ) { int result; int i; unsigned int temp_eth_address[6]; printf("Convert ethernet address\n"); /* ** Do some basic format checking */ if ( strlen(AddressString) != 17 ) { printf("Error: Invalid MAC Address: %s\n",AddressString); return(-1); } if ( AddressString[2] != ':' || AddressString[5] != ':' || AddressString[8] != ':' || AddressString[11] != ':' || AddressString[14] != ':' ) { printf("Error: Invalid MAC Address: %s\n",AddressString); return(-1); } printf("Converting: %s\n",AddressString); result = sscanf(AddressString, "%2x:%2x:%2x:%2x:%2x:%2x", &temp_eth_address[0], &temp_eth_address[1], &temp_eth_address[2], &temp_eth_address[3], &temp_eth_address[4], &temp_eth_address[5]); if ( result < 6 ) { printf("Error: Invalid MAC Address: %s\n",AddressString); return(-1); } /* ** fill byte array */ for ( i = 0; i < 6; i++ ) { ethernet_address[i] = temp_eth_address[i] & 0xFF; } return 0; } /* ** rtems_init_network ** Initialize the network subsystem and devices for RTEMS ** */ int rtems_init_network(char *EthernetAddress, char *IPAddress, char *HostName, char *NetMask, char *GateWay, char *NameServer ) { int status; struct rtems_bsdnet_ifconfig *if1; printf("Starting RTEMS network configuration\n"); /* ** Clear out the 3 config structures */ memset(&rtems_bsdnet_config,0,sizeof(struct rtems_bsdnet_config)); #if 0 memset(&loopback_config, 0, sizeof(struct rtems_bsdnet_ifconfig)); #endif memset(&if1_config, 0, sizeof(struct rtems_bsdnet_ifconfig)); /* ** Fill out the network config structure */ rtems_bsdnet_config.network_task_priority = 1; rtems_bsdnet_config.mbuf_bytecount = 64*1024; /* Was 128K */ rtems_bsdnet_config.mbuf_cluster_bytecount = 256*1024; rtems_bsdnet_config.hostname = HostName; rtems_bsdnet_config.domainname = RTEMS_NET_DOMAINNAME; rtems_bsdnet_config.gateway = GateWay; rtems_bsdnet_config.name_server[0]= NameServer; #if 0 rtems_bsdnet_config.ifconfig = &loopback_config; /* ** Configure the loopback device structure */ loopback_config.name = "lo0"; loopback_config.attach = (int (*)(struct rtems_bsdnet_ifconfig *, int))rtems_bsdnet_loopattach; loopback_config.ip_address= "127.0.0.1"; loopback_config.ip_netmask= "255.0.0.0"; loopback_config.next = &if1_config; #else rtems_bsdnet_config.ifconfig = &if1_config; #endif /* ** Configure the ethernet device structure */ if1_config.name = RTEMS_BSP_NETWORK_DRIVER_NAME; if1_config.attach = RTEMS_BSP_NETWORK_DRIVER_ATTACH; if1_config.ip_address= IPAddress; if1_config.ip_netmask= NetMask; if1_config.rbuf_count = 32; if1_config.xbuf_count = 32; if1_config.next = NULL; printf("RTEMS network config: All structures filled out, now calling init functions\n"); #if (defined (RTEMS_SET_ETHERNET_ADDRESS)) /* ** Convert the ethernet address string to the byte array */ status = rtems_convert_ethernet_addr(ethernet_address, EthernetAddress ); if ( status == 0 ) { if1_config.hardware_address = ethernet_address; } #endif /* ** Initialize the network */ printf("Calling rtems_bsdnet_initialize_network\n"); if( rtems_bsdnet_initialize_network() == -1 ) { printf("RTEMS Network Initialization failed\n"); return(1); } else { printf("RTEMS bsdnet_initialize_network returned OK\n"); } printf("Hostname is %s.%s\n", rtems_bsdnet_config.hostname, rtems_bsdnet_config.domainname ); /* ** Loop through the available devices and print the stats */ for( if1 = &if1_config; if1; if1 = if1->next ) { printf(" Device %s, netmask %s, address %s\n", if1->name, if1->ip_netmask, if1->ip_address ); } /* ** Printout the gateway and DNS server(s) */ printf(" gateway %s, dns1 %s, dns2 %s\n\n\n", rtems_bsdnet_config.gateway, rtems_bsdnet_config.name_server[0], rtems_bsdnet_config.name_server[1] ); return(0); } /* ** rtems_auto_init_network ** This function is called from the RTEMS Init function if ** the user wishes to setup a static network address without ** using the shell configuration. */ int rtems_auto_init_network(void) { int status; status = rtems_init_network(RTEMS_ETHERNET_ADDRESS, RTEMS_NET_IP_ADDRESS, RTEMS_NET_HOSTNAME, RTEMS_NET_IP_NETMASK, RTEMS_NET_GATEWAY, RTEMS_NET_NAME_SERVER1); return(status); } #else /* ** no network config! */ int rtems_init_network( void ) { return(0); } #endif
/* ** rtems_net_config.h ** ** Author: Alan Cudmore ** ** This contains the network settings for an RTEMS Application ** */ #ifndef _RTEMS_NET_CONFIG_H_ #define _RTEMS_NET_CONFIG_H_ /* ** Define the network driver name and Attach routine ** These may be already defined in bsp.h */ #ifndef RTEMS_BSP_NETWORK_DRIVER_NAME #define RTEMS_BSP_NETWORK_DRIVER_NAME "gr_eth1" #endif #ifndef RTEMS_BSP_NETWORK_DRIVER_ATTACH #define RTEMS_BSP_NETWORK_DRIVER_ATTACH greth_interface_driver_attach /* rtems_leon_open_eth_driver_attach */ /* rtems_leon_greth_driver_attach */ #endif #define RTEMS_NET_DOMAINNAME "local" /* ** Define the hostname, IP address, etc for the Main ethernet interface ** These parameters can be set through the "netsetup" shell command ** if desired. These are the defaults. */ #define RTEMS_NET_HOSTNAME "mustang" #define RTEMS_NET_IP_ADDRESS "192.168.1.6" #define RTEMS_NET_IP_NETMASK "255.255.255.0" #define RTEMS_NET_GATEWAY "192.168.1.1" #define RTEMS_NET_NAME_SERVER1 "192.168.1.1" /* * Define RTEMS_SET_ETHERNET_ADDRESS if you want to specify the * Ethernet address here. If RTEMS_SET_ETHERNET_ADDRESS is not * defined the driver will choose an address. */ #define RTEMS_SET_ETHERNET_ADDRESS #define RTEMS_ETHERNET_ADDRESS "00:04:9F:00:5B:21" #endif
_______________________________________________ users mailing list users@rtems.org http://lists.rtems.org/mailman/listinfo/users