Compare commits
12 Commits
FIxedwiz_c
...
181cfae6cc
Author | SHA1 | Date | |
---|---|---|---|
181cfae6cc
|
|||
7f58783400
|
|||
cae27e3acb | |||
0446055537
|
|||
a33e0f8381
|
|||
46df6545d9
|
|||
727db71b79
|
|||
4c75a8fa48
|
|||
5323a6d8e4
|
|||
8db71e5eb4
|
|||
![]() |
cbf5b6e908 | ||
![]() |
0bad15ab48 |
4
.gitignore
vendored
4
.gitignore
vendored
@@ -1,3 +1,7 @@
|
|||||||
|
# Wolfgangs own stuff
|
||||||
|
build
|
||||||
|
w5500.a
|
||||||
|
|
||||||
# Windows image file caches
|
# Windows image file caches
|
||||||
Thumbs.db
|
Thumbs.db
|
||||||
ehthumbs.db
|
ehthumbs.db
|
||||||
|
@@ -80,7 +80,7 @@ void wizchip_cris_exit(void) {}
|
|||||||
* null function is called.
|
* null function is called.
|
||||||
*/
|
*/
|
||||||
//void wizchip_cs_select(void) {};
|
//void wizchip_cs_select(void) {};
|
||||||
void wizchip_cs_select(void) {}
|
__attribute__((weak)) void wizchip_cs_select(void) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Default function to deselect chip.
|
* @brief Default function to deselect chip.
|
||||||
@@ -88,7 +88,7 @@ void wizchip_cs_select(void) {}
|
|||||||
* null function is called.
|
* null function is called.
|
||||||
*/
|
*/
|
||||||
//void wizchip_cs_deselect(void) {};
|
//void wizchip_cs_deselect(void) {};
|
||||||
void wizchip_cs_deselect(void) {}
|
__attribute__((weak)) void wizchip_cs_deselect(void) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Default function to read in direct or indirect interface.
|
* @brief Default function to read in direct or indirect interface.
|
||||||
@@ -114,7 +114,7 @@ void wizchip_bus_writedata(uint32_t AddrSel, iodata_t wb) { *((volatile iodata
|
|||||||
* null function is called.
|
* null function is called.
|
||||||
*/
|
*/
|
||||||
//uint8_t wizchip_spi_readbyte(void) {return 0;};
|
//uint8_t wizchip_spi_readbyte(void) {return 0;};
|
||||||
uint8_t wizchip_spi_readbyte(void) {return 0;}
|
__attribute__((weak)) uint8_t wizchip_spi_readbyte(void) {return 0;}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Default function to write in SPI interface.
|
* @brief Default function to write in SPI interface.
|
||||||
@@ -122,7 +122,7 @@ uint8_t wizchip_spi_readbyte(void) {return 0;}
|
|||||||
* null function is called.
|
* null function is called.
|
||||||
*/
|
*/
|
||||||
//void wizchip_spi_writebyte(uint8_t wb) {};
|
//void wizchip_spi_writebyte(uint8_t wb) {};
|
||||||
void wizchip_spi_writebyte(uint8_t wb) {}
|
__attribute__((weak)) void wizchip_spi_writebyte(uint8_t wb) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Default function to burst read in SPI interface.
|
* @brief Default function to burst read in SPI interface.
|
||||||
@@ -130,7 +130,7 @@ void wizchip_spi_writebyte(uint8_t wb) {}
|
|||||||
* null function is called.
|
* null function is called.
|
||||||
*/
|
*/
|
||||||
//void wizchip_spi_readburst(uint8_t* pBuf, uint16_t len) {};
|
//void wizchip_spi_readburst(uint8_t* pBuf, uint16_t len) {};
|
||||||
void wizchip_spi_readburst(uint8_t* pBuf, uint16_t len) {}
|
__attribute__((weak)) void wizchip_spi_readburst(uint8_t* pBuf, uint16_t len) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Default function to burst write in SPI interface.
|
* @brief Default function to burst write in SPI interface.
|
||||||
@@ -138,7 +138,7 @@ void wizchip_spi_readburst(uint8_t* pBuf, uint16_t len) {}
|
|||||||
* null function is called.
|
* null function is called.
|
||||||
*/
|
*/
|
||||||
//void wizchip_spi_writeburst(uint8_t* pBuf, uint16_t len) {};
|
//void wizchip_spi_writeburst(uint8_t* pBuf, uint16_t len) {};
|
||||||
void wizchip_spi_writeburst(uint8_t* pBuf, uint16_t len) {}
|
__attribute__((weak)) void wizchip_spi_writeburst(uint8_t* pBuf, uint16_t len) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @\ref _WIZCHIP instance
|
* @\ref _WIZCHIP instance
|
||||||
|
@@ -71,6 +71,10 @@ extern "C" {
|
|||||||
#define W5300 5300
|
#define W5300 5300
|
||||||
#define W5500 5500
|
#define W5500 5500
|
||||||
|
|
||||||
|
|
||||||
|
#define _WIZCHIP_ W5500
|
||||||
|
|
||||||
|
|
||||||
#ifndef _WIZCHIP_
|
#ifndef _WIZCHIP_
|
||||||
#define _WIZCHIP_ W5100S // W5100, W5100S, W5200, W5300, W5500
|
#define _WIZCHIP_ W5100S // W5100, W5100S, W5200, W5300, W5500
|
||||||
#endif
|
#endif
|
||||||
|
@@ -601,7 +601,9 @@ int8_t parseDHCPMSG(void)
|
|||||||
printf("DHCP message : %d.%d.%d.%d(%d) %d received. \r\n",svr_addr[0],svr_addr[1],svr_addr[2], svr_addr[3],svr_port, len);
|
printf("DHCP message : %d.%d.%d.%d(%d) %d received. \r\n",svr_addr[0],svr_addr[1],svr_addr[2], svr_addr[3],svr_port, len);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else return 0;
|
else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
if (svr_port == DHCP_SERVER_PORT) {
|
if (svr_port == DHCP_SERVER_PORT) {
|
||||||
// compare mac address
|
// compare mac address
|
||||||
if ( (pDHCPMSG->chaddr[0] != DHCP_CHADDR[0]) || (pDHCPMSG->chaddr[1] != DHCP_CHADDR[1]) ||
|
if ( (pDHCPMSG->chaddr[0] != DHCP_CHADDR[0]) || (pDHCPMSG->chaddr[1] != DHCP_CHADDR[1]) ||
|
||||||
@@ -946,7 +948,12 @@ void DHCP_init(uint8_t s, uint8_t * buf)
|
|||||||
DHCP_SOCKET = s; // SOCK_DHCP
|
DHCP_SOCKET = s; // SOCK_DHCP
|
||||||
pDHCPMSG = (RIP_MSG*)buf;
|
pDHCPMSG = (RIP_MSG*)buf;
|
||||||
DHCP_XID = 0x12345678;
|
DHCP_XID = 0x12345678;
|
||||||
|
{
|
||||||
|
DHCP_XID += DHCP_CHADDR[3];
|
||||||
|
DHCP_XID += DHCP_CHADDR[4];
|
||||||
|
DHCP_XID += DHCP_CHADDR[5];
|
||||||
|
DHCP_XID += (DHCP_CHADDR[3] ^ DHCP_CHADDR[4] ^ DHCP_CHADDR[5]);
|
||||||
|
}
|
||||||
// WIZchip Netinfo Clear
|
// WIZchip Netinfo Clear
|
||||||
setSIPR(zeroip);
|
setSIPR(zeroip);
|
||||||
setGAR(zeroip);
|
setGAR(zeroip);
|
||||||
|
@@ -539,7 +539,7 @@ int8_t DNS_run(uint8_t * dns_ip, uint8_t * name, uint8_t * ip_from_dns)
|
|||||||
#ifdef _DNS_DEBUG_
|
#ifdef _DNS_DEBUG_
|
||||||
printf("> DNS Server is not responding : %d.%d.%d.%d\r\n", dns_ip[0], dns_ip[1], dns_ip[2], dns_ip[3]);
|
printf("> DNS Server is not responding : %d.%d.%d.%d\r\n", dns_ip[0], dns_ip[1], dns_ip[2], dns_ip[3]);
|
||||||
#endif
|
#endif
|
||||||
wizchip_close(DNS_SOCKET);
|
close(DNS_SOCKET);
|
||||||
return 0; // timeout occurred
|
return 0; // timeout occurred
|
||||||
}
|
}
|
||||||
else if (ret_check_timeout == 0) {
|
else if (ret_check_timeout == 0) {
|
||||||
|
77
Makefile
Normal file
77
Makefile
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
WIZCHIP=W5500
|
||||||
|
ENABLE_DHCP=yes
|
||||||
|
ENABLE_DNS=yes
|
||||||
|
ENABLE_HTTPSERVER=yes
|
||||||
|
ENABLE_MQTT=yes
|
||||||
|
ENABLE_SNTP=yes
|
||||||
|
|
||||||
|
# =====================================================================
|
||||||
|
|
||||||
|
|
||||||
|
#arm-none-eabi-gcc -c -mcpu=cortex-m3 -mthumb -DUSE_HAL_DRIVER -DSTM32F103xE
|
||||||
|
#-Ihottislib -Ilibmbus -IioLibrary_Driver/Ethernet -IUser/Inc -ICore/Inc
|
||||||
|
#-IDrivers/STM32F1xx_HAL_Driver/Inc -IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy
|
||||||
|
#-IDrivers/CMSIS/Device/ST/STM32F1xx/Include -IDrivers/CMSIS/Include -IDrivers/CMSIS/Include
|
||||||
|
#-Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/logger.d"
|
||||||
|
#-Wa,-a,-ad,-alms=build/logger.lst User/Src/logger.c -o build/logger.o
|
||||||
|
CFLAGS=-mcpu=cortex-m3 -mthumb -Og -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP
|
||||||
|
|
||||||
|
CC=arm-none-eabi-gcc
|
||||||
|
AR=arm-none-eabi-ar
|
||||||
|
|
||||||
|
CFLAGS+=-iquote Ethernet -Wall -D_WIZCHIP_=$(WIZCHIP)
|
||||||
|
|
||||||
|
OBJDIR=build
|
||||||
|
VPATH=Ethernet:Ethernet/W5500
|
||||||
|
ifeq ($(ENABLE_DHCP),yes)
|
||||||
|
VPATH+=Internet/DHCP
|
||||||
|
endif
|
||||||
|
ifeq ($(ENABLE_DNS),yes)
|
||||||
|
VPATH+=Internet/DNS
|
||||||
|
endif
|
||||||
|
ifeq ($(ENABLE_MQTT),yes)
|
||||||
|
VPATH+=Internet/MQTT:Internet/MQTT/MQTTPacket/src
|
||||||
|
endif
|
||||||
|
ifeq ($(ENABLE_HTTPSERVER),yes)
|
||||||
|
VPATH+=Internet/httpServer
|
||||||
|
endif
|
||||||
|
ifeq ($(ENABLE_SNTP),yes)
|
||||||
|
VPATH+=Internet/SNTP
|
||||||
|
endif
|
||||||
|
|
||||||
|
OBJS=$(addprefix $(OBJDIR)/,wizchip_conf.o socket.o w5500.o)
|
||||||
|
ifeq ($(ENABLE_DHCP),yes)
|
||||||
|
OBJS+=$(addprefix $(OBJDIR)/,dhcp.o)
|
||||||
|
endif
|
||||||
|
ifeq ($(ENABLE_DNS),yes)
|
||||||
|
OBJS+=$(addprefix $(OBJDIR)/,dns.o)
|
||||||
|
endif
|
||||||
|
ifeq ($(ENABLE_HTTPSERVER),yes)
|
||||||
|
OBJS+=$(addprefix $(OBJDIR)/,httpParser.o httpServer.o httpUtil.o)
|
||||||
|
endif
|
||||||
|
ifeq ($(ENABLE_SNTP),yes)
|
||||||
|
OBJS+=$(addprefix $(OBJDIR)/,sntp.o)
|
||||||
|
endif
|
||||||
|
ifeq ($(ENABLE_MQTT),yes)
|
||||||
|
OBJS+=$(addprefix $(OBJDIR)/,MQTTConnectClient.o MQTTConnectServer.o MQTTDeserializePublish.o \
|
||||||
|
MQTTFormat.o MQTTPacket.o MQTTSerializePublish.o MQTTSubscribeClient.o MQTTSubscribeServer.o \
|
||||||
|
MQTTUnsubscribeClient.o MQTTUnsubscribeServer.o mqtt_interface.o MQTTClient.o)
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
all: $(OBJS)
|
||||||
|
$(AR) rcs w5500.a $^
|
||||||
|
|
||||||
|
$(OBJDIR)/%.o: %.c
|
||||||
|
$(CC) $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
|
$(OBJS): | $(OBJDIR)
|
||||||
|
|
||||||
|
$(OBJDIR):
|
||||||
|
mkdir $(OBJDIR)
|
||||||
|
|
||||||
|
.PHONY: clean
|
||||||
|
clean:
|
||||||
|
-rm -rf $(OBJDIR)
|
Reference in New Issue
Block a user