Skip to content

Commit 4477dc1

Browse files
authored
Merge branch 'espressif:master' into master
2 parents 8b4ffb8 + 248cae4 commit 4477dc1

9 files changed

+165
-4
lines changed

configs/defconfig.common

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ CONFIG_LWIP_PPP_SUPPORT=y
7070
CONFIG_LWIP_PPP_NOTIFY_PHASE_SUPPORT=y
7171
CONFIG_LWIP_PPP_PAP_SUPPORT=y
7272
CONFIG_LWIP_PPP_ENABLE_IPV6=n
73+
CONFIG_LWIP_HOOK_IP6_ROUTE_DEFAULT=y
74+
CONFIG_LWIP_HOOK_ND6_GET_GW_DEFAULT=y
75+
CONFIG_LWIP_HOOK_IP6_SELECT_SRC_ADDR_DEFAULT=y
76+
CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_DEFAULT=y
77+
CONFIG_LWIP_HOOK_IP6_INPUT_CUSTOM=y
7378
CONFIG_MBEDTLS_PSK_MODES=y
7479
CONFIG_MBEDTLS_KEY_EXCHANGE_PSK=y
7580
CONFIG_MBEDTLS_CAMELLIA_C=y

configs/defconfig.debug_default

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
CONFIG_BOOTLOADER_LOG_LEVEL_NONE=y
1+
CONFIG_BOOTLOADER_LOG_LEVEL_ERROR=y
22
CONFIG_LOG_DEFAULT_LEVEL_ERROR=y

configs/defconfig.esp32c6

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=2304
1616
CONFIG_LWIP_IPV6_NUM_ADDRESSES=8
1717
CONFIG_LWIP_MULTICAST_PING=y
1818
CONFIG_LWIP_BROADCAST_PING=y
19-
CONFIG_LWIP_HOOK_IP6_SELECT_SRC_ADDR_CUSTOM=y
2019
# end of lwip
2120

2221
#

configs/defconfig.esp32h2

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=2304
1212
CONFIG_LWIP_IPV6_NUM_ADDRESSES=8
1313
CONFIG_LWIP_MULTICAST_PING=y
1414
CONFIG_LWIP_BROADCAST_PING=y
15-
CONFIG_LWIP_HOOK_IP6_SELECT_SRC_ADDR_CUSTOM=y
1615
# end of lwip
1716

1817
#
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
diff --git a/components/protocomm/src/simple_ble/simple_ble.c b/components/protocomm/src/simple_ble/simple_ble.c
2+
index 8a4ae0f3d9..cd6421c6e5 100644
3+
--- a/components/protocomm/src/simple_ble/simple_ble.c
4+
+++ b/components/protocomm/src/simple_ble/simple_ble.c
5+
@@ -225,7 +225,7 @@ esp_err_t simple_ble_start(simple_ble_cfg_t *cfg)
6+
#ifdef CONFIG_BTDM_CTRL_MODE_BTDM
7+
ret = esp_bt_controller_enable(ESP_BT_MODE_BTDM);
8+
-#elif defined CONFIG_BTDM_CTRL_MODE_BLE_ONLY || CONFIG_BT_CTRL_MODE_EFF
9+
+#elif defined CONFIG_BTDM_CTRL_MODE_BLE_ONLY || CONFIG_BT_CTRL_MODE_EFF || CONFIG_IDF_TARGET_ESP32C6
10+
ret = esp_bt_controller_enable(ESP_BT_MODE_BLE);
11+
#else
12+
ESP_LOGE(TAG, "Configuration mismatch. Select BLE Only or BTDM mode from menuconfig");

