Skip to content

Commit 345c457

Browse files
committed
feat(wifi_remote): Add slave selection and peview targets
1 parent 2e53b81 commit 345c457

File tree

5 files changed

+73
-45
lines changed

5 files changed

+73
-45
lines changed

components/esp_wifi_remote/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ menu "Wi-Fi Remote"
44
bool
55
default y
66

7+
orsource "./Kconfig.slave_select.in"
78
orsource "./Kconfig.soc_wifi_caps.in"
89
orsource "./Kconfig.rpc.in"
910

components/esp_wifi_remote/test/smoke_test/components/esp_hosted/Kconfig renamed to components/esp_wifi_remote/Kconfig.slave_select.in

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# This file is auto-generated
2-
menu "ESP Hosted Mock"
32
choice SLAVE_IDF_TARGET
43
prompt "choose slave target"
54
default SLAVE_IDF_TARGET_ESP32
@@ -15,9 +14,6 @@ menu "ESP Hosted Mock"
1514
bool "esp32c2"
1615
config SLAVE_IDF_TARGET_ESP32C6
1716
bool "esp32c6"
18-
config SLAVE_IDF_TARGET_ESP32H2
19-
bool "esp32h2"
20-
config SLAVE_IDF_TARGET_ESP32P4
21-
bool "esp32p4"
17+
config SLAVE_IDF_TARGET_ESP32C5
18+
bool "esp32c5"
2219
endchoice
23-
endmenu

components/esp_wifi_remote/Kconfig.soc_wifi_caps.in

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -224,14 +224,46 @@ if SLAVE_IDF_TARGET_ESP32C6
224224

225225
endif # ESP32C6
226226

227-
if SLAVE_IDF_TARGET_ESP32H2
227+
if SLAVE_IDF_TARGET_ESP32C5
228228

229-
endif # ESP32H2
230-
231-
if SLAVE_IDF_TARGET_ESP32P4
229+
config SLAVE_SOC_WIFI_SUPPORTED
230+
bool
231+
default y
232232

233233
config SLAVE_SOC_WIFI_LIGHT_SLEEP_CLK_WIDTH
234234
int
235235
default 12
236236

237-
endif # ESP32P4
237+
config SLAVE_SOC_WIFI_HW_TSF
238+
bool
239+
default y
240+
241+
config SLAVE_SOC_WIFI_FTM_SUPPORT
242+
bool
243+
default n
244+
245+
config SLAVE_SOC_WIFI_GCMP_SUPPORT
246+
bool
247+
default y
248+
249+
config SLAVE_SOC_WIFI_WAPI_SUPPORT
250+
bool
251+
default y
252+
253+
config SLAVE_SOC_WIFI_CSI_SUPPORT
254+
bool
255+
default y
256+
257+
config SLAVE_SOC_WIFI_MESH_SUPPORT
258+
bool
259+
default y
260+
261+
config SLAVE_SOC_WIFI_HE_SUPPORT
262+
bool
263+
default y
264+
265+
config SLAVE_SOC_WIFI_HE_SUPPORT_5G
266+
bool
267+
default y
268+
269+
endif # ESP32C5

components/esp_wifi_remote/scripts/generate_and_check.py

Lines changed: 29 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import subprocess
88
from collections import namedtuple
99

10-
from idf_build_apps.constants import SUPPORTED_TARGETS
10+
from idf_build_apps.constants import PREVIEW_TARGETS, SUPPORTED_TARGETS
1111
from pycparser import c_ast, c_parser, preprocess_file
1212

1313
Param = namedtuple('Param', ['ptr', 'array', 'qual', 'type', 'name'])
@@ -161,45 +161,42 @@ def get_vars(parameters):
161161

