diff --git a/mongoose.c b/mongoose.c index 69875cea..08ddf035 100644 --- a/mongoose.c +++ b/mongoose.c @@ -2953,6 +2953,7 @@ void mg_error(struct mg_connection *c, const char *fmt, ...) { + #ifdef MG_OTA_PUBLIC_KEY @@ -9809,6 +9810,10 @@ void mg_multicast_restore(struct mg_connection *c, uint8_t *from) { + + + + #if MG_ENABLE_TCPIP #define MG_EPHEMERAL_PORT_BASE 32768 #define PDIFF(a, b) ((size_t) (((char *) (b)) - ((char *) (a)))) @@ -14455,6 +14460,7 @@ struct mg_flash *mg_flash = &s_mg_flash_frdm; + #if MG_OTA == MG_OTA_STM32F static bool mg_stm32f_write(void *, const void *, size_t); @@ -14710,6 +14716,7 @@ struct mg_flash *mg_flash = &s_mg_flash_stm32f; + #if MG_OTA == MG_OTA_STM32H5 || MG_OTA == MG_OTA_STM32C5 static bool mg_stm32h5_write(void *, const void *, size_t); @@ -14883,6 +14890,7 @@ struct mg_flash *mg_flash = &s_mg_flash_stm32h5; + #if MG_OTA == MG_OTA_STM32H7 || MG_OTA == MG_OTA_STM32H7_DUAL_CORE // - H723/735 RM 4.3.3: Note: The application can simultaneously request a read @@ -34256,6 +34264,8 @@ bool __attribute__((weak)) mg_wifi_ap_stop(void) { #endif + + enum { // ID1 ID2 MG_PHY_KSZ8x = 0x22, // 0022 156x - KSZ8081RNB, KSZ8091RNB MG_PHY_DP83x = 0x2000, @@ -36580,6 +36590,9 @@ bool mg_wifi_ap_stop(void) { #endif + + + #if MG_ENABLE_TCPIP && defined(MG_ENABLE_DRIVER_STM32F) && \ MG_ENABLE_DRIVER_STM32F struct stm32f_eth { @@ -36832,6 +36845,8 @@ struct mg_tcpip_driver mg_tcpip_driver_stm32f = { #endif + + #if MG_ENABLE_TCPIP && (MG_ENABLE_DRIVER_STM32H || MG_ENABLE_DRIVER_MCXN || \ MG_ENABLE_DRIVER_STM32N) // STM32C: vendor modded single-queue Synopsys v5.4, same settings as STM32H diff --git a/mongoose.h b/mongoose.h index 381ada8d..77c0bcd2 100644 --- a/mongoose.h +++ b/mongoose.h @@ -4846,6 +4846,8 @@ void mg_tcpip_qwrite(void *buf, size_t len, struct mg_tcpip_if *ifp); // broadcast, or a non-NULL hint to set the target MAC field in the request. void mg_tcpip_arp_request(struct mg_tcpip_if *ifp, uint32_t ip, uint8_t *mac); +extern uint8_t mcast_addr[6]; // Multicast MAC address programmed by drivers + // Built-in hardware drivers. Assign one to mg_tcpip_if.driver before calling // mg_tcpip_init(). See the matching driver header for configuration and // initialisation helpers. @@ -6067,6 +6069,8 @@ extern struct mg_tcpip_driver mg_tcpip_driver_stm32f; #endif #if MG_ENABLE_DRIVER_STM32H || MG_ENABLE_DRIVER_MCXN || MG_ENABLE_DRIVER_STM32N + + struct mg_tcpip_driver_stm32h_data { // MDC clock divider. MDC clock is derived from HCLK, must not exceed 2.5MHz // HCLK range DIVIDER mdc_cr VALUE diff --git a/src/drivers/phy.c b/src/drivers/phy.c index 60eeafac..21730a49 100644 --- a/src/drivers/phy.c +++ b/src/drivers/phy.c @@ -1,4 +1,6 @@ #include "phy.h" +#include "log.h" +#include "util.h" enum { // ID1 ID2 MG_PHY_KSZ8x = 0x22, // 0022 156x - KSZ8081RNB, KSZ8091RNB diff --git a/src/drivers/stm32f.c b/src/drivers/stm32f.c index edcc1df6..a303f059 100644 --- a/src/drivers/stm32f.c +++ b/src/drivers/stm32f.c @@ -1,4 +1,7 @@ #include "net_builtin.h" +#include "log.h" +#include "phy.h" +#include "util.h" #if MG_ENABLE_TCPIP && defined(MG_ENABLE_DRIVER_STM32F) && \ MG_ENABLE_DRIVER_STM32F diff --git a/src/drivers/stm32h.c b/src/drivers/stm32h.c index 72a2297f..80abb704 100644 --- a/src/drivers/stm32h.c +++ b/src/drivers/stm32h.c @@ -1,4 +1,6 @@ #include "net_builtin.h" +#include "log.h" +#include "util.h" #if MG_ENABLE_TCPIP && (MG_ENABLE_DRIVER_STM32H || MG_ENABLE_DRIVER_MCXN || \ MG_ENABLE_DRIVER_STM32N) diff --git a/src/drivers/stm32h.h b/src/drivers/stm32h.h index c25e3cae..4a1259fa 100644 --- a/src/drivers/stm32h.h +++ b/src/drivers/stm32h.h @@ -19,6 +19,8 @@ #endif #if MG_ENABLE_DRIVER_STM32H || MG_ENABLE_DRIVER_MCXN || MG_ENABLE_DRIVER_STM32N +#include "phy.h" + struct mg_tcpip_driver_stm32h_data { // MDC clock divider. MDC clock is derived from HCLK, must not exceed 2.5MHz // HCLK range DIVIDER mdc_cr VALUE diff --git a/src/flash.c b/src/flash.c index d9bc3061..0c4bb53a 100644 --- a/src/flash.c +++ b/src/flash.c @@ -2,6 +2,7 @@ #include "flash.h" #include "log.h" #include "ota.h" +#include "util.h" #ifdef MG_OTA_PUBLIC_KEY #include "sha256.h" #include "tls_p256.h" diff --git a/src/net_builtin.c b/src/net_builtin.c index f8c8f313..4c24b286 100644 --- a/src/net_builtin.c +++ b/src/net_builtin.c @@ -1,6 +1,10 @@ #include "net_builtin.h" #include "bsd.h" +#include "mdash.h" +#include "ota.h" +#include "printf.h" #include "profile.h" +#include "tls.h" #if MG_ENABLE_TCPIP #define MG_EPHEMERAL_PORT_BASE 32768 diff --git a/src/net_builtin.h b/src/net_builtin.h index 43d3f7b3..6fcb6c35 100644 --- a/src/net_builtin.h +++ b/src/net_builtin.h @@ -132,6 +132,8 @@ void mg_tcpip_qwrite(void *buf, size_t len, struct mg_tcpip_if *ifp); // broadcast, or a non-NULL hint to set the target MAC field in the request. void mg_tcpip_arp_request(struct mg_tcpip_if *ifp, uint32_t ip, uint8_t *mac); +extern uint8_t mcast_addr[6]; // Multicast MAC address programmed by drivers + // Built-in hardware drivers. Assign one to mg_tcpip_if.driver before calling // mg_tcpip_init(). See the matching driver header for configuration and // initialisation helpers. diff --git a/src/ota_stm32f.c b/src/ota_stm32f.c index a353f70a..9810393c 100644 --- a/src/ota_stm32f.c +++ b/src/ota_stm32f.c @@ -1,6 +1,7 @@ #include "flash.h" #include "log.h" #include "ota.h" +#include "util.h" #if MG_OTA == MG_OTA_STM32F diff --git a/src/ota_stm32h5.c b/src/ota_stm32h5.c index f6ad9e1e..49d88774 100644 --- a/src/ota_stm32h5.c +++ b/src/ota_stm32h5.c @@ -1,6 +1,7 @@ #include "flash.h" #include "log.h" #include "ota.h" +#include "util.h" #if MG_OTA == MG_OTA_STM32H5 || MG_OTA == MG_OTA_STM32C5 diff --git a/src/ota_stm32h7.c b/src/ota_stm32h7.c index 4c586c14..3b9ba686 100644 --- a/src/ota_stm32h7.c +++ b/src/ota_stm32h7.c @@ -1,6 +1,7 @@ #include "flash.h" #include "log.h" #include "ota.h" +#include "util.h" #if MG_OTA == MG_OTA_STM32H7 || MG_OTA == MG_OTA_STM32H7_DUAL_CORE