patches/lwip_max_tcp_pcb.diff

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
diff --git a/components/lwip/lwip/src/core/memp.c b/components/lwip/lwip/src/core/memp.c
2+
index 352ce5a55127a658b6b3c9d8541298c42df332ff..39433cf476b3456b046e337e9b1f016299964a84 100644
3+
--- a/components/lwip/lwip/src/core/memp.c
4+
+++ b/components/lwip/lwip/src/core/memp.c
5+
@@ -240,6 +240,10 @@ memp_init(void)
6+
#endif /* MEMP_OVERFLOW_CHECK >= 2 */
7+
}
8+
9+
+#if MEMP_MEM_MALLOC && ESP_LWIP && LWIP_TCP
10+
+static u32_t num_tcp_pcb = 0;
11+
+#endif
12+
+
13+
static void *
14+
#if !MEMP_OVERFLOW_CHECK
15+
do_memp_malloc_pool(const struct memp_desc *desc)
16+
@@ -251,6 +255,16 @@ do_memp_malloc_pool_fn(const struct memp_desc *desc, const char *file, const int
17+
SYS_ARCH_DECL_PROTECT(old_level);
18+
19+
#if MEMP_MEM_MALLOC
20+
+#if ESP_LWIP
21+
+#if LWIP_TCP
22+
+ if(desc == memp_pools[MEMP_TCP_PCB]){
23+
+ if(num_tcp_pcb >= MEMP_NUM_TCP_PCB){
24+
+ return NULL;
25+
+ }
26+
+ }
27+
+#endif
28+
+#endif
29+
+
30+
memp = (struct memp *)mem_malloc(MEMP_SIZE + MEMP_ALIGN_SIZE(desc->size));
31+
SYS_ARCH_PROTECT(old_level);
32+
#else /* MEMP_MEM_MALLOC */
33+
@@ -260,6 +274,12 @@ do_memp_malloc_pool_fn(const struct memp_desc *desc, const char *file, const int
34+
#endif /* MEMP_MEM_MALLOC */
35+
36+
if (memp != NULL) {
37+
+#if MEMP_MEM_MALLOC && ESP_LWIP && LWIP_TCP
38+
+ if (desc == memp_pools[MEMP_TCP_PCB]) {
39+
+ num_tcp_pcb++;
40+
+ }
41+
+#endif
42+
+
43+
#if !MEMP_MEM_MALLOC
44+
#if MEMP_OVERFLOW_CHECK == 1
45+
memp_overflow_check_element(memp, desc);
46+
@@ -369,6 +389,12 @@ do_memp_free_pool(const struct memp_desc *desc, void *mem)
47+
48+
SYS_ARCH_PROTECT(old_level);
49+
50+
+#if MEMP_MEM_MALLOC && ESP_LWIP && LWIP_TCP
51+
+ if (desc == memp_pools[MEMP_TCP_PCB]) {
52+
+ num_tcp_pcb--;
53+
+ }
54+
+#endif
55+
+
56+
#if MEMP_OVERFLOW_CHECK == 1
57+
memp_overflow_check_element(memp, desc);
58+
#endif /* MEMP_OVERFLOW_CHECK */
59+
diff --git a/components/lwip/lwip/src/core/tcp.c b/components/lwip/lwip/src/core/tcp.c
60+
index 3fbdd89ae07807208ff7466abb50f90b5e7727e4..fe6baaf250927cb4b89f8d1dbd41c73def88692b 100644
61+
--- a/components/lwip/lwip/src/core/tcp.c
62+
+++ b/components/lwip/lwip/src/core/tcp.c
63+
@@ -1765,7 +1765,9 @@ tcp_kill_state(enum tcp_state state)
64+
struct tcp_pcb *pcb, *inactive;
65+
u32_t inactivity;
66+
67+
+#if !ESP_LWIP
68+
LWIP_ASSERT("invalid state", (state == CLOSING) || (state == LAST_ACK));
69+
+#endif
70+
71+
inactivity = 0;
72+
inactive = NULL;
73+
@@ -1870,17 +1872,41 @@ tcp_alloc(u8_t prio)
74+
tcp_kill_state(CLOSING);
75+
/* Try to allocate a tcp_pcb again. */
76+
pcb = (struct tcp_pcb *)memp_malloc(MEMP_TCP_PCB);
77+
+#if ESP_LWIP
78+
if (pcb == NULL) {
79+
- /* Try killing oldest active connection with lower priority than the new one. */
80+
- LWIP_DEBUGF(TCP_DEBUG, ("tcp_alloc: killing oldest connection with prio lower than %d\n", prio));
81+
- tcp_kill_prio(prio);
82+
- /* Try to allocate a tcp_pcb again. */
83+
+ /* Try killing oldest connection in FIN_WAIT_2. */
84+
+ LWIP_DEBUGF(TCP_DEBUG, ("tcp_alloc: killing off oldest FIN_WAIT_2 connection\n"));
85+
+ tcp_kill_state(FIN_WAIT_2);
86+
pcb = (struct tcp_pcb *)memp_malloc(MEMP_TCP_PCB);
87+
+ if (pcb == NULL) {
88+
+ /* Try killing oldest connection in FIN_WAIT_1. */
89+
+ LWIP_DEBUGF(TCP_DEBUG, ("tcp_alloc: killing off oldest FIN_WAIT_1 connection\n"));
90+
+ tcp_kill_state(FIN_WAIT_1);
91+
+ pcb = (struct tcp_pcb *)memp_malloc(MEMP_TCP_PCB);
92+
+#endif
93+
+ if (pcb == NULL) {
94+
+ /* Try killing oldest active connection with lower priority than the new one. */
95+
+ LWIP_DEBUGF(TCP_DEBUG, ("tcp_alloc: killing oldest connection with prio lower than %d\n", prio));
96+
+ tcp_kill_prio(prio);
97+
+ /* Try to allocate a tcp_pcb again. */
98+
+ pcb = (struct tcp_pcb *)memp_malloc(MEMP_TCP_PCB);
99+
+ if (pcb != NULL) {
100+
+ /* adjust err stats: memp_malloc failed multiple times before */
101+
+ MEMP_STATS_DEC(err, MEMP_TCP_PCB);
102+
+ }
103+
+ }
104+
+#if ESP_LWIP
105+
+ if (pcb != NULL) {
106+
+ /* adjust err stats: memp_malloc failed multiple times before */
107+
+ MEMP_STATS_DEC(err, MEMP_TCP_PCB);
108+
+ }
109+
+ }
110+
if (pcb != NULL) {
111+
/* adjust err stats: memp_malloc failed multiple times before */
112+
MEMP_STATS_DEC(err, MEMP_TCP_PCB);
113+
}
114+
}
115+
+#endif
116+
if (pcb != NULL) {
117+
/* adjust err stats: memp_malloc failed multiple times before */
118+
MEMP_STATS_DEC(err, MEMP_TCP_PCB);

patches/mmu_map.diff

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
diff --git a/components/esp_mm/esp_mmu_map.c b/components/esp_mm/esp_mmu_map.c
2+
index b7d927f8fe..6a8c4635f0 100644
3+
--- a/components/esp_mm/esp_mmu_map.c
4+
+++ b/components/esp_mm/esp_mmu_map.c
5+
@@ -315,6 +315,19 @@ esp_err_t esp_mmu_map_reserve_block_with_caps(size_t size, mmu_mem_caps_t caps,
6+
s_mmu_ctx.mem_regions[found_region_id].max_slot_size -= aligned_size;
7+
ESP_EARLY_LOGV(TAG, "found laddr is 0x%x", laddr);
8+
9+
+ mem_block_t *mem_block = NULL;
10+
+ mem_region_t *region = &s_mmu_ctx.mem_regions[found_region_id];
11+
+ TAILQ_FOREACH(mem_block, &region->mem_block_head, entries) {
12+
+ if (mem_block == TAILQ_FIRST(&region->mem_block_head) || mem_block == TAILQ_LAST(&region->mem_block_head, mem_block_head_)) {
13+
+ TAILQ_REMOVE(&region->mem_block_head, mem_block, entries);
14+
+ } else {
15+
+ // probably the reservation of MMU region should be disallowed for this case - already some MMU mappings exist?
16+
+ // assert/abort
17+
+ ESP_EARLY_LOGE(TAG, "already some MMU mappings exist?");
18+
+ abort();
19+
+ }
20+
+ }
21+
+
22+
uint32_t vaddr = 0;
23+
if (caps & MMU_MEM_CAP_EXEC) {
24+
vaddr = mmu_ll_laddr_to_vaddr(laddr, MMU_VADDR_INSTRUCTION);

tools/config.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ AR_COMPS="$AR_ROOT/components"
4545
AR_MANAGED_COMPS="$AR_ROOT/managed_components"
4646
AR_OUT="$AR_ROOT/out"
4747
AR_TOOLS="$AR_OUT/tools"
48+
AR_PATCHES="$AR_ROOT/patches"
4849
AR_PLATFORM_TXT="$AR_OUT/platform.txt"
4950
AR_GEN_PART_PY="$AR_TOOLS/gen_esp32part.py"
5051
AR_SDK="$AR_TOOLS/esp32-arduino-libs/$IDF_TARGET"

tools/install-esp-idf.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@ if [ ! -x $idf_was_installed ] || [ ! -x $commit_predefined ]; then
3737

3838
# Temporarily patch the ESP32-S2 I2C LL driver to keep the clock source
3939
cd $IDF_PATH
40-
patch -p1 -N -i ../patches/esp32s2_i2c_ll_master_init.diff
40+
patch -p1 -N -i $AR_PATCHES/esp32s2_i2c_ll_master_init.diff
41+
patch -p1 -N -i $AR_PATCHES/mmu_map.diff
42+
patch -p1 -N -i $AR_PATCHES/lwip_max_tcp_pcb.diff
43+
patch -p1 -N -i $AR_PATCHES/esp32c6_provisioning_bluedroid.diff
4144
cd -
4245
fi
4346

0 commit comments

Comments
 (0)