@@ -168,13 +168,19 @@ extern "C" {
168168#endif
169169#endif
170170
171+ #ifndef MG_TLS
172+ #define MG_TLS MG_TLS_BUILTIN
173+ #endif
174+
171175#if !defined(MG_OTA) && defined(STM32F1) || defined(STM32F2) || defined(STM32F4) || defined(STM32F7)
172176#define MG_OTA MG_OTA_STM32F
173177#elif !defined(MG_OTA) && defined(STM32H5)
174178#define MG_OTA MG_OTA_STM32H5
175179#elif !defined(MG_OTA) && defined(STM32H7)
176180#define MG_OTA MG_OTA_STM32H7
177181#endif
182+ // use HAL-defined execute-in-ram section
183+ #define MG_IRAM __attribute__ ((section(" .RamFunc" )))
178184
179185#ifndef STM32H5
180186#define HAL_ICACHE_IsEnabled () 0
@@ -3486,6 +3492,12 @@ struct mg_tcpip_driver_stm32f_data {
34863492#define MG_DRIVER_MDC_CR 4
34873493#endif
34883494
3495+ #if MG_ARCH == MG_ARCH_CUBE
3496+ #define MG_NEIRQ NVIC_EnableIRQ (ETH_IRQn)
3497+ #else
3498+ #define MG_NEIRQ
3499+ #endif
3500+
34893501#define MG_TCPIP_DRIVER_INIT (mgr ) \
34903502 do { \
34913503 static struct mg_tcpip_driver_stm32f_data driver_data_; \
@@ -3498,8 +3510,8 @@ struct mg_tcpip_driver_stm32f_data {
34983510 mif_.driver = &mg_tcpip_driver_stm32f; \
34993511 mif_.driver_data = &driver_data_; \
35003512 MG_SET_MAC_ADDRESS (mif_.mac ); \
3513+ MG_NEIRQ ; \
35013514 mg_tcpip_init (mgr, &mif_); \
3502- NVIC_EnableIRQ (ETH_IRQn); \
35033515 MG_INFO ((" Driver: stm32f, MAC: %M" , mg_print_mac, mif_.mac )); \
35043516 } while (0 )
35053517
@@ -3546,6 +3558,12 @@ struct mg_tcpip_driver_stm32h_data {
35463558#define MG_DRIVER_MDC_CR 4
35473559#endif
35483560
3561+ #if MG_ENABLE_DRIVER_STM32H && MG_ARCH == MG_ARCH_CUBE
3562+ #define MG_NEIRQ NVIC_EnableIRQ (ETH_IRQn)
3563+ #else
3564+ #define MG_NEIRQ
3565+ #endif
3566+
35493567#define MG_TCPIP_DRIVER_INIT (mgr ) \
35503568 do { \
35513569 static struct mg_tcpip_driver_stm32h_data driver_data_; \
@@ -3560,7 +3578,7 @@ struct mg_tcpip_driver_stm32h_data {
35603578 mif_.driver_data = &driver_data_; \
35613579 MG_SET_MAC_ADDRESS (mif_.mac ); \
35623580 mg_tcpip_init (mgr, &mif_); \
3563- NVIC_EnableIRQ (ETH_IRQn); \
3581+ MG_NEIRQ ; \
35643582 MG_INFO ((" Driver: stm32h, MAC: %M" , mg_print_mac, mif_.mac )); \
35653583 } while (0 )
35663584
0 commit comments