This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: What functions should I call in ethernet drv ?


ariga masahiro wrote:
> Hello Gary and others,
> 
> Sorry I missed 10/16/2007 20:08 mail,
> I will prepare tar file and send you soon.
> 
> Before that,
> Some points became cleared and also arose other question
> and I rely on your suggestion.
> 
> I think the trouble is not my amendment or coding,rather how I 'use'
> eCos application.
> Let me explain.
> 
> I debugged on the next premise.
> 
> [premise]
> There are no assingments to function
> pointers(e.g.ng_ether_attach_p,ng_ether_input_p) in coding,
> so their inside values(=function addresses) are settled at the time of
> loading binary into RAM.
> They are initially defined in
> \packages\net\bsd_tcpip\current\include\sys\param.h like next
> #define ng_ether_attach_p cyg_ng_ether_attach_p
> .
> 
> On the above premise I decided to check on sampled
> Hitachi SE77x9 Template that I used as protocol to develop my target
> template.
> Source is CVS current version ,so it must work correctly.
> I just only amended memory layout as same as my target template.
> 
> I built 'RAM' Start Mode and linked to nc_test_slave test.
> I loaded elf file on RAM using ICE,and dumped memory addresses.
> 
> Result was just as same as my template.
> 
> --from memory map
> COMMON         0x000000008c0c0208       0x18
> /ecos-c/cygwin/home/LINK/ecoscvs_se-net-SE7709-2/untitled_install/lib/libtarget.a(net_bsd_tcpip_if_ethersubr.o)
> 
>                                          0x0 (size before relaxing)
>                0x000000008c0c0208                _cyg_ng_ether_input_p
>                0x000000008c0c020c                _cyg_ng_ether_detach_p
>                0x000000008c0c0210 _sysctl__net_link_ether_children
>                0x000000008c0c0214                _cyg_ng_ether_attach_p
>                0x000000008c0c0218                _cyg_ng_ether_output_p
>                0x000000008c0c021c _cyg_ng_ether_input_orphan_p
> COMMON         0x000000008c0c0220       0xe8
> /ecos-c/cygwin/home/LINK/ecoscvs_se-net-SE7709-2/untitled_install/lib/libtarget.a(net_bsd_tcpip_if_loop.o)
> 
> 
> and memory dump after loading.
> URAM  8C0C0214  cyg_ng_ether_attach_p        00 00 00 00 00 00 00 00
> ........
> URAM  8C0C021C  cyg_ng_ether_input_orphan_p  00 00 00 00 00 00 00 00
> ........
> URAM  8C0C0224  cyg_loif+4                   00 00 00 00 00 00 00 00
> ........
> URAM  8C0C022C  cyg_loif+c                   00 00 00 00 00 00 00 00
> ........
> URAM  8C0C0234  cyg_loif+14                  00 00 00 00 00 00 00 00
> ........
> URAM  8C0C023C  cyg_loif+1c                  00 00 00 00 00 00 00 00
> ........
> URAM  8C0C0244  cyg_loif+24                  00 00 00 00 00 00 00 00
> ........
> URAM  8C0C024C  cyg_loif+2c                  00 00 00 00 00 00 00 00
> ........
> URAM  8C0C0254  cyg_loif+34                  00 00 00 00 00 00 00 00
> ........
> URAM  8C0C025C  cyg_loif+3c                  00 00 00 00 00 00 00 00
> ........
> URAM  8C0C0264  cyg_loif+44                  00 00 00 00 00 00 00 00
> ........
> URAM  8C0C026C  cyg_loif+4c                  00 00 00 00 00 00 00 00
> ........
> URAM  8C0C0274  cyg_loif+54                  00 00 00 00 00 00 00 00
> ........
> URAM  8C0C027C  cyg_loif+5c                  00 00 00 00 00 00 00 00
> ........
> 
> I put on my target's memory layout files.
> \packages\hal\sh\inserter\current\include\pkgconf\mlt_sh_sh77x9_inserter_ram.ldi
> 
> --- begin
> #include <cyg/infra/cyg_type.inc>
> 
> MEMORY
> {
>    ram : ORIGIN = 0x8c000000, LENGTH = 0x4000000
> }
> 
> SECTIONS
> {
>    SECTIONS_BEGIN
>    SECTION_vectors (ram, 0x8c010000, LMA_EQ_VMA)
>    SECTION_text (ram, ALIGN (0x4), LMA_EQ_VMA)
>    SECTION_fini (ram, ALIGN (0x4), LMA_EQ_VMA)
>    SECTION_rodata1 (ram, ALIGN (0x8), LMA_EQ_VMA)
>    SECTION_rodata (ram, ALIGN (0x8), LMA_EQ_VMA)
>    SECTION_fixup (ram, ALIGN (0x4), LMA_EQ_VMA)
>    SECTION_gcc_except_table (ram, ALIGN (0x1), LMA_EQ_VMA)
>    SECTION_data (ram, ALIGN (0x8), LMA_EQ_VMA)
>    SECTION_bss (ram, ALIGN (0x10), LMA_EQ_VMA)
>    CYG_LABEL_DEFN(__heap1) = ALIGN (0x8);
>    SECTIONS_END
> }
> --- end
> 
> \packages\hal\sh\inserter\current\include\pkgconf\mlt_sh_sh77x9_inserter_ram.h
> 
> --- begin
> #ifndef __ASSEMBLER__
> #include <cyg/infra/cyg_type.h>
> #include <stddef.h>
> 
> #endif
> #define CYGMEM_REGION_ram (0x8c000000)
> #define CYGMEM_REGION_ram_SIZE (0x4000000)
> #define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R |
> CYGMEM_REGION_ATTR_W)
> #ifndef __ASSEMBLER__
> extern char CYG_LABEL_NAME (__heap1) [];
> #endif
> #define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1))
> #define CYGMEM_SECTION_heap1_SIZE (0x90000000 - (size_t) CYG_LABEL_NAME
> (__heap1))
> #ifndef __ASSEMBLER__
> extern char CYG_LABEL_NAME (__pci_window) [];
> #endif
> --- end
> 
> and application makefile
> --- begin
> export PREFIX :=
> /ecos-c/cygwin/home/LINK/ecoscvs_l_net_20071015/unnamed2_install
> 
> export COMMAND_PREFIX := sh-elf-
> export CC := $(COMMAND_PREFIX)gcc
> export OBJCOPY := $(COMMAND_PREFIX)objcopy
> export HOST := CYGWIN
> export AR := $(COMMAND_PREFIX)ar
> 
> XCC = sh-elf-gcc
> 
> ## Build flags.
> CFLAGS = -g -Wall -I$(PREFIX)/include -ffunction-sections -fdata-sections
> LDFLAGS = -nostartfiles -L$(PREFIX)/lib -Wl,--gc-sections -Wl,--Map
> -Wl,nc_test_slave.map
> LIBS = -Ttarget.ld -nostdlib
> LD  = $(XCC)
> 
> ## Build rules.
> all: nc_test_slave
> 
> nc_test_slave.o: nc_test_slave.c
> $(XCC) -c -o $*.o $(CFLAGS) $<
> 
> nc_test_slave: nc_test_slave.o
> $(LD) $(LDFLAGS) -o $@ $@.o $(LIBS)
> 
> clean:
> -rm -f nc_test_slave.exe nc_test_slave.o nc_test_slave.map
> --- end
> 
>> From above result I suppose I must do 'something' to make LAN91C111
>> driver 
> work,
> or my environments lack somthing ?
> 
> If you could elicit any conclusion from above accounts
> please enligten me.
> 
> I look foward to any suggestion.

Firstly, the fact that cyg_ng_ether_input_p is NULL is not important.
This is just an [optional] hook function for handling NetGraph protocol events.

Have you traced the actual ethernet driver ?
  (.../devs/eth/smsc/lan91cxx/current/src/if_lan91cxx.c )

I'd start by setting DEBUG=0xFF (manually, you have to edit that file).
This will turn on lots of messages and should guide you as to why the
driver is not working.

Note: the upper layers of the network code (and indeed most of the
drivers) are well proven - you probably don't need to be hunting
there for bugs, at least not the "out of the starting block" kind
that you have.  Stick to the actual driver :-)

-- 
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]