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 bool
default y default y
orsource "./Kconfig.slave_select.in"
orsource "./Kconfig.soc_wifi_caps.in" orsource "./Kconfig.soc_wifi_caps.in"
orsource "./Kconfig.rpc.in" orsource "./Kconfig.rpc.in"

View File

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

View File

@ -224,14 +224,46 @@ if SLAVE_IDF_TARGET_ESP32C6
endif # ESP32C6 endif # ESP32C6
if SLAVE_IDF_TARGET_ESP32H2 if SLAVE_IDF_TARGET_ESP32C5
endif # ESP32H2 config SLAVE_SOC_WIFI_SUPPORTED
bool
if SLAVE_IDF_TARGET_ESP32P4 default y
config SLAVE_SOC_WIFI_LIGHT_SLEEP_CLK_WIDTH config SLAVE_SOC_WIFI_LIGHT_SLEEP_CLK_WIDTH
int int
default 12 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 import subprocess
from collections import namedtuple 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 from pycparser import c_ast, c_parser, preprocess_file
Param = namedtuple('Param', ['ptr', 'array', 'qual', 'type', 'name']) 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): def generate_kconfig_wifi_caps(idf_path, component_path):
kconfig = os.path.join(component_path, 'Kconfig.soc_wifi_caps.in') kconfig = os.path.join(component_path, 'Kconfig.soc_wifi_caps.in')
slave_select = os.path.join(component_path, 'Kconfig.slave_select.in')
sdkconfig_files = [] sdkconfig_files = []
with open(kconfig, 'w') as out: with open(kconfig, 'w') as slave_caps, open(slave_select, 'w') as slave:
out.write(f'# {AUTO_GENERATED}\n') slave_caps.write(f'# {AUTO_GENERATED}\n')
for slave_target in SUPPORTED_TARGETS: slave.write(f'# {AUTO_GENERATED}\n')
out.write(f'\nif SLAVE_IDF_TARGET_{slave_target.upper()}\n\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') soc_caps = os.path.join(idf_path, 'components', 'soc', slave_target, 'include', 'soc', 'Kconfig.soc_caps.in')
with open(soc_caps, 'r') as f: with open(soc_caps, 'r') as f:
for line in f: for line in f:
if line.strip().startswith('config SOC_WIFI_'): if line.strip().startswith('config SOC_WIFI_'):
if 'config SOC_WIFI_SUPPORTED' in line: 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}') 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') open(sdkconfig, 'w').write(f'CONFIG_SLAVE_IDF_TARGET_{slave_target.upper()}=y\n')
sdkconfig_files.append(sdkconfig) sdkconfig_files.append(sdkconfig)
replaced = re.compile(r'SOC_WIFI_').sub('SLAVE_SOC_WIFI_', line) replaced = re.sub(r'SOC_WIFI_', 'SLAVE_SOC_WIFI_', line)
out.write(f' {replaced}') kconfig_content.append(f' {replaced}')
line = f.readline() # type kconfig_content.append(f' {f.readline()}') # type
out.write(f' {line}') kconfig_content.append(f' {f.readline()}\n') # default
line = f.readline() # default if add_slave:
out.write(f' {line}\n') slave_caps.write(f'\nif SLAVE_IDF_TARGET_{slave_target.upper()}\n\n')
out.write(f'endif # {slave_target.upper()}\n') slave_caps.writelines(kconfig_content)
return [kconfig] + sdkconfig_files 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): slave.write(' endchoice\n')
path = os.path.join(component_path, 'test','smoke_test','components','esp_hosted','Kconfig') return [kconfig, slave_select] + sdkconfig_files
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]
def generate_remote_wifi_api(function_prototypes, component_path): 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(' config ESP_WIFI_REMOTE_ENABLED\n')
f.write(' bool\n') f.write(' bool\n')
f.write(' default y\n\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.soc_wifi_caps.in"\n')
f.write(' orsource "./Kconfig.rpc.in"\n') f.write(' orsource "./Kconfig.rpc.in"\n')
for line1 in lines: 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 = []
files_to_check += generate_test_kconfig(component_path)
files_to_check += generate_kconfig_wifi_caps(idf_path, component_path) files_to_check += generate_kconfig_wifi_caps(idf_path, component_path)
files_to_check += generate_remote_wifi_api(function_prototypes, 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_init(&cfg);
esp_wifi_deinit(); esp_wifi_deinit();
run_all_wifi_apis(); #if CONFIG_SOC_WIFI_SUPPORTED
run_all_wifi_remote_apis(); run_all_wifi_remote_apis();
#else
run_all_wifi_apis();
#endif
} }