balbekova 7 жил өмнө
parent
commit
bd6b598c1f

+ 1 - 1
Makefile

@@ -1,4 +1,4 @@
-TARGETS = projects/gcc/tools  modules service_hw  #iap
+TARGETS = projects/gcc/tools iap modules service_hw  #
 BUILDDIR = build
 
 .PHONY: all config $(TARGETS) tools distclean

+ 9 - 5
iap/Makefile

@@ -9,10 +9,13 @@ INCLUDES += -I.
 INCLUDES += -I../thirdparty/lwip/src/include
 INCLUDES += -I../thirdparty/lwip/src/include/netif
 INCLUDES += -I../thirdparty/lwip/src/include/lwip
-INCLUDES += -I../thirdparty/lwip/src/include/ipv4
-INCLUDES += -Ilwip/port/STM32F4x7
-INCLUDES += -Ilwip/port/STM32F4x7/Standalone
-INCLUDES += -Ilwip/port/STM32F4x7/arch
+INCLUDES += -I../thirdparty/lwip/src/include/lwip/apps
+#INCLUDES += -Ilwip/port/STM32F4x7
+#INCLUDES += -Ilwip/port/STM32F4x7/Standalone
+#INCLUDES += -Ilwip/port/STM32F4x7/arch
+INCLUDES += -I../thirdparty/lwip/port/Standalone
+INCLUDES += -I../thirdparty/lwip/system
+INCLUDES += -I../thirdparty/lwip/system/arch
 INCLUDES += -IModules
 INCLUDES += -IModules/Ethernet
 INCLUDES += -IModules/Console
@@ -30,7 +33,8 @@ CSRC += $(wildcard ../thirdparty/lwip/src/api/*.c)
 CSRC += $(wildcard ../thirdparty/lwip/src/core/*.c)
 CSRC += $(wildcard ../thirdparty/lwip/src/core/ipv4/*.c)
 CSRC += $(wildcard ../thirdparty/lwip/src/netif/*.c)
-CSRC += $(wildcard lwip/port/STM32F4x7/Standalone/*.c)
+#CSRC += $(wildcard lwip/port/STM32F4x7/Standalone/*.c)
+CSRC += $(wildcard ../thirdparty/lwip/port/Standalone/*.c)
 CSRC += $(wildcard Modules/*.c)
 CSRC += $(wildcard Modules/Ethernet/httpserver.c)
 CSRC += $(wildcard Modules/Ethernet/netconf.c)

+ 13 - 13
iap/Modules/Ethernet/netconf.c

@@ -1,20 +1,18 @@
 /* Includes ------------------------------------------------------------------*/
 #include "lwip/mem.h"
 #include "lwip/memp.h"
-#include "lwip/tcp.h"
-#include "lwip/tcp_impl.h"
-#include "lwip/udp.h"
-#include "netif/etharp.h"
 #include "lwip/dhcp.h"
-#include "lwip/ip_addr.h"
 #include "ethernetif.h"
+#include "tcpip.h"
 #include "main.h"
 #include "netconf.h"
 #include "common_config.h"
 #include "settings_api.h"
+#include "netconf.h"
 #include "tinystdio.h"
-#include "lwip/timers.h"
 #include "lwip/init.h"
+#include "lwip/timeouts.h"
+#include "netif/etharp.h"
 
 /* Private typedef -----------------------------------------------------------*/
 #define MAX_DHCP_TRIES        4
@@ -52,9 +50,9 @@ void LwIP_DHCP_Process_Handle(void);
   */
 void LwIP_Init(void)
 {
-  struct ip_addr ipaddr;
-  struct ip_addr netmask;
-  struct ip_addr gw;
+  struct ip4_addr ipaddr;
+  struct ip4_addr netmask;
+  struct ip4_addr gw;
   char str[20];
 
   lwip_init();
@@ -84,6 +82,7 @@ void LwIP_Init(void)
 
   netif_add(&netif, &ipaddr, &netmask, &gw, NULL, &ethernetif_init, &ethernet_input);
   netif_set_default(&netif);
+  netif_set_link_up(&netif);
   netif_set_up(&netif);
 }
 
@@ -167,9 +166,10 @@ void LwIP_Periodic_Handle(__IO uint32_t localtime)
   */
 void LwIP_DHCP_Process_Handle()
 {
-  struct ip_addr ipaddr;
-  struct ip_addr netmask;
-  struct ip_addr gw;
+  struct ip4_addr ipaddr;
+  struct ip4_addr netmask;
+  struct ip4_addr gw;
+  static uint8_t dhcpTry = 0;
 
   switch (DHCP_state)
   {
@@ -208,7 +208,7 @@ void LwIP_DHCP_Process_Handle()
 
       } else {
         /* DHCP timeout */
-        if (netif.dhcp->tries > MAX_DHCP_TRIES) 
+        if (dhcpTry++ > MAX_DHCP_TRIES)
 		{
           DHCP_state = DHCP_TIMEOUT;
 

+ 2 - 0
iap/Modules/Ethernet/netconf.h

@@ -45,6 +45,8 @@
 #ifndef __NETCONF_H
 #define __NETCONF_H
 
+#include "stm32f4xx.h"
+
 #ifdef __cplusplus
  extern "C" {
 #endif