UltimaSerial Tech Blog: How to upgrade lwIP in AVR32 Framework to the latest version

Data logger
UltimaSerial

 

Windaq add-ons
Windaq Add-ons

 

Spectrogram
UltimaWaterfall

 

Ultimaserial XChart
XChart

 

FFT1024
FFT1024

 

Ultimaserial Classroom
Lessons

The AVR32 port of the lwIP 1.3.0  is old and buggy, so we need to upgrade it to the latest rev. 

Assume your project is named as MyProject

  1. Download the source codes of the latest lwIP from http://mirrors.igsobe.com/nongnu/lwip/

  2. Extract it to a folder, say lwip-1.3.0. I am keeping the same name as the one in AVR32 Framework to minimize any confusion.

  3. If you modified any source of lwip in your project, write them down

  4. Export your current project following AVR32 Studio->Project Explorer->YourProject->Export...->ArchiveFile, with the name of B4IUpgradelwIP.zip

  5. Follow AVR32 Studio->File->Switch Workspace->Others->Browse to create a new folder to host the new workspace so that we won't mess up the original project by accident. 

  6. Follow AVR32 Studio->Project Explorer->Import...->General->Existing Projects in Workspace->Select archive file to bring the archive created in step 4 to the new workspace created in 5. Follow 

  7. Follow AVR32 Studio-> Project Explorer->MyProject->src->SOFTWARE_FRAMEWORK->SERVICES and delete the folder for lwip-1.3.0

  8. Drag the folder lwip-1.3.0 created in step 2 and drop it under AVR32 Studio-> Project Explorer->MyProject->src->SOFTWARE_FRAMEWORK->SERVICES

  9. Delete test folder under AVR32 Studio-> Project Explorer->MyProject->src->SOFTWARE_FRAMEWORK->SERVICES->lwip-1.3.0

  10. In AVR32 Studio-> Project Explorer->MyProject->src->NETWORK->lwip-port->AT32UC32A->netif->ethernetif.c, change if( ERR_OK != ethernet_intput->input( p, netif ) ) to if( ERR_OK != netif->input( p, netif ) ). See the similar section in the source of AVR32 Studio-> Project Explorer->MyProject->src->SOFTWARE_FRAMEWORK->SERVICES->lwip-1.3.0->netif->ethernetif.c for reference

    • Here is a comment from Simon from lwIP forum: netif->input is the function passed to netif_add. For NO_SYS==1, there is no difference: you will pass ethernet_input to netif_add. However, for NO_SYS==0, you will pass tcpip_input to netif_add, which means there's a thread change into the tcpip_thread before calling ethernet_input. Without this, there can be multiple threads active in the core code, which is bound to lead to problems sooner or later.

  11. Bring back you customization to the previous rev, which was recorded in step 3

  12. Double check the following folders to see if any new compatibility issue may arise due to version upgrade

    1. AVR32 Studio-> Project Explorer->MyProject->src->CONFIG->lwipopts.h

    2. AVR32 Studio-> Project Explorer->MyProject->src->NETWORK->lwip-port->AT32UC3A

  13. Your project should be able to compile at this point. If not, clean up the errors.