Question:
In VDSP, can we switch between DHCP and static IP at run time
Answer:
By default it is not possible to change the configuration from DHCP to static IP on the fly, but we believe it would be possible to revert to a static IP upon DHCP failure. We need to configure by changing sources according to your requirements. In the lwip_sysboot_threadtype.c, "start_stack()" launches the dhcp client and gets the DHCP address if user chooses to use DHCP(default behavior). The obtained address is placed in a structure called netinfo.netif[].
If the user chooses to configure IP manually, user chosen IP/Gateway addresses will be copied into netinfo.netif[] structure (see the "init_stack()" function).
In VisualDSP sethostaddr() call is provided to set the IP address. This call takes the network interface number and the IP address string. Default network interface number is 0. So you can use sethostipaddr(0,"192.168.1.1") to set target IP address. Alternatively, you can directly access the netinfo.netif[] structure to set the IP Address.
Most of the code pertaining to IP configuration is present in "...\Blackfin\lib\src\lwip\contrib\ports\ADSP-Blackfin\proj\arch-VDK\pkthandler.c", which may also need modification. We provide projects for rebuilding the Libraries in "...\Blackfin\lib\src\lwip\contrib\ports\ADSP-Blackfin\proj\lwIPv4lib\".