static/DHCP networking with LWIP
I generally want to support both static/auto/dhcp in software config. This is most easily done by changing LWIP.c
Around line 62:
/* IP addresses initialization with DHCP (IPv4) */
ipaddr.addr = gstate.ipaddr; // NOT 0
netmask.addr = gstate.netmask; // NOT 0
gw.addr = gstate.gwaddr; // NOT 0
Around 92
if (gstate.dhcp) {
dhcp_start(&gnetif);
}
else
{
ipaddr.addr = gstate.ipaddr;
netmask.addr = gstate.netmask;
gw.addr = gstate.gwaddr;
dhcp_stop(&gnetif);
netif_set_down(&gnetif);
netif_set_addr(&gnetif, &ipaddr, &netmask, &gw);
if (netif_is_link_up(&gnetif))
{
/* When the netif is fully configured this function must be called */
netif_set_up(&gnetif);
}
}
However such changed keep getting trampled on by code generation when I update STM32Cube. Is there any way to protect changes so they don't get overwritten?
I appreciate that to support either Static or DHCP this is a config option in the code generator, but I generally want to support everything I can!
Alan
