FPGA Intellectual Property
PCI Express*, Networking and Connectivity, Memory Interfaces, DSP IP, and Video IP

lwIP Related

Altera_Forum
Honored Contributor II
1,096 Views

Dear Friend . 

I have to communicate my Linux Based Client ...with Nios based Server, Using lwIP.... 

i am comfortable in lilnux socket programming ...but have little idia on NIOS-ii Processor.. 

please help me out how do i write Server application on NIOS-II (i have 1C20 Cyclone -II board) using lwIP. 

 

Is uc/OS-II must be there when writing Server application..? 

 

I am trying to Understand the "Soimple Socket Server Example" but its hard to understand this code.
0 Kudos
7 Replies
Altera_Forum
Honored Contributor II
395 Views

The server socket example won't work with lwIP. It was written for InterNiche. You can use lwIP without an OS (easier than you can with InterNiche), but you will have to write your own socket example. lwIP socket programming is not difficult. 

 

Bill A.
0 Kudos
Altera_Forum
Honored Contributor II
395 Views

Thanx BillA, 

 

1.Simple Socket Server Example is working with Quartus 5, and use telnet as a server. with lwIP only. (Example code given along with NIOS-II it IDE tool ) 

 

2. Is the API's i am using on Linux (bind, connect, etc.) while writing socket programming is same on lwIP? 

 

3. If I wish to take data through Ethernet using lwip and after processing it ...i want to forward it to some other ip address or some other FPGA modules, does it required OS in between?
0 Kudos
Altera_Forum
Honored Contributor II
395 Views

 

--- Quote Start ---  

Thanx BillA, 

1.Simple Socket Server Example is working with Quartus 5, and use telnet as a server. with lwIP only. (Example code given along with NIOS-II it IDE tool ) 

 

--- Quote End ---  

You're welcome. I was commenting on current versions of NIOS tools which don't support lwIP. 

--- Quote Start ---  

 

2. Is the API's i am using on Linux (bind, connect, etc.) while writing socket programming is same on lwIP? 

--- Quote End ---  

Yes, the sockets API in lwIP is pretty close to standard. 

--- Quote Start ---  

 

 

3. If I wish to take data through Ethernet using lwip and after processing it ...i want to forward it to some other ip address or some other FPGA modules, does it required OS in between? 

--- Quote End ---  

No, lwIP works well without an OS and it's "RAW API" is very efficient. If you use sockets, of course you'll need 2 and have to pass data from one to the other. sockets do require an OS in lwIP - the RAW API does not, but does require you monitor a timer and do the TCP housekeeping by making calls to lwIP timing functions. I've posted a message on the lwip-users mailing list (see lwip on Savannah) on how to do this easily with no OS. 

 

You can use an OS and FreeRtos is used a lot by many lwIP users. 

 

Bill
0 Kudos
Altera_Forum
Honored Contributor II
395 Views

Thanx Bill, 

 

Could you please suggest me some document/web link, who put light on lwIP function Call's. 

 

kaushal
0 Kudos
Altera_Forum
Honored Contributor II
395 Views

 

--- Quote Start ---  

Thanx Bill, 

 

Could you please suggest me some document/web link, who put light on lwIP function Call's. 

 

kaushal 

--- Quote End ---  

 

 

https://savannah.nongnu.org/projects/lwip 

 

http://lwip.wikia.com/wiki/lwip_wiki 

 

Bill
0 Kudos
Altera_Forum
Honored Contributor II
395 Views

Dear Bill, 

 

I have Quartus 5.0 and NIOS-II (ver 1.1) and i am writing an application over uc/OS-II. 

now i am trying to add simple client application and before building the project i add the lwip software component but during compilation time it reflect following error's 

 

**** Incremental build of configuration Debug for project hello_ucosii_0 ****  

 

make -s all  

Compiling hello_ucosii.c...  

Linking hello_ucosii_0.elf...  

C:/altera/kits/nios2_60/examples/verilog/niosII_cyclone_1c20/standard/software/hello_ucosii_0_syslib/Debug/libhello_ucosii_0_syslib.a(altera_avalon_lan91c111 .o)(.text+0xd88): In function `low_level_init':  

/cygdrive/c/altera/kits/nios2_60/components/altera_avalon_lan91c111/UCOSII/src/altera_avalon_lan91c111.c:752: undefined reference to `get_mac_addr'  

