Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
15 years ago

SimpleSocketServer (EP3C120 DB)

I have been working with the CycloneIII Development board (EP3C120) using QuartusII 9.1sp2 with the project daixiwen (http://alteraforums.com/forum/member.php?u=4443) linked at:

http://alteraforums.com/forum/showthread.php?p=90831#post90831

I created the NIOS template project Simple Socket Server and am having problems with connecting to the server through telnet. The only modification required to compile was Enabling the NicheStack component in System Library Settings. I connect the ethernet cable from the development board to my computer and run the NIOS.

once running the console displays:

Copyright 1996-2008 by InterNiche Technologies. All rights reserved. 
prep_tse_mac 0
Your Ethernet MAC address is 00:07:ed:ff:c2:95
prepped 1 interface, initializing...
INFO    : TSE MAC 0 found at address 0x10022800
INFO    : PHY Marvell 88E1111 found at PHY address 0x12 of MAC Group
INFO    : PHY - Automatically mapped to tse_mac_device
INFO    : PHY - Restart Auto-Negotiation, checking PHY link...
INFO    : PHY - Auto-Negotiation PASSED
INFO    : PHY - Checking link...
INFO    : PHY - Link established
INFO    : PHY - Speed = 1000, Duplex = Full
OK, x=0, CMD_CONFIG=0x00000000
MAC post-initialization: CMD_CONFIG=0x0400020b
 RX descriptor chain desc (1 depth) created
mctest init called
IP address of et1 : 192.168.1.234
Created "Inet main" task (Prio: 2)
Created "clock tick" task (Prio: 3)
this all looks perfect! now i use telnet on my PC to connect to the development board at 192.168.1.234 and the console displays this: (telnet on PC times out and closes)

dtrap - needs breakpoint
panic: pktdemux: corrupt pkt
dtrap - needs breakpoint
ip_exit: calling func 0xc01235c
netclose: closing iface Altera TSE MAC ethernet
ip_exit: calling func 0xc019808
any suggestions?

17 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Seems like my code is getting to the blocking select() below and hanging... wondering what is happening or not happening - anyone?

    FD_ZERO(&readfds);

    FD_SET(fd_listen, &readfds);

    max_socket = fd_listen+1;

    if (conn.fd != -1)

    {

    FD_SET(conn.fd, &readfds);

    if (max_socket <= conn.fd)

    {

    max_socket = conn.fd+1;

    }

    }

    select(max_socket, &readfds, NULL, NULL, NULL);

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    i tried uncommenting the define you mentioned and recompiled and got this:

    
    Linking simple_socket_server.elf...
    /cygdrive/c/PROJECTS/CycloneProject/cycloneIII_3c120_dev_niosII_standard/software/simple_socket_server_syslib/Debug/libsimple_socket_server_syslib.a(tk_crnos.o)(.text+0x90): In function `tcp_sleep':
    /cygdrive/c/altera/91/nios2eds/components/altera_iniche/UCOSII/src/misclib/tk_crnos.c:85: multiple definition of `tcp_sleep'
    /cygdrive/c/PROJECTS/CycloneProject/cycloneIII_3c120_dev_niosII_standard/software/simple_socket_server_syslib/Debug/libsimple_socket_server_syslib.a(netmain.o)(.text+0x1e8):/cygdrive/c/altera/91/nios2eds/components/altera_iniche/UCOSII/src/misclib/netmain.c:547: first defined here
    /cygdrive/c/altera/91/nios2eds/bin/nios2-gnutools/H-i686-pc-cygwin/bin/../lib/gcc/nios2-elf/3.4.6/../../../../nios2-elf/bin/ld: Warning: size of symbol `tcp_sleep' changed from 236 in /cygdrive/c/PROJECTS/CycloneProject/cycloneIII_3c120_dev_niosII_standard/software/simple_socket_server_syslib/Debug/libsimple_socket_server_syslib.a(netmain.o) to 360 in /cygdrive/c/PROJECTS/CycloneProject/cycloneIII_3c120_dev_niosII_standard/software/simple_socket_server_syslib/Debug/libsimple_socket_server_syslib.a(netmain.o)
    /cygdrive/c/PROJECTS/CycloneProject/cycloneIII_3c120_dev_niosII_standard/software/simple_socket_server_syslib/Debug/libsimple_socket_server_syslib.a(tk_crnos.o)(.text+0x1f8): In function `tcp_wakeup':
    /cygdrive/c/altera/91/nios2eds/components/altera_iniche/UCOSII/src/misclib/tk_crnos.c:146: multiple definition of `tcp_wakeup'
    /cygdrive/c/PROJECTS/CycloneProject/cycloneIII_3c120_dev_niosII_standard/software/simple_socket_server_syslib/Debug/libsimple_socket_server_syslib.a(netmain.o)(.text+0x2d4):/cygdrive/c/altera/91/nios2eds/components/altera_iniche/UCOSII/src/misclib/netmain.c:581: first defined here
    /cygdrive/c/altera/91/nios2eds/bin/nios2-gnutools/H-i686-pc-cygwin/bin/../lib/gcc/nios2-elf/3.4.6/../../../../nios2-elf/bin/ld: Warning: size of symbol `tcp_wakeup' changed from 132 in /cygdrive/c/PROJECTS/CycloneProject/cycloneIII_3c120_dev_niosII_standard/software/simple_socket_server_syslib/Debug/libsimple_socket_server_syslib.a(netmain.o) to 240 in /cygdrive/c/PROJECTS/CycloneProject/cycloneIII_3c120_dev_niosII_standard/software/simple_socket_server_syslib/Debug/libsimple_socket_server_syslib.a(netmain.o)
    /cygdrive/c/PROJECTS/CycloneProject/cycloneIII_3c120_dev_niosII_standard/software/simple_socket_server_syslib/Debug/libsimple_socket_server_syslib.a(tk_crnos.o)(.text+0xb4): In function `tcp_sleep':
    /cygdrive/c/altera/91/nios2eds/components/altera_iniche/UCOSII/src/misclib/tk_crnos.c:91: undefined reference to `global_TCPwakeup_set'
    /cygdrive/c/PROJECTS/CycloneProject/cycloneIII_3c120_dev_niosII_standard/software/simple_socket_server_syslib/Debug/libsimple_socket_server_syslib.a(tk_crnos.o)(.text+0xb8):/cygdrive/c/altera/91/nios2eds/components/altera_iniche/UCOSII/src/misclib/tk_crnos.c:91: undefined reference to `global_TCPwakeup_set'
    /cygdrive/c/PROJECTS/CycloneProject/cycloneIII_3c120_dev_niosII_standard/software/simple_socket_server_syslib/Debug/libsimple_socket_server_syslib.a(tk_crnos.o)(.text+0xd8):/cygdrive/c/altera/91/nios2eds/components/altera_iniche/UCOSII/src/misclib/tk_crnos.c:93: undefined reference to `global_TCPwakeup_set'
    /cygdrive/c/PROJECTS/CycloneProject/cycloneIII_3c120_dev_niosII_standard/software/simple_socket_server_syslib/Debug/libsimple_socket_server_syslib.a(tk_crnos.o)(.text+0xdc):/cygdrive/c/altera/91/nios2eds/components/altera_iniche/UCOSII/src/misclib/tk_crnos.c:93: undefined reference to `global_TCPwakeup_set'
    /cygdrive/c/PROJECTS/CycloneProject/cycloneIII_3c120_dev_niosII_standard/software/simple_socket_server_syslib/Debug/libsimple_socket_server_syslib.a(tk_crnos.o)(.text+0xf8):/cygdrive/c/altera/91/nios2eds/components/altera_iniche/UCOSII/src/misclib/tk_crnos.c:94: undefined reference to `global_TCPwakeup_set'
    /cygdrive/c/PROJECTS/CycloneProject/cycloneIII_3c120_dev_niosII_standard/software/simple_socket_server_syslib/Debug/libsimple_socket_server_syslib.a(tk_crnos.o)(.text+0xfc):/cygdrive/c/altera/91/nios2eds/components/altera_iniche/UCOSII/src/misclib/tk_crnos.c:94: more undefined references to `global_TCPwakeup_set' follow
    /cygdrive/c/PROJECTS/CycloneProject/cycloneIII_3c120_dev_niosII_standard/software/simple_socket_server_syslib/Debug/libsimple_socket_server_syslib.a(tk_crnos.o)(.text+0x118): In function `tcp_sleep':
    /cygdrive/c/altera/91/nios2eds/components/altera_iniche/UCOSII/src/misclib/tk_crnos.c:95: undefined reference to `global_TCPwakeup_setIndx'
    /cygdrive/c/PROJECTS/CycloneProject/cycloneIII_3c120_dev_niosII_standard/software/simple_socket_server_syslib/Debug/libsimple_socket_server_syslib.a(tk_crnos.o)(.text+0x118):/cygdrive/c/altera/91/nios2eds/components/altera_iniche/UCOSII/src/misclib/tk_crnos.c:95: Unable to reach global_TCPwakeup_setIndx (at 0x00000000) from the global pointer (at 0x0c0520dc) because the offset (-201662684) is out of the allowed range, -32678 to 32767.
    collect2: ld returned 1 exit status
    make: ***  Error 1
    
    looks like this causes: multiple definition of `tcp_wakeup()' and `tcp_wakeup()' as these were originally defined in tk_crnos.c but when using this define they are redefined in netmain.c
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Guys I too face the similar problem.

    Go through the attached snapshot of error and suggest me the solution
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    fire a debugger and put a breakpoint on dtrap() to see what is causing it.

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi folks,

    I am using Arria II GX on my custom board

    I am making my custom board as CLIENT and one host PC as SERVER to establish communication between client and server using socket programming.

    I am using MARVELL PHY 88E1111 on my custom board, Triple Speed Ethernet MAC in my SOPC builder design

    I have attached snapshot of my SOPC bulider design, Please go through it and let me know if any problem in SOPC builder design.

    I created a client program in Nios II SBT for Eclipse and tried to run as hardware on my custom board.

    I am able to configure my custom board with static IP address, I can ping my custom board successfully with the IP address I configured.

    socket gets created on the board, after this client program on custom board tries to connect to server on my PC, but.....

    connect never happens....

    I have also attached snapshot of whatever I see in NIOS II console.

    sometimes I get error message as

    dtrap - needs breakpoint

    panic: pktdemux: corrupt pkt

    dtrap: needs breakpoint

    ip_exit: calling func 0x1141eb30

    netclose: closing iface Altera TSE MAC Ehernet

    ip_exit: calling func 0x114126ef0

    well sometimes I get error as

    No free buffers for rx

    No free buffers for rx

    ......................

    ......................

    ......................

    No free buffers for rx

    Please go through my attached snapshots and suggest me the possible solutions.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    put a breakpoint on the dtrap() function and use the debugger to find out where the call came from. If you are lucky you may find a helpful comment in the code saying why dtrap() was called.

    And don't post the same question multiple times