feat(wifi_remote): Add slave selection and peview targets

This commit is contained in:
David Cermak
2024-09-03 15:37:55 +02:00
parent 2e53b81f64
commit 345c457711
5 changed files with 71 additions and 43 deletions

View File

@ -4,6 +4,7 @@ menu "Wi-Fi Remote"
bool
default y
orsource "./Kconfig.slave_select.in"
orsource "./Kconfig.soc_wifi_caps.in"
orsource "./Kconfig.rpc.in"

View File

@ -1,5 +1,4 @@
# This file is auto-generated
menu "ESP Hosted Mock"
choice SLAVE_IDF_TARGET
prompt "choose slave target"
default SLAVE_IDF_TARGET_ESP32
@ -15,9 +14,6 @@ menu "ESP Hosted Mock"
bool "esp32c2"
config SLAVE_IDF_TARGET_ESP32C6
bool "esp32c6"
config SLAVE_IDF_TARGET_ESP32H2
bool "esp32h2"
config SLAVE_IDF_TARGET_ESP32P4
bool "esp32p4"
config SLAVE_IDF_TARGET_ESP32C5
bool "esp32c5"
endchoice
endmenu

View File

@ -224,14 +224,46 @@ if SLAVE_IDF_TARGET_ESP32C6
endif # ESP32C6
if SLAVE_IDF_TARGET_ESP32H2
if SLAVE_IDF_TARGET_ESP32C5
endif # ESP32H2
if SLAVE_IDF_TARGET_ESP32P4
config SLAVE_SOC_WIFI_SUPPORTED
bool
default y
config SLAVE_SOC_WIFI_LIGHT_SLEEP_CLK_WIDTH
int
default 12
endif # ESP32P4
config SLAVE_SOC_WIFI_HW_TSF
bool
default y
config SLAVE_SOC_WIFI_FTM_SUPPORT
bool
default n
config SLAVE_SOC_WIFI_GCMP_SUPPORT
bool
default y
config SLAVE_SOC_WIFI_WAPI_SUPPORT
bool
default y
config SLAVE_SOC_WIFI_CSI_SUPPORT
bool
default y
config SLAVE_SOC_WIFI_MESH_SUPPORT
bool
default y
config SLAVE_SOC_WIFI_HE_SUPPORT
bool
default y
config SLAVE_SOC_WIFI_HE_SUPPORT_5G
bool
default y
endif # ESP32C5

View File

