From 9b80e1be25cf5bb2e54d3316c80e0baffc87cf4b Mon Sep 17 00:00:00 2001 From: jonas Date: Thu, 9 Dec 2021 18:11:55 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E4=BF=AE=E5=A4=8DAT=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=9C=A8CLI=E6=A8=A1=E5=BC=8F=E4=B8=8B=EF=BC=8C=E6=8C=87?= =?UTF-8?q?=E4=BB=A4=E8=BE=93=E5=85=A5=E8=BF=87=E9=95=BF=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E6=95=B0=E7=BB=84=E8=B6=8A=E7=95=8C=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/net/at/src/at_cli.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/components/net/at/src/at_cli.c b/components/net/at/src/at_cli.c index c589bb68a0..d51358d863 100644 --- a/components/net/at/src/at_cli.c +++ b/components/net/at/src/at_cli.c @@ -264,6 +264,10 @@ static void client_cli_parser(at_client_t client) } else { + if(cur_line_len >= FINSH_CMD_SIZE) + { + continue; + } rt_kprintf("%c", ch); cur_line[cur_line_len++] = ch; } From 7759628db7c8737587f5c4f4a05c8114748d3be8 Mon Sep 17 00:00:00 2001 From: liuxianliang Date: Wed, 22 Dec 2021 14:27:50 +0800 Subject: [PATCH 2/6] [modify] #5335, PR --- components/net/lwip-2.1.2/src/arch/sys_arch.c | 28 ++++++++++++++++++- components/net/lwip-2.1.2/src/lwipopts.h | 8 +++--- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/components/net/lwip-2.1.2/src/arch/sys_arch.c b/components/net/lwip-2.1.2/src/arch/sys_arch.c index c97609a4ea..a7d3f98968 100644 --- a/components/net/lwip-2.1.2/src/arch/sys_arch.c +++ b/components/net/lwip-2.1.2/src/arch/sys_arch.c @@ -360,7 +360,7 @@ err_t sys_mutex_new(sys_mutex_t *mutex) rt_snprintf(tname, RT_NAME_MAX, "%s%d", SYS_LWIP_MUTEX_NAME, counter); counter ++; - tmpmutex = rt_mutex_create(tname, RT_IPC_FLAG_FIFO); + tmpmutex = rt_mutex_create(tname, RT_IPC_FLAG_PRIO); if (tmpmutex == RT_NULL) return ERR_MEM; else @@ -779,6 +779,32 @@ void ppp_trace(int level, const char *format, ...) } #endif +#ifdef LWIP_HOOK_IP4_ROUTE_SRC +struct netif *lwip_ip4_route_src(const ip4_addr_t *dest, const ip4_addr_t *src) +{ + struct netif *netif; + + /* iterate through netifs */ + for (netif = netif_list; netif != NULL; netif = netif->next) + { + /* is the netif up, does it have a link and a valid address? */ + if (netif_is_up(netif) && netif_is_link_up(netif) && !ip4_addr_isany_val(*netif_ip4_addr(netif))) + { + /* gateway matches on a non broadcast interface? (i.e. peer in a point to point interface) */ + if (src != NULL) + { + if (ip4_addr_cmp(src, netif_ip4_addr(netif))) + { + return netif; + } + } + } + } + netif = netif_default; + return netif; +} +#endif /* LWIP_HOOK_IP4_ROUTE_SRC */ + /* * export bsd socket symbol for RT-Thread Application Module */ diff --git a/components/net/lwip-2.1.2/src/lwipopts.h b/components/net/lwip-2.1.2/src/lwipopts.h index 81409a9d0a..f5eb177d5d 100644 --- a/components/net/lwip-2.1.2/src/lwipopts.h +++ b/components/net/lwip-2.1.2/src/lwipopts.h @@ -47,10 +47,6 @@ #define LWIP_PLATFORM_BYTESWAP 0 -#ifndef BYTE_ORDER -#define BYTE_ORDER LITTLE_ENDIAN -#endif - /* #define RT_LWIP_DEBUG */ #ifdef RT_LWIP_DEBUG @@ -648,4 +644,8 @@ #endif +#define LWIP_HOOK_IP4_ROUTE_SRC(dest, src) lwip_ip4_route_src(dest, src) +#include "lwip/ip_addr.h" +struct netif *lwip_ip4_route_src(const ip4_addr_t *dest, const ip4_addr_t *src); + #endif /* __LWIPOPTS_H__ */ From 1ab47d2f31f0c191cdc89bf8c7aaa3f796d8be94 Mon Sep 17 00:00:00 2001 From: liuxianliang Date: Wed, 22 Dec 2021 14:37:33 +0800 Subject: [PATCH 3/6] [modify] #5333, PR; [lwip] solve the conflict between multi BYTE_ORDER(s) --- components/net/lwip-1.4.1/src/arch/include/arch/cc.h | 8 ++++++++ .../net/lwip-1.4.1/src/arch/include/arch/sys_arch.h | 6 +----- components/net/lwip-1.4.1/src/lwipopts.h | 4 ---- components/net/lwip-2.0.2/src/arch/include/arch/cc.h | 8 ++++++++ .../net/lwip-2.0.2/src/arch/include/arch/sys_arch.h | 6 +----- components/net/lwip-2.0.2/src/lwipopts.h | 4 ---- components/net/lwip-2.0.3/src/arch/include/arch/cc.h | 7 +++++++ .../net/lwip-2.0.3/src/arch/include/arch/sys_arch.h | 7 +------ components/net/lwip-2.0.3/src/lwipopts.h | 4 ---- components/net/lwip-2.1.2/src/arch/include/arch/cc.h | 8 ++++++++ .../net/lwip-2.1.2/src/arch/include/arch/sys_arch.h | 7 +------ 11 files changed, 35 insertions(+), 34 deletions(-) diff --git a/components/net/lwip-1.4.1/src/arch/include/arch/cc.h b/components/net/lwip-1.4.1/src/arch/include/arch/cc.h index 82387b432d..50248b9863 100644 --- a/components/net/lwip-1.4.1/src/arch/include/arch/cc.h +++ b/components/net/lwip-1.4.1/src/arch/include/arch/cc.h @@ -40,6 +40,14 @@ #include #include +#ifndef BYTE_ORDER +#ifdef RT_USING_BIG_ENDIAN +#define BYTE_ORDER BIG_ENDIAN +#else +#define BYTE_ORDER LITTLE_ENDIAN +#endif /* RT_USING_BIG_ENDIAN */ +#endif /* BYTE_ORDER */ + typedef uint8_t u8_t; typedef int8_t s8_t; typedef uint16_t u16_t; diff --git a/components/net/lwip-1.4.1/src/arch/include/arch/sys_arch.h b/components/net/lwip-1.4.1/src/arch/include/arch/sys_arch.h index 72814aa25c..4c4eff942f 100644 --- a/components/net/lwip-1.4.1/src/arch/include/arch/sys_arch.h +++ b/components/net/lwip-1.4.1/src/arch/include/arch/sys_arch.h @@ -39,14 +39,10 @@ #include -#ifndef BYTE_ORDER -#define BYTE_ORDER LITTLE_ENDIAN -#endif - #define SYS_MBOX_NULL RT_NULL #define SYS_SEM_NULL RT_NULL -typedef u32_t sys_prot_t; +typedef rt_uint32_t sys_prot_t; #define SYS_MBOX_SIZE 10 #define SYS_LWIP_TIMER_NAME "timer" diff --git a/components/net/lwip-1.4.1/src/lwipopts.h b/components/net/lwip-1.4.1/src/lwipopts.h index a5e035b53a..312f4f83ec 100644 --- a/components/net/lwip-1.4.1/src/lwipopts.h +++ b/components/net/lwip-1.4.1/src/lwipopts.h @@ -37,10 +37,6 @@ #define LWIP_PLATFORM_BYTESWAP 0 -#ifndef BYTE_ORDER -#define BYTE_ORDER LITTLE_ENDIAN -#endif - /* #define RT_LWIP_DEBUG */ #ifdef RT_LWIP_DEBUG diff --git a/components/net/lwip-2.0.2/src/arch/include/arch/cc.h b/components/net/lwip-2.0.2/src/arch/include/arch/cc.h index 28f86d257e..ea201be28a 100644 --- a/components/net/lwip-2.0.2/src/arch/include/arch/cc.h +++ b/components/net/lwip-2.0.2/src/arch/include/arch/cc.h @@ -39,6 +39,14 @@ #include #include +#ifndef BYTE_ORDER +#ifdef RT_USING_BIG_ENDIAN +#define BYTE_ORDER BIG_ENDIAN +#else +#define BYTE_ORDER LITTLE_ENDIAN +#endif /* RT_USING_BIG_ENDIAN */ +#endif /* BYTE_ORDER */ + #define U16_F "hu" #define S16_F "hd" #define X16_F "hx" diff --git a/components/net/lwip-2.0.2/src/arch/include/arch/sys_arch.h b/components/net/lwip-2.0.2/src/arch/include/arch/sys_arch.h index 8637cc9263..478828d0a0 100644 --- a/components/net/lwip-2.0.2/src/arch/include/arch/sys_arch.h +++ b/components/net/lwip-2.0.2/src/arch/include/arch/sys_arch.h @@ -39,14 +39,10 @@ #include -#ifndef BYTE_ORDER -#define BYTE_ORDER LITTLE_ENDIAN -#endif - #define SYS_MBOX_NULL RT_NULL #define SYS_SEM_NULL RT_NULL -typedef u32_t sys_prot_t; +typedef rt_uint32_t sys_prot_t; #define SYS_MBOX_SIZE 10 #define SYS_LWIP_TIMER_NAME "timer" diff --git a/components/net/lwip-2.0.2/src/lwipopts.h b/components/net/lwip-2.0.2/src/lwipopts.h index fe6e2fef6f..9f5d03ebf7 100644 --- a/components/net/lwip-2.0.2/src/lwipopts.h +++ b/components/net/lwip-2.0.2/src/lwipopts.h @@ -45,10 +45,6 @@ #define LWIP_PLATFORM_BYTESWAP 0 -#ifndef BYTE_ORDER -#define BYTE_ORDER LITTLE_ENDIAN -#endif - /* #define RT_LWIP_DEBUG */ #ifdef RT_LWIP_DEBUG diff --git a/components/net/lwip-2.0.3/src/arch/include/arch/cc.h b/components/net/lwip-2.0.3/src/arch/include/arch/cc.h index c7848adfc9..be5d406f50 100644 --- a/components/net/lwip-2.0.3/src/arch/include/arch/cc.h +++ b/components/net/lwip-2.0.3/src/arch/include/arch/cc.h @@ -39,6 +39,13 @@ #include #include +#ifndef BYTE_ORDER +#ifdef RT_USING_BIG_ENDIAN +#define BYTE_ORDER BIG_ENDIAN +#else +#define BYTE_ORDER LITTLE_ENDIAN +#endif /* RT_USING_BIG_ENDIAN */ +#endif /* BYTE_ORDER */ #define U16_F "hu" #define S16_F "hd" diff --git a/components/net/lwip-2.0.3/src/arch/include/arch/sys_arch.h b/components/net/lwip-2.0.3/src/arch/include/arch/sys_arch.h index 8637cc9263..d065298bff 100644 --- a/components/net/lwip-2.0.3/src/arch/include/arch/sys_arch.h +++ b/components/net/lwip-2.0.3/src/arch/include/arch/sys_arch.h @@ -36,17 +36,12 @@ #define __ARCH_SYS_ARCH_H__ #include "arch/cc.h" - #include -#ifndef BYTE_ORDER -#define BYTE_ORDER LITTLE_ENDIAN -#endif - #define SYS_MBOX_NULL RT_NULL #define SYS_SEM_NULL RT_NULL -typedef u32_t sys_prot_t; +typedef rt_uint32_t sys_prot_t; #define SYS_MBOX_SIZE 10 #define SYS_LWIP_TIMER_NAME "timer" diff --git a/components/net/lwip-2.0.3/src/lwipopts.h b/components/net/lwip-2.0.3/src/lwipopts.h index fe6e2fef6f..9f5d03ebf7 100644 --- a/components/net/lwip-2.0.3/src/lwipopts.h +++ b/components/net/lwip-2.0.3/src/lwipopts.h @@ -45,10 +45,6 @@ #define LWIP_PLATFORM_BYTESWAP 0 -#ifndef BYTE_ORDER -#define BYTE_ORDER LITTLE_ENDIAN -#endif - /* #define RT_LWIP_DEBUG */ #ifdef RT_LWIP_DEBUG diff --git a/components/net/lwip-2.1.2/src/arch/include/arch/cc.h b/components/net/lwip-2.1.2/src/arch/include/arch/cc.h index 28f86d257e..ea201be28a 100644 --- a/components/net/lwip-2.1.2/src/arch/include/arch/cc.h +++ b/components/net/lwip-2.1.2/src/arch/include/arch/cc.h @@ -39,6 +39,14 @@ #include #include +#ifndef BYTE_ORDER +#ifdef RT_USING_BIG_ENDIAN +#define BYTE_ORDER BIG_ENDIAN +#else +#define BYTE_ORDER LITTLE_ENDIAN +#endif /* RT_USING_BIG_ENDIAN */ +#endif /* BYTE_ORDER */ + #define U16_F "hu" #define S16_F "hd" #define X16_F "hx" diff --git a/components/net/lwip-2.1.2/src/arch/include/arch/sys_arch.h b/components/net/lwip-2.1.2/src/arch/include/arch/sys_arch.h index 1e97f8a5ac..e487f58211 100644 --- a/components/net/lwip-2.1.2/src/arch/include/arch/sys_arch.h +++ b/components/net/lwip-2.1.2/src/arch/include/arch/sys_arch.h @@ -36,17 +36,12 @@ #define __ARCH_SYS_ARCH_H__ #include "arch/cc.h" - #include -#ifndef BYTE_ORDER -#define BYTE_ORDER LITTLE_ENDIAN -#endif - #define SYS_MBOX_NULL RT_NULL #define SYS_SEM_NULL RT_NULL -typedef u32_t sys_prot_t; +typedef rt_uint32_t sys_prot_t; #define SYS_MBOX_SIZE 10 #define SYS_LWIP_TIMER_NAME "timer" From 90b00b7d4a8babdf266efa0f3a07aea49bd6e436 Mon Sep 17 00:00:00 2001 From: charlown Date: Tue, 2 Nov 2021 14:37:42 +0800 Subject: [PATCH 4/6] add SOC_SERIES_STM32G0 to use "stm32_wdt.hiwdg.Init.Window = 0x00000FFF", otherwise the watchdog always reset. --- bsp/stm32/libraries/HAL_Drivers/drv_wdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_wdt.c b/bsp/stm32/libraries/HAL_Drivers/drv_wdt.c index 200dbf53df..4c1be94f8b 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_wdt.c +++ b/bsp/stm32/libraries/HAL_Drivers/drv_wdt.c @@ -109,7 +109,7 @@ int rt_wdt_init(void) stm32_wdt.hiwdg.Init.Reload = 0x00000FFF; #if defined(SOC_SERIES_STM32F0) || defined(SOC_SERIES_STM32L4) || defined(SOC_SERIES_STM32F7) \ - || defined(SOC_SERIES_STM32H7) || defined(SOC_SERIES_STM32L0) + || defined(SOC_SERIES_STM32H7) || defined(SOC_SERIES_STM32L0) || defined(SOC_SERIES_STM32G0) stm32_wdt.hiwdg.Init.Window = 0x00000FFF; #endif stm32_wdt.is_start = 0; From e1cf0cdb6b945996e60a80693acae82795ebb126 Mon Sep 17 00:00:00 2001 From: sunxing Date: Sun, 21 Nov 2021 12:43:36 +0800 Subject: [PATCH 5/6] fix bugs about startup_gd32f4xx --- .../Libraries/CMSIS/GD/GD32F4xx/Source/ARM/startup_gd32f4xx.s | 3 ++- .../Libraries/CMSIS/GD/GD32F4xx/Source/GCC/startup_gd32f4xx.S | 4 +++- .../Libraries/CMSIS/GD/GD32F4xx/Source/IAR/startup_gd32f4xx.s | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/bsp/gd32450z-eval/Libraries/CMSIS/GD/GD32F4xx/Source/ARM/startup_gd32f4xx.s b/bsp/gd32450z-eval/Libraries/CMSIS/GD/GD32F4xx/Source/ARM/startup_gd32f4xx.s index eb11e413dc..ba5c4c7399 100644 --- a/bsp/gd32450z-eval/Libraries/CMSIS/GD/GD32F4xx/Source/ARM/startup_gd32f4xx.s +++ b/bsp/gd32450z-eval/Libraries/CMSIS/GD/GD32F4xx/Source/ARM/startup_gd32f4xx.s @@ -141,10 +141,11 @@ __Vectors DCD __initial_sp ; Top of Stack DCD TRNG_IRQHandler ; 96:TRNG DCD FPU_IRQHandler ; 97:FPU DCD UART6_IRQHandler ; 98:UART6 - DCD UART7_IRQHandler ; 98:UART7 + DCD UART7_IRQHandler ; 99:UART7 DCD SPI3_IRQHandler ; 100:SPI3 DCD SPI4_IRQHandler ; 101:SPI4 DCD SPI5_IRQHandler ; 102:SPI5 + DCD 0 ; 103:Reserved DCD TLI_IRQHandler ; 104:TLI DCD TLI_ER_IRQHandler ; 105:TLI Error DCD IPA_IRQHandler ; 106:IPA diff --git a/bsp/gd32450z-eval/Libraries/CMSIS/GD/GD32F4xx/Source/GCC/startup_gd32f4xx.S b/bsp/gd32450z-eval/Libraries/CMSIS/GD/GD32F4xx/Source/GCC/startup_gd32f4xx.S index 149472da00..2e53748e25 100644 --- a/bsp/gd32450z-eval/Libraries/CMSIS/GD/GD32F4xx/Source/GCC/startup_gd32f4xx.S +++ b/bsp/gd32450z-eval/Libraries/CMSIS/GD/GD32F4xx/Source/GCC/startup_gd32f4xx.S @@ -104,6 +104,7 @@ g_pfnVectors: .word CAN1_TX_IRQHandler // 79:CAN1 TX .word CAN1_RX0_IRQHandler // 80:CAN1 RX0 .word CAN1_RX1_IRQHandler // 81:CAN1 RX1 + .word CAN1_EWMC_IRQHandler // 82:CAN1 EWMC .word USBFS_IRQHandler // 83:USBFS .word DMA1_Channel5_IRQHandler // 84:DMA1 Channel5 .word DMA1_Channel6_IRQHandler // 85:DMA1 Channel6 @@ -120,10 +121,11 @@ g_pfnVectors: .word TRNG_IRQHandler // 96:TRNG .word FPU_IRQHandler // 97:FPU .word UART6_IRQHandler // 98:UART6 - .word UART7_IRQHandler // 98:UART7 + .word UART7_IRQHandler // 99:UART7 .word SPI3_IRQHandler // 100:SPI3 .word SPI4_IRQHandler // 101:SPI4 .word SPI5_IRQHandler // 102:SPI5 + .word 0 // 103:Reserved .word TLI_IRQHandler // 104:TLI .word TLI_ER_IRQHandler // 105:TLI Error .word IPA_IRQHandler // 106:IPA diff --git a/bsp/gd32450z-eval/Libraries/CMSIS/GD/GD32F4xx/Source/IAR/startup_gd32f4xx.s b/bsp/gd32450z-eval/Libraries/CMSIS/GD/GD32F4xx/Source/IAR/startup_gd32f4xx.s index 87bf921267..af94881cdf 100644 --- a/bsp/gd32450z-eval/Libraries/CMSIS/GD/GD32F4xx/Source/IAR/startup_gd32f4xx.s +++ b/bsp/gd32450z-eval/Libraries/CMSIS/GD/GD32F4xx/Source/IAR/startup_gd32f4xx.s @@ -125,10 +125,11 @@ __vector_table DCD TRNG_IRQHandler ; 96:TRNG DCD FPU_IRQHandler ; 97:FPU DCD UART6_IRQHandler ; 98:UART6 - DCD UART7_IRQHandler ; 98:UART7 + DCD UART7_IRQHandler ; 99:UART7 DCD SPI3_IRQHandler ; 100:SPI3 DCD SPI4_IRQHandler ; 101:SPI4 DCD SPI5_IRQHandler ; 102:SPI5 + DCD 0 ; 103:Reserved DCD TLI_IRQHandler ; 104:TLI DCD TLI_ER_IRQHandler ; 105:TLI Error DCD IPA_IRQHandler ; 106:IPA From 53299b9452d8c176dbcf085e4ee0919a62bde76f Mon Sep 17 00:00:00 2001 From: qinge Date: Tue, 23 Nov 2021 17:33:56 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dstm32l4=E7=B3=BB=E5=88=97?= =?UTF-8?q?flash=E5=9C=A8=E4=B8=8B=E8=BD=BD=E5=AE=8C=E7=A8=8B=E5=BA=8F?= =?UTF-8?q?=E5=90=8E=E9=A6=96=E6=AC=A1=E6=93=A6=E9=99=A4=E4=BC=9A=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash_l4.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash_l4.c b/bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash_l4.c index 4da4207961..434217ea10 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash_l4.c +++ b/bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash_l4.c @@ -233,7 +233,7 @@ int stm32_flash_erase(rt_uint32_t addr, size_t size) HAL_FLASH_Unlock(); /* Clear OPTVERR bit set on virgin samples */ - __HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_OPTVERR); + __HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_OPTVERR | FLASH_FLAG_PGSERR); /* Get the 1st page to erase */ FirstPage = GetPage(addr); /* Get the number of pages to erase from 1st page */