162162
def generate_kconfig_wifi_caps(idf_path, component_path):
163163
kconfig = os.path.join(component_path, 'Kconfig.soc_wifi_caps.in')
164+
slave_select = os.path.join(component_path, 'Kconfig.slave_select.in')
164165
sdkconfig_files = []
165-
with open(kconfig, 'w') as out:
166-
out.write(f'# {AUTO_GENERATED}\n')
167-
for slave_target in SUPPORTED_TARGETS:
168-
out.write(f'\nif SLAVE_IDF_TARGET_{slave_target.upper()}\n\n')
166+
with open(kconfig, 'w') as slave_caps, open(slave_select, 'w') as slave:
167+
slave_caps.write(f'# {AUTO_GENERATED}\n')
168+
slave.write(f'# {AUTO_GENERATED}\n')
169+
slave.write(' choice SLAVE_IDF_TARGET\n')
170+
slave.write(' prompt "choose slave target"\n')
171+
slave.write(' default SLAVE_IDF_TARGET_ESP32\n')
172+
for slave_target in SUPPORTED_TARGETS + PREVIEW_TARGETS:
173+
add_slave = False
174+
kconfig_content = []
169175
soc_caps = os.path.join(idf_path, 'components', 'soc', slave_target, 'include', 'soc', 'Kconfig.soc_caps.in')
170176
with open(soc_caps, 'r') as f:
171177
for line in f:
172178
if line.strip().startswith('config SOC_WIFI_'):
173179
if 'config SOC_WIFI_SUPPORTED' in line:
174-
# if WiFi supported for this target, test it as a slave
180+
# if WiFi supported for this target, add it to Kconfig slave options and test this slave
181+
add_slave = True
175182
sdkconfig = os.path.join(component_path, 'test', 'smoke_test', f'sdkconfig.ci.slave_{slave_target}')
176183
open(sdkconfig, 'w').write(f'CONFIG_SLAVE_IDF_TARGET_{slave_target.upper()}=y\n')
177184
sdkconfig_files.append(sdkconfig)
178-
replaced = re.compile(r'SOC_WIFI_').sub('SLAVE_SOC_WIFI_', line)
179-
out.write(f' {replaced}')
180-
line = f.readline() # type
181-
out.write(f' {line}')
182-
line = f.readline() # default
183-
out.write(f' {line}\n')
184-
out.write(f'endif # {slave_target.upper()}\n')
185-
return [kconfig] + sdkconfig_files
186-
187-
188-
def generate_test_kconfig(component_path):
189-
path = os.path.join(component_path, 'test','smoke_test','components','esp_hosted','Kconfig')
190-
with open(path, 'w') as f:
191-
f.write(f'# {AUTO_GENERATED}\n')
192-
f.write('menu "ESP Hosted Mock"\n')
193-
f.write(' choice SLAVE_IDF_TARGET\n')
194-
f.write(' prompt "choose slave target"\n')
195-
f.write(' default SLAVE_IDF_TARGET_ESP32\n')
196-
for slave_target in SUPPORTED_TARGETS:
197-
config = 'SLAVE_IDF_TARGET_' + slave_target.upper()
198-
f.write(f' config {config}\n')
199-
f.write(f' bool "{slave_target}"\n')
200-
f.write(' endchoice\n')
201-
f.write('endmenu\n')
202-
return [path]
185+
replaced = re.sub(r'SOC_WIFI_', 'SLAVE_SOC_WIFI_', line)
186+
kconfig_content.append(f' {replaced}')
187+
kconfig_content.append(f' {f.readline()}') # type
188+
kconfig_content.append(f' {f.readline()}\n') # default
189+
if add_slave:
190+
slave_caps.write(f'\nif SLAVE_IDF_TARGET_{slave_target.upper()}\n\n')
191+
slave_caps.writelines(kconfig_content)
192+
slave_caps.write(f'endif # {slave_target.upper()}\n')
193+
194+
slave_config_name = 'SLAVE_IDF_TARGET_' + slave_target.upper()
195+
slave.write(f' config {slave_config_name}\n')
196+
slave.write(f' bool "{slave_target}"\n')
197+
198+
slave.write(' endchoice\n')
199+
return [kconfig, slave_select] + sdkconfig_files
203200

204201

205202
def generate_remote_wifi_api(function_prototypes, component_path):
@@ -311,6 +308,7 @@ def generate_kconfig(idf_path, component_path):
311308
f.write(' config ESP_WIFI_REMOTE_ENABLED\n')
312309
f.write(' bool\n')
313310
f.write(' default y\n\n')
311+
f.write(' orsource "./Kconfig.slave_select.in"\n')
314312
f.write(' orsource "./Kconfig.soc_wifi_caps.in"\n')
315313
f.write(' orsource "./Kconfig.rpc.in"\n')
316314
for line1 in lines:
@@ -377,8 +375,6 @@ def compare_files(base_dir, component_path, files_to_check):
377375

378376
files_to_check = []
379377

380-
files_to_check += generate_test_kconfig(component_path)
381-
382378
files_to_check += generate_kconfig_wifi_caps(idf_path, component_path)
383379

384380
files_to_check += generate_remote_wifi_api(function_prototypes, component_path)

components/esp_wifi_remote/test/smoke_test/main/smoke_test.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ void app_main(void)
1616
esp_wifi_init(&cfg);
1717
esp_wifi_deinit();
1818

19-
run_all_wifi_apis();
19+
#if CONFIG_SOC_WIFI_SUPPORTED
2020
run_all_wifi_remote_apis();
21+
#else
22+
run_all_wifi_apis();
23+
#endif
2124
}

0 commit comments

Comments
 (0)