Forum Discussion
Altera_Forum
Honored Contributor
16 years agoAltera TSE driver and example program for lwIP (1.3.2)
After many many requests and complaints about lack of support and/or documentation for support of lwIP for the Altera TSE, I have developed a drop-in TSE driver and example program and made this available to the NIOS II community. This was done for NIOS II 8.1 SP0.01. I don't expect difficulty with version 9.x.
This is for the latest version of lwIP (the latest is as of this post) for a minimal program and HTTP server based on the http server in the lwIP contrib folder. The lwIP TSE driver uses the altera_avalon_tse driver and SGDMA as-is. There is a complete (as in 41-step) set of instructions on creating the project and example program. More information and the link to the driver is available here: http://lwip.wikia.com/wiki/available_device_drivers#lwip_1.3.2 Please direct any questions, changes for NIOS II 9.1, or comments to this thread. 12-16-2010 update: This example works with NIOS Version 10.0 with some tweaks to the procedure to create the project. Also, a lwIP 1.4 release candidate has been out for a while and it drops into this example (in place of 1.3) without changes. Bill257 Replies
- Altera_Forum
Honored Contributor
--- Quote Start --- actually i have my sgdma Tx and sgdma Rx mapped on a DDR , the same DDR where the CPU data an instruction is mapped. --- Quote End --- I'm almost positive that this can't work. Every example I've seen has SGDMA writing to onchip memory. --- Quote Start --- Now imagine i want to use an onchip ram for sgdma tx and sgdmarx instead of DDR. (but CPU still mapped to DDR) --- Quote End --- I would agree with this too. :-) --- Quote Start --- I tried direclty but this is not working. if you have any idea . --- Quote End --- Maybe it's not working for a non-SGDMA or memory reason. Compare to an example (e.g. the Altera NEEK development kit Ethernet code) and see if you're in the ballpark setting-wise. Bill A. - Altera_Forum
Honored Contributor
Thanks BillA,
My problem was solved by using an equivalent SOPC as in Altera NEEK development kit Ethernet code. thanks for the idea . Laurent - Altera_Forum
Honored Contributor
Hi,
Just want to say that the example compiles under 12.1 with no effort. Then a question, i am getting a code size of 180KB. I have not started tuning the code yet, but do any of you thinks it's possible to get down to 30-40Kb for a simple telnet server? I need a small footprint to get it into internal mem. Would make our life much easier. Apus - Altera_Forum
Honored Contributor
--- Quote Start --- Then a question, i am getting a code size of 180KB. I have not started tuning the code yet, but do any of you thinks it's possible to get down to 30-40Kb for a simple telnet server? I need a small footprint to get it into internal mem. Would make our life much easier. --- Quote End --- My guess as a long-time user of lwIP (going back 10 years now) is that 30-40k will not likely be possible. TCP takes up a good bit of code. I could see 60k possibly. If you find out the smallest you can make it, please post back so others will know what is the smallest possible footprint. Bill A. - Altera_Forum
Honored Contributor
Hi,
I have read through several threads on the subject but haven't been able to find the answer I am looking for. I would like to use lwIP with Altera TSE with no OS to receive TCP. I need to support about 10MB/s (80 Mb/s) shared between multiple TCP connections. There is very little other processing on the NIOS II/f. From reading it seems that if I do the following: 1) Run out of on chip memory. 2) Increase Processor clock speed as much as possible (Using Stratix IV) 3) Add TCP checksum offloading 4) possibly some other optimizations like endian conversion then i should be able to reach that speed but I was wondering if anyone could give me a more firm answer of if this is feasible or not. Thanks, Arthur - Altera_Forum
Honored Contributor
--- Quote Start --- Hi, I have read through several threads on the subject but haven't been able to find the answer I am looking for. I would like to use lwIP with Altera TSE with no OS to receive TCP. I need to support about 10MB/s (80 Mb/s) shared between multiple TCP connections. There is very little other processing on the NIOS II/f. From reading it seems that if I do the following: 1) Run out of on chip memory. --- Quote End --- I would run just select parts - inet_chksum, some of ethernetif, and maybe the oft-used pbuf functions. For a start, move nothing and see how it goes. It's so easy to move functions to on-chip memory there's no urgency to do that up front. And use code and data cache. 4k each if you can. --- Quote Start --- 2) Increase Processor clock speed as much as possible (Using Stratix IV) 3) Add TCP checksum offloading --- Quote End --- This is the biggest thing you can do. If not in hardware, using assembly for the checksum is still good. And an optimized memcpy too! The built-in memcpy is OK but can be better. Oh, and the macro SMEMCPY replace with an inline copy - it's always a small copy with a constant size. --- Quote Start --- 4) possibly some other optimizations like endian conversion --- Quote End --- For Cyclone-III the endian opcodes are included for htonl/ntohl. There was none for hton/ntoh - we did our own but I don't know if it's really used enough to matter. --- Quote Start --- then i should be able to reach that speed but I was wondering if anyone could give me a more firm answer of if this is feasible or not. --- Quote End --- Yes, it's feasible. Close but I see not much reason for it not to work. Bill A - Altera_Forum
Honored Contributor
Thanks! Thats a big help and exactly what I was looking for.
- Altera_Forum
Honored Contributor
Hello fellow adventurers,
I am currently trying to port the FreeRTOS+lwIP environment onto the Stratix-V fpga eval board under the Quartus-II 13.0sp1 toolset. I've already ran into a number of issues, but so far managed to plow through most (tool name changes, some FreeRTOS/lwIP syntax changes after upgrading to latest, etc..). I was wondering if anyone else has tried running FreeRTOS+lwIP on Stratix V eval board, and if so, how successful were you? I am happy to provide feedback/share my findings (assuming we don't scrap this approach and go with Micrium+NicheStack... not my preferred choice). Thanks for your help! sjp - Altera_Forum
Honored Contributor
The following optimization can be applied to lwip_tse_mac.c:
In function tse_sgdmaRx_isr: Replace the init_tset_descriptor function call (spans 6 or 7 lines) just after label _dump: with the following: IOWR_32DIRECT(&tse_ptr->desc[ALTERA_TSE_FIRST_RX_SGDMA_DESC_OFST].write_addr, 0, (u32_t) ethernetif->lwip_rx_pbuf[ethernetif->lwipRxIndexIsr]->payload); IOWR_8DIRECT(&tse_ptr->desc[ALTERA_TSE_FIRST_RX_SGDMA_DESC_OFST].control, 0, ALTERA_AVALON_SGDMA_DESCRIPTOR_CONTROL_OWNED_BY_HW_MSK); I don't claim credit for this - I see they did this in the NIOS 12.1 TSE driver and it makes a lot of sense. Bill A - Altera_Forum
Honored Contributor
--- Quote Start --- You can use the one that the dev kit will use when running e.g. the Interniche examples. If it doesn't come with a MAC address, you will have to use a temporary one but be sure to stay behind a router or directly connected to a PC. I use a real test MAC address from our block of addresses that I know is not in use locally. Bill --- Quote End --- ims,can you send your project to me ?I have the same problem with you.my email is [email protected],thanks!