Skip to content

Commit 4ff89b5

Browse files
committed
Added IDF patches
- Patch1: Support LWIP in split_mode - Patch2: Work-around for STATUS define
1 parent d5a1b59 commit 4ff89b5

File tree

2 files changed

+217
-0
lines changed

2 files changed

+217
-0
lines changed
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
From e4ba07908d2b2b7e5ae4222c3ee973e8e35e1b11 Mon Sep 17 00:00:00 2001
2+
From: Vikram Dattu <vikram.dattu@espressif.com>
3+
Date: Wed, 8 May 2024 11:45:43 +0530
4+
Subject: [PATCH 1/2] ets_sys: Fix for STATUS define
5+
6+
---
7+
components/esp_rom/esp32/include/esp32/rom/ets_sys.h | 2 ++
8+
components/esp_rom/esp32c6/include/esp32c6/rom/ets_sys.h | 2 ++
9+
components/esp_rom/esp32p4/include/esp32p4/rom/ets_sys.h | 3 ++-
10+
components/esp_rom/esp32s3/include/esp32s3/rom/ets_sys.h | 2 ++
11+
4 files changed, 8 insertions(+), 1 deletion(-)
12+
13+
diff --git a/components/esp_rom/esp32/include/esp32/rom/ets_sys.h b/components/esp_rom/esp32/include/esp32/rom/ets_sys.h
14+
index eb73b89795..d04e9f80c3 100644
15+
--- a/components/esp_rom/esp32/include/esp32/rom/ets_sys.h
16+
+++ b/components/esp_rom/esp32/include/esp32/rom/ets_sys.h
17+
@@ -626,6 +626,7 @@ void intr_matrix_set(int cpu_no, uint32_t model_num, uint32_t intr_num);
18+
19+
#ifdef ESP_PLATFORM
20+
// Remove in IDF v6.0 (IDF-7044)
21+
+#ifndef STATUS
22+
typedef enum {
23+
OK = 0,
24+
FAIL,
25+
@@ -634,6 +635,7 @@ typedef enum {
26+
CANCEL,
27+
} STATUS __attribute__((deprecated("Use ETS_STATUS instead")));
28+
#endif
29+
+#endif
30+
31+
/**
32+
* @}
33+
diff --git a/components/esp_rom/esp32c6/include/esp32c6/rom/ets_sys.h b/components/esp_rom/esp32c6/include/esp32c6/rom/ets_sys.h
34+
index d4b0989650..69174e7167 100644
35+
--- a/components/esp_rom/esp32c6/include/esp32c6/rom/ets_sys.h
36+
+++ b/components/esp_rom/esp32c6/include/esp32c6/rom/ets_sys.h
37+
@@ -412,6 +412,7 @@ void intr_matrix_set(int cpu_no, uint32_t model_num, uint32_t intr_num);
38+
39+
#ifdef ESP_PLATFORM
40+
// Remove in IDF v6.0 (IDF-7044)
41+
+#ifndef STATUS
42+
typedef enum {
43+
OK = 0,
44+
FAIL,
45+
@@ -420,6 +421,7 @@ typedef enum {
46+
CANCEL,
47+
} STATUS __attribute__((deprecated("Use ETS_STATUS instead")));
48+
#endif
49+
+#endif
50+
51+
/**
52+
* @}
53+
diff --git a/components/esp_rom/esp32p4/include/esp32p4/rom/ets_sys.h b/components/esp_rom/esp32p4/include/esp32p4/rom/ets_sys.h
54+
index 95d8b092fc..6fef7cf851 100644
55+
--- a/components/esp_rom/esp32p4/include/esp32p4/rom/ets_sys.h
56+
+++ b/components/esp_rom/esp32p4/include/esp32p4/rom/ets_sys.h
57+
@@ -508,6 +508,7 @@ void intr_matrix_set(int cpu_no, uint32_t model_num, uint32_t intr_num);
58+
59+
#define ETS_MEM_BAR() asm volatile ( "" : : : "memory" )
60+
61+
+#ifndef STATUS
62+
typedef enum {
63+
OK = 0,
64+
FAIL,
65+
@@ -515,7 +516,7 @@ typedef enum {
66+
BUSY,
67+
CANCEL,
68+
} STATUS;
69+
-
70+
+#endif
71+
/**
72+
* @}
73+
*/
74+
diff --git a/components/esp_rom/esp32s3/include/esp32s3/rom/ets_sys.h b/components/esp_rom/esp32s3/include/esp32s3/rom/ets_sys.h
75+
index 7bc91572f2..98876eaa28 100644
76+
--- a/components/esp_rom/esp32s3/include/esp32s3/rom/ets_sys.h
77+
+++ b/components/esp_rom/esp32s3/include/esp32s3/rom/ets_sys.h
78+
@@ -548,6 +548,7 @@ void intr_matrix_set(int cpu_no, uint32_t model_num, uint32_t intr_num);
79+
80+
#ifdef ESP_PLATFORM
81+
// Remove in IDF v6.0 (IDF-7044)
82+
+#ifndef STATUS
83+
typedef enum {
84+
OK = 0,
85+
FAIL,
86+
@@ -556,6 +557,7 @@ typedef enum {
87+
CANCEL,
88+
} STATUS __attribute__((deprecated("Use ETS_STATUS instead")));
89+
#endif
90+
+#endif
91+
92+
/**
93+
* @}
94+
--
95+
2.39.3 (Apple Git-146)
96+
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
From 710c104882cd151c7f461d1cf4dfa01f793fde54 Mon Sep 17 00:00:00 2001
2+
From: Vikram Dattu <vikram.dattu@espressif.com>
3+
Date: Tue, 6 Aug 2024 11:55:22 +0530
4+
Subject: [PATCH 1/2] Fixes for IDF deep sleep and lwip_split_for_esp_hosted
5+
6+
---
7+
components/lwip/port/include/lwipopts.h | 46 +++++++++++++++++++
8+
.../components/cmd_system/cmd_system.c | 1 +
9+
.../components/cmd_system/cmd_system_sleep.c | 6 ++-
10+
3 files changed, 51 insertions(+), 2 deletions(-)
11+
12+
diff --git a/components/lwip/port/include/lwipopts.h b/components/lwip/port/include/lwipopts.h
13+
index d150106f81..0ec2f3883e 100644
14+
--- a/components/lwip/port/include/lwipopts.h
15+
+++ b/components/lwip/port/include/lwipopts.h
16+
@@ -1673,6 +1673,52 @@ static inline uint32_t timeout_from_offered(uint32_t lease, uint32_t min)
17+
#define mem_clib_calloc calloc
18+
#endif /* CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP */
19+
20+
+#ifdef CONFIG_LWIP_TCP_LOCAL_PORT_RANGE_START
21+
+#define TCP_LOCAL_PORT_RANGE_START CONFIG_LWIP_TCP_LOCAL_PORT_RANGE_START
22+
+#define TCP_LOCAL_PORT_RANGE_END CONFIG_LWIP_TCP_LOCAL_PORT_RANGE_END
23+
+#define TCP_ENSURE_LOCAL_PORT_RANGE(port) ((port)%(TCP_LOCAL_PORT_RANGE_END+1-TCP_LOCAL_PORT_RANGE_START)+TCP_LOCAL_PORT_RANGE_START)
24+
+#if CONFIG_LWIP_TCP_LOCAL_PORT_RANGE_END == 0xffff
25+
+ #define IS_LOCAL_TCP_PORT(port) (port>=TCP_LOCAL_PORT_RANGE_START)
26+
+#else
27+
+ #define IS_LOCAL_TCP_PORT(port) (port>=TCP_LOCAL_PORT_RANGE_START && (port<=CONFIG_LWIP_TCP_LOCAL_PORT_RANGE_END))
28+
+#endif
29+
+#endif
30+
+
31+
+#ifdef CONFIG_LWIP_TCP_REMOTE_PORT_RANGE_START
32+
+#define TCP_REMOTE_PORT_RANGE_START CONFIG_LWIP_TCP_REMOTE_PORT_RANGE_START
33+
+#define TCP_REMOTE_PORT_RANGE_END CONFIG_LWIP_TCP_REMOTE_PORT_RANGE_END
34+
+#define TCP_ENSURE_REMOTE_PORT_RANGE(port) ((port)%(TCP_REMOTE_PORT_RANGE_END+1-TCP_REMOTE_PORT_RANGE_START)+TCP_REMOTE_PORT_RANGE_START)
35+
+#if CONFIG_LWIP_TCP_REMOTE_PORT_RANGE_END == 0xffff
36+
+ #define IS_REMOTE_TCP_PORT(port) (port>=TCP_REMOTE_PORT_RANGE_START)
37+
+#else
38+
+ #define IS_REMOTE_TCP_PORT(port) (port>=TCP_REMOTE_PORT_RANGE_START && (port<=CONFIG_LWIP_TCP_REMOTE_PORT_RANGE_END))
39+
+#endif
40+
+#endif
41+
+
42+
+#ifdef CONFIG_LWIP_UDP_LOCAL_PORT_RANGE_START
43+
+#define UDP_LOCAL_PORT_RANGE_START CONFIG_LWIP_UDP_LOCAL_PORT_RANGE_START
44+
+#define UDP_LOCAL_PORT_RANGE_END CONFIG_LWIP_UDP_LOCAL_PORT_RANGE_END
45+
+#define UDP_ENSURE_LOCAL_PORT_RANGE(port) ((u16_t)(((port) & (u16_t)~UDP_LOCAL_PORT_RANGE_START) + UDP_LOCAL_PORT_RANGE_START))
46+
+
47+
+#if CONFIG_LWIP_UDP_LOCAL_PORT_RANGE_END == 0xffff
48+
+ #define IS_LOCAL_UDP_PORT(port) (port>=UDP_LOCAL_PORT_RANGE_START)
49+
+#else
50+
+ #define IS_LOCAL_UDP_PORT(port) (port>=UDP_LOCAL_PORT_RANGE_START && (port<=CONFIG_LWIP_UDP_LOCAL_PORT_RANGE_END))
51+
+#endif
52+
+#define DNS_PORT_ALLOWED(port) IS_LOCAL_UDP_PORT(port)
53+
+#endif
54+
+
55+
+#ifdef CONFIG_LWIP_UDP_REMOTE_PORT_RANGE_START
56+
+#define UDP_REMOTE_PORT_RANGE_START CONFIG_LWIP_UDP_REMOTE_PORT_RANGE_START
57+
+#define UDP_REMOTE_PORT_RANGE_END CONFIG_LWIP_UDP_REMOTE_PORT_RANGE_END
58+
+#define UDP_ENSURE_REMOTE_PORT_RANGE(port) ((u16_t)(((port) & (u16_t)~UDP_REMOTE_PORT_RANGE_START) + UDP_REMOTE_PORT_RANGE_START))
59+
+
60+
+#if CONFIG_LWIP_UDP_REMOTE_PORT_RANGE_END == 0xffff
61+
+ #define IS_REMOTE_UDP_PORT(port) (port>=UDP_REMOTE_PORT_RANGE_START)
62+
+#else
63+
+ #define IS_REMOTE_UDP_PORT(port) (port>=UDP_REMOTE_PORT_RANGE_START && (port<=CONFIG_LWIP_UDP_REMOTE_PORT_RANGE_END))
64+
+#endif
65+
+#endif
66+
67+
/*
68+
* Check if the lwIP configuration is sane
69+
diff --git a/examples/system/console/advanced/components/cmd_system/cmd_system.c b/examples/system/console/advanced/components/cmd_system/cmd_system.c
70+
index 761053ff98..f1867e5f96 100644
71+
--- a/examples/system/console/advanced/components/cmd_system/cmd_system.c
72+
+++ b/examples/system/console/advanced/components/cmd_system/cmd_system.c
73+
@@ -10,6 +10,7 @@
74+
75+
#include "cmd_system.h"
76+
#include "sdkconfig.h"
77+
+#include "soc/soc_caps.h"
78+
79+
void register_system(void)
80+
{
81+
diff --git a/examples/system/console/advanced/components/cmd_system/cmd_system_sleep.c b/examples/system/console/advanced/components/cmd_system/cmd_system_sleep.c
82+
index 4aad14d6f3..f8bd5c6b7e 100644
83+
--- a/examples/system/console/advanced/components/cmd_system/cmd_system_sleep.c
84+
+++ b/examples/system/console/advanced/components/cmd_system/cmd_system_sleep.c
85+
@@ -29,7 +29,7 @@
86+
87+
static const char *TAG = "cmd_system_sleep";
88+
89+
-#if SOC_DEEP_SLEEP_SUPPORTED
90+
+#if CONFIG_SOC_DEEP_SLEEP_SUPPORTED
91+
/** 'deep_sleep' command puts the chip into deep sleep mode */
92+
static struct {
93+
struct arg_int *wakeup_time;
94+
@@ -41,6 +41,7 @@ static struct {
95+
} deep_sleep_args;
96+
97+
98+
+extern int send_slave_power_save(int ps);
99+
static int deep_sleep(int argc, char **argv)
100+
{
101+
int nerrors = arg_parse(argc, argv, (void **) &deep_sleep_args);
102+
@@ -80,6 +81,7 @@ static int deep_sleep(int argc, char **argv)
103+
#if CONFIG_IDF_TARGET_ESP32
104+
rtc_gpio_isolate(GPIO_NUM_12);
105+
#endif //CONFIG_IDF_TARGET_ESP32
106+
+ send_slave_power_save(1);
107+
esp_deep_sleep_start();
108+
return 1;
109+
}
110+
@@ -116,7 +118,7 @@ void register_system_deep_sleep(void)
111+
}
112+
#endif // SOC_DEEP_SLEEP_SUPPORTED
113+
114+
-#if SOC_LIGHT_SLEEP_SUPPORTED
115+
+#if CONFIG_SOC_LIGHT_SLEEP_SUPPORTED
116+
/** 'light_sleep' command puts the chip into light sleep mode */
117+
static struct {
118+
struct arg_int *wakeup_time;
119+
--
120+
2.39.3 (Apple Git-146)
121+

0 commit comments

Comments
 (0)