This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Ethernet driver: alignment warning
- To: ecos-discuss at sources dot redhat dot com
- Subject: [ECOS] Ethernet driver: alignment warning
- From: Christian Plessl <cplessl at ee dot ethz dot ch>
- Date: Wed, 18 Oct 2000 18:21:53 +0200
Hi
Currently I'm porting a driver for NE2000 ISA network adapters to ecos
(i386 target). I integrated the driver in the devs/eth tree of ecos. Using
the driver directly seems to work already, but integrated in ecos the
driver doesnt work yet.
When I compile ecos with network support I always get the following warning:
warning: alignment of `if_ne2k_netdev' is greater than maximum object file
alignment. Using 4.
I followed the document driver_doc in the io/eth/doc directory, which
explains how to write an ethernet driver. The warning comes from the
initialization of the driver structures using the ETH_DRV_SC and
NETDEVTAB_ENTRY macros.
I dont know whether I can ingore this warning safely or not!
Can anybody help?
In the remainder of this Mail I attached the output of make, a snippet of
the source code and the same source after gcc processed the macros.
Chris
---------- gcc output ------------
make[1]: Entering directory
`/home/cplessl/work/ram-work-net/devs/eth/ne2k/current'
i386-elf-gcc -c -I/home/cplessl/work/ram-work-net/install/include
-I/usr/local/pack/ecos-cvs/ecos/packages/devs/eth/ne2k/current
-I/usr/local/pack/ecos-cvs/ecos/packages/devs/eth/ne2k/current/src
-I/usr/local/pack/ecos-cvs/ecos/packages/devs/eth/ne2k/current/tests -I.
-I/usr/local/pack/ecos-cvs/ecos/packages/devs/eth/ne2k/current/src/
-save-temps -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef
-Woverloaded-virtual -g -O2 -ffunction-sections -fdata-sections -fno-rtti
-fno-exceptions -fvtable-gc -finit-priority -Wp,-MD,src/ne2000_drv.tmp -o
src/devs_eth_ne2k_ne2000_drv.o
/usr/local/pack/ecos-cvs/ecos/packages/devs/eth/ne2k/current/src/ne2000_drv.c
/usr/local/pack/ecos-cvs/ecos/packages/devs/eth/ne2k/current/src/ne2000_drv.c:63:
warning: alignment of `if_ne2k_netdev' is greater than maximum object file
alignment. Using 4.
----------- end of gcc output --------
---------- source snippet ------------
struct if_ne2k_priv_data_t {
snic nic_stat;
unsigned char prom[LEN_PROM]; // content of prom
cyg_handle_t ne2k_int_handle; // handle to inthandler
cyg_interrupt ne2k_interrupt; // the inthandler itself
bool ne2k_int_initialized; // is the int handler initialized
bool ne2k_int_active; // is inthander active (attached + unmasked)
} priv_data;
ETH_DRV_SC(if_ne2k_sc,
&priv_data, // driver specific data
"eth0",
if_ne2k_start,
if_ne2k_stop,
if_ne2k_control,
if_ne2k_can_send,
if_ne2k_send,
if_ne2k_recv,
if_ne2k_deliver,
if_ne2k_poll,
if_ne2k_int_vector
);
NETDEVTAB_ENTRY(if_ne2k_netdev,
"if_ne2k",
if_ne2k_init,
&if_ne2k_sc);
---------- end of source snippet ------------
-----------source after macro expansion ------
struct if_ne2k_priv_data_t {
snic nic_stat;
unsigned char prom[16 ];
cyg_handle_t ne2k_int_handle;
cyg_interrupt ne2k_interrupt;
bool ne2k_int_initialized;
bool ne2k_int_active;
} priv_data;
static void
if_ne2k_start (struct eth_drv_sc * if_ne2k_sc , unsigned char
*enaddr, int flags); static void
if_ne2k_stop (struct eth_drv_sc * if_ne2k_sc ); static int
if_ne2k_control (struct eth_drv_sc * if_ne2k_sc , unsigned long
key, void *data, int data_length); static int
if_ne2k_can_send (struct eth_drv_sc * if_ne2k_sc ); static void
if_ne2k_send (struct eth_drv_sc * if_ne2k_sc , struct
eth_drv_sg *sg_list, int sg_len, int total, unsigned long key); static void
if_ne2k_recv (struct eth_drv_sc * if_ne2k_sc , struct
eth_drv_sg *sg_list, int sg_len); static void
if_ne2k_int (struct eth_drv_sc * if_ne2k_sc ); static void
if_ne2k_int (struct eth_drv_sc * if_ne2k_sc ); static int
if_ne2k_int_vector
(struct eth_drv_sc * if_ne2k_sc ); static struct
eth_hwr_funs if_ne2k_sc_funs = { if_ne2k_start
, if_ne2k_stop , if_ne2k_control , if_ne2k_can_send
, if_ne2k_send , if_ne2k_recv , if_ne2k_int
, if_ne2k_int , if_ne2k_int_vector , ð_drv_funs,
(struct eth_drv_funs *)0 }; struct eth_drv_sc if_ne2k_sc = {&
if_ne2k_sc_funs,
&priv_data ,
"eth0" }; ;
static bool
if_ne2k_init (struct cyg_netdevtab_entry *tab);
cyg_netdevtab_entry_t if_ne2k_netdev __attribute__((section (
".ecos.table." "netdev" ".data" ))) = {
"if_ne2k" , if_ne2k_init ,
&if_ne2k_sc }; ;
-----------end of source after macro expansion ------
--
Christian Plessl <cplessl@ee.ethz.ch>