@ -7,7 +7,7 @@ import re
import subprocess
from collections import namedtuple
from idf_build_apps.constants import SUPPORTED_TARGETS
from idf_build_apps.constants import PREVIEW_TARGETS, SUPPORTED_TARGETS
from pycparser import c_ast, c_parser, preprocess_file
Param = namedtuple('Param', ['ptr', 'array', 'qual', 'type', 'name'])
@ -161,45 +161,42 @@ def get_vars(parameters):
def generate_kconfig_wifi_caps(idf_path, component_path):
kconfig = os.path.join(component_path, 'Kconfig.soc_wifi_caps.in')
slave_select = os.path.join(component_path, 'Kconfig.slave_select.in')
sdkconfig_files = []
with open(kconfig, 'w') as out:
out.write(f'# {AUTO_GENERATED}\n')
for slave_target in SUPPORTED_TARGETS:
out.write(f'\nif SLAVE_IDF_TARGET_{slave_target.upper()}\n\n')
with open(kconfig, 'w') as slave_caps, open(slave_select, 'w') as slave:
slave_caps.write(f'# {AUTO_GENERATED}\n')
slave.write(f'# {AUTO_GENERATED}\n')
slave.write(' choice SLAVE_IDF_TARGET\n')
slave.write(' prompt "choose slave target"\n')
slave.write(' default SLAVE_IDF_TARGET_ESP32\n')
for slave_target in SUPPORTED_TARGETS + PREVIEW_TARGETS:
add_slave = False
kconfig_content = []
soc_caps = os.path.join(idf_path, 'components', 'soc', slave_target, 'include', 'soc', 'Kconfig.soc_caps.in')
with open(soc_caps, 'r') as f:
for line in f:
if line.strip().startswith('config SOC_WIFI_'):
if 'config SOC_WIFI_SUPPORTED' in line:
# if WiFi supported for this target, test it as a slave
# if WiFi supported for this target, add it to Kconfig slave options and test this slave
add_slave = True
sdkconfig = os.path.join(component_path, 'test', 'smoke_test', f'sdkconfig.ci.slave_{slave_target}')
open(sdkconfig, 'w').write(f'CONFIG_SLAVE_IDF_TARGET_{slave_target.upper()}=y\n')
sdkconfig_files.append(sdkconfig)
replaced = re.compile(r'SOC_WIFI_').sub('SLAVE_SOC_WIFI_', line)
out.write(f' {replaced}')
line = f.readline() # type
out.write(f' {line}')
line = f.readline() # default
out.write(f' {line}\n')
out.write(f'endif # {slave_target.upper()}\n')
return [kconfig] + sdkconfig_files
replaced = re.sub(r'SOC_WIFI_', 'SLAVE_SOC_WIFI_', line)
kconfig_content.append(f' {replaced}')
kconfig_content.append(f' {f.readline()}') # type
kconfig_content.append(f' {f.readline()}\n') # default
if add_slave:
slave_caps.write(f'\nif SLAVE_IDF_TARGET_{slave_target.upper()}\n\n')
slave_caps.writelines(kconfig_content)
slave_caps.write(f'endif # {slave_target.upper()}\n')
slave_config_name = 'SLAVE_IDF_TARGET_' + slave_target.upper()
slave.write(f' config {slave_config_name}\n')
slave.write(f' bool "{slave_target}"\n')
def generate_test_kconfig(component_path):
path = os.path.join(component_path, 'test','smoke_test','components','esp_hosted','Kconfig')
with open(path, 'w') as f:
f.write(f'# {AUTO_GENERATED}\n')
f.write('menu "ESP Hosted Mock"\n')
f.write(' choice SLAVE_IDF_TARGET\n')
f.write(' prompt "choose slave target"\n')
f.write(' default SLAVE_IDF_TARGET_ESP32\n')
for slave_target in SUPPORTED_TARGETS:
config = 'SLAVE_IDF_TARGET_' + slave_target.upper()
f.write(f' config {config}\n')
f.write(f' bool "{slave_target}"\n')
f.write(' endchoice\n')
f.write('endmenu\n')
return [path]
slave.write(' endchoice\n')
return [kconfig, slave_select] + sdkconfig_files
def generate_remote_wifi_api(function_prototypes, component_path):
@ -311,6 +308,7 @@ def generate_kconfig(idf_path, component_path):
f.write(' config ESP_WIFI_REMOTE_ENABLED\n')
f.write(' bool\n')
f.write(' default y\n\n')
f.write(' orsource "./Kconfig.slave_select.in"\n')
f.write(' orsource "./Kconfig.soc_wifi_caps.in"\n')
f.write(' orsource "./Kconfig.rpc.in"\n')
for line1 in lines:
@ -377,8 +375,6 @@ making changes you might need to modify 'copyright_header.h' in the script direc
files_to_check = []
files_to_check += generate_test_kconfig(component_path)
files_to_check += generate_kconfig_wifi_caps(idf_path, component_path)
files_to_check += generate_remote_wifi_api(function_prototypes, component_path)

View File

@ -16,6 +16,9 @@ void app_main(void)
esp_wifi_init(&cfg);
esp_wifi_deinit();
run_all_wifi_apis();
#if CONFIG_SOC_WIFI_SUPPORTED
run_all_wifi_remote_apis();
#else
run_all_wifi_apis();
#endif
}