C:/altera/kits/nios2_60/examples/verilog/niosII_cyclone_1c20/standard/software/hello_ucosii_0_syslib/Debug/libhello_ucosii_0_syslib.a(alt_lwip_dev.o)(.text+0 x230): In function `lwip_devices_init':  

/cygdrive/c/altera/kits/nios2_60/components/altera_lwip/UCOSII/src/alt_lwip_dev.c:165: undefined reference to `get_ip_addr'  

collect2: ld returned 1 exit status  

make: *** [hello_ucosii_0.elf] Error 1  

Build completed 

 

1.>i do not know how to add a simple client application over uc/OS, please help me out how to add this  

2.> what setting's i ave to do before writing client code. 

3.> what are the header files are required. 

 

when i add the ipport.h and tcpport.h file it generate the following errors (though i haven't yet add my c-code , i have just add the header file anly) 

**** Incremental build of configuration Debug for project hello_ucosii_0 ****  

 

make -s all  

Compiling hello_ucosii.c...  

../hello_ucosii.c:42:20: ipport.h: No such file or directory  

../hello_ucosii.c:43:21: tcpport.h: No such file or directory  

make: *** [obj/hello_ucosii.o] Error 1  

Build completed 

 

 

kaushal 

http://www.alteraforum.com/proweb/misc/progress.gif (http://www.alteraforum.com/forum/editpost.php?do=editpost&p=83099)
0 Kudos
Altera_Forum
Honored Contributor II
395 Views

 

--- Quote Start ---  

Dear Bill, 

 

I have Quartus 5.0 and NIOS-II (ver 1.1) and i am writing an application over uc/OS-II. 

now i am trying to add simple client application and before building the project i add the lwip software component but during compilation time it reflect following error's 

 

**** Incremental build of configuration Debug for project hello_ucosii_0 ****  

 

make -s all  

Compiling hello_ucosii.c...  

Linking hello_ucosii_0.elf...  

C:/altera/kits/nios2_60/examples/verilog/niosII_cyclone_1c20/standard/software/hello_ucosii_0_syslib/Debug/libhello_ucosii_0_syslib.a(altera_avalon_lan91c111 .o)(.text+0xd88): In function `low_level_init':  

/cygdrive/c/altera/kits/nios2_60/components/altera_avalon_lan91c111/UCOSII/src/altera_avalon_lan91c111.c:752: undefined reference to `get_mac_addr'  

C:/altera/kits/nios2_60/examples/verilog/niosII_cyclone_1c20/standard/software/hello_ucosii_0_syslib/Debug/libhello_ucosii_0_syslib.a(alt_lwip_dev.o)(.text+0 x230): In function `lwip_devices_init':  

/cygdrive/c/altera/kits/nios2_60/components/altera_lwip/UCOSII/src/alt_lwip_dev.c:165: undefined reference to `get_ip_addr'  

collect2: ld returned 1 exit status  

make: *** [hello_ucosii_0.elf] Error 1  

Build completed 

 

--- Quote End ---  

It sounds like you're missing the actual driver - usually in ethernetif.c - low_level_init and other functions particular to the 91C111 would be here. Search all of your files for low_level_init and be sure it's included in the project. 

 

--- Quote Start ---  

1.>i do not know how to add a simple client application over uc/OS, please help me out how to add this  

2.> what setting's i ave to do before writing client code. 

3.> what are the header files are required. 

 

--- Quote End ---  

 

Check the files on the sites I listed above. You need to get Ethernet working, and then a port of lwIP for uC/OS-II. You will probably find much more help on those sites than here. I have not used 9C111 or uC/OS-II with lwIP so I can't say much more about this configuration. 

 

--- Quote Start ---  

 

when i add the ipport.h and tcpport.h file it generate the following errors (though i haven't yet add my c-code , i have just add the header file anly) 

 

--- Quote End ---  

 

These files are files supplied and for use with InterNiche - do not mix TCP/IP stack source files! Either use InterNiche or lwIP. As InterNiche already supports uC/OS-II on the NIOS, why not use it? 

 

 

Bill
0 Kudos
Reply