From 28ac778099c6b09dcff9cfe31d55697fc14e8688 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Wed, 29 Jun 2022 22:47:02 +0200 Subject: [PATCH 1/3] ci: check_public_headers: run the build in a temporary directory this allows running multiple builds for different targets --- tools/ci/check_public_headers.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/tools/ci/check_public_headers.py b/tools/ci/check_public_headers.py index 1ff6a3410d..037352d6d3 100644 --- a/tools/ci/check_public_headers.py +++ b/tools/ci/check_public_headers.py @@ -235,8 +235,14 @@ class PublicHeaderChecker: def list_public_headers(self, ignore_dirs, ignore_files, only_dir=None): idf_path = os.getenv('IDF_PATH') project_dir = os.path.join(idf_path, 'examples', 'get-started', 'blink') - subprocess.check_call(['idf.py', 'reconfigure'], cwd=project_dir) - build_commands_json = os.path.join(project_dir, 'build', 'compile_commands.json') + build_dir = tempfile.mkdtemp() + sdkconfig = os.path.join(build_dir, 'sdkconfig') + try: + os.unlink(os.path.join(project_dir, 'sdkconfig')) + except FileNotFoundError: + pass + subprocess.check_call(['idf.py', '-B', build_dir, f'-DSDKCONFIG={sdkconfig}', 'reconfigure'], cwd=project_dir) + build_commands_json = os.path.join(build_dir, 'compile_commands.json') with open(build_commands_json, 'r', encoding='utf-8') as f: build_command = json.load(f)[0]['command'].split() include_dir_flags = [] @@ -249,13 +255,13 @@ class PublicHeaderChecker: include_dirs.append(item[2:]) # Removing the leading "-I" if item.startswith('-D'): include_dir_flags.append(item.replace('\\','')) # removes escaped quotes, eg: -DMBEDTLS_CONFIG_FILE=\\\"mbedtls/esp_config.h\\\" - include_dir_flags.append('-I' + os.path.join(project_dir, 'build', 'config')) + include_dir_flags.append('-I' + os.path.join(build_dir, 'config')) include_dir_flags.append('-DCI_HEADER_CHECK') - sdkconfig_h = os.path.join(project_dir, 'build', 'config', 'sdkconfig.h') + sdkconfig_h = os.path.join(build_dir, 'config', 'sdkconfig.h') # prepares a main_c file for easier sdkconfig checks and avoid compilers warning when compiling headers directly with open(sdkconfig_h, 'a') as f: f.write('#define IDF_SDKCONFIG_INCLUDED') - main_c = os.path.join(project_dir, 'build', 'compile.c') + main_c = os.path.join(build_dir, 'compile.c') with open(main_c, 'w') as f: f.write('#if defined(IDF_CHECK_SDKCONFIG_INCLUDED) && ! defined(IDF_SDKCONFIG_INCLUDED)\n' '#error CONFIG_VARS_USED_WHILE_SDKCONFIG_NOT_INCLUDED\n' From fefbf6a5b30e688c3e6b8af4425a0729ae111f2a Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Wed, 29 Jun 2022 22:48:16 +0200 Subject: [PATCH 2/3] ci: check_public_headers: exclude sections generated on RISC-V target --- tools/ci/check_public_headers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/ci/check_public_headers.py b/tools/ci/check_public_headers.py index 037352d6d3..427e8dacc0 100644 --- a/tools/ci/check_public_headers.py +++ b/tools/ci/check_public_headers.py @@ -88,7 +88,7 @@ class PublicHeaderChecker: self.error_macro = re.compile(r'#error') self.error_orphan_kconfig = re.compile(r'#error CONFIG_VARS_USED_WHILE_SDKCONFIG_NOT_INCLUDED') self.kconfig_macro = re.compile(r'\bCONFIG_[A-Z0-9_]+') - self.assembly_nocode = r'^\s*(\.file|\.text|\.ident).*$' + self.assembly_nocode = r'^\s*(\.file|\.text|\.ident|\.option|\.attribute).*$' self.check_threads = [] self.job_queue = queue.Queue() From 4c3dec9705052142116471df6830047b3bfbd457 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Wed, 29 Jun 2022 22:49:51 +0200 Subject: [PATCH 3/3] ci: check_public_headers: run for all targets --- .gitlab/ci/pre_check.yml | 6 +- tools/ci/check_public_headers_exceptions.txt | 89 ++++++++++++++++++++ 2 files changed, 94 insertions(+), 1 deletion(-) diff --git a/.gitlab/ci/pre_check.yml b/.gitlab/ci/pre_check.yml index 2c03670d12..8d2f2869b3 100644 --- a/.gitlab/ci/pre_check.yml +++ b/.gitlab/ci/pre_check.yml @@ -111,7 +111,11 @@ check_public_headers: tags: - build script: - - python tools/ci/check_public_headers.py --jobs 4 --prefix xtensa-esp32-elf- + - IDF_TARGET=esp32 python tools/ci/check_public_headers.py --jobs 4 --prefix xtensa-esp32-elf- + - IDF_TARGET=esp32s2 python tools/ci/check_public_headers.py --jobs 4 --prefix xtensa-esp32s2-elf- + - IDF_TARGET=esp32s3 python tools/ci/check_public_headers.py --jobs 4 --prefix xtensa-esp32s3-elf- + - IDF_TARGET=esp32c3 python tools/ci/check_public_headers.py --jobs 4 --prefix riscv32-esp-elf- + - IDF_TARGET=esp32c2 python tools/ci/check_public_headers.py --jobs 4 --prefix riscv32-esp-elf- check_chip_support_components: extends: diff --git a/tools/ci/check_public_headers_exceptions.txt b/tools/ci/check_public_headers_exceptions.txt index 92798b815a..6ee4a38868 100644 --- a/tools/ci/check_public_headers_exceptions.txt +++ b/tools/ci/check_public_headers_exceptions.txt @@ -3,6 +3,9 @@ components/xtensa/include/xtensa/ components/xtensa/include/ components/xtensa/esp32/include/xtensa/config/ +components/xtensa/esp32s2/include/xtensa/config/ +components/xtensa/esp32s3/include/xtensa/config/ + components/newlib/platform_include/ @@ -34,7 +37,12 @@ components/lwip/lwip/src/include/lwip/priv/memp_std.h components/lwip/include/lwip/sockets.h components/lwip/lwip/src/include/lwip/prot/nd6.h +## Header produced non-zero object: components/esp_phy/esp32/include/phy_init_data.h +components/esp_phy/esp32s2/include/phy_init_data.h +components/esp_phy/esp32s3/include/phy_init_data.h +components/esp_phy/esp32c3/include/phy_init_data.h +components/esp_phy/esp32c2/include/phy_init_data.h components/spi_flash/include/spi_flash_chip_issi.h components/spi_flash/include/spi_flash_chip_mxic.h @@ -146,3 +154,84 @@ components/ulp/include/ulp_common.h components/ulp/include/esp32s2/ulp_riscv.h components/mbedtls/esp_crt_bundle/include/esp_crt_bundle.h components/wifi_provisioning/include/wifi_provisioning/scheme_softap.h + +### To be fixed: files which don't compile for esp32s2 target: + +components/driver/deprecated/driver/adc_deprecated.h +components/driver/include/driver/can.h +components/driver/include/driver/mcpwm.h +components/efuse/esp32s2/include/esp_efuse_table.h +components/esp_psram/include/esp32/himem.h +components/esp_rom/include/esp32/rom/ets_sys.h +components/esp_rom/include/esp32/rom/rtc.h +components/esp_rom/include/esp32/rom/uart.h +components/soc/esp32s2/include/soc/apb_ctrl_struct.h +components/soc/esp32s2/include/soc/apb_saradc_struct.h +components/soc/esp32s2/include/soc/efuse_struct.h +components/soc/esp32s2/include/soc/gpio_sd_struct.h +components/soc/esp32s2/include/soc/gpio_struct.h +components/soc/esp32s2/include/soc/i2c_struct.h +components/soc/esp32s2/include/soc/i2s_struct.h +components/soc/esp32s2/include/soc/ledc_struct.h +components/soc/esp32s2/include/soc/rtc_i2c_struct.h +components/soc/esp32s2/include/soc/rtc_io_struct.h +components/soc/esp32s2/include/soc/sens_struct.h +components/soc/esp32s2/include/soc/spi_mem_struct.h +components/soc/esp32s2/include/soc/spi_struct.h +components/soc/esp32s2/include/soc/syscon_struct.h +components/soc/esp32s2/include/soc/uart_struct.h +components/soc/esp32s2/include/soc/uhci_struct.h +components/usb/include/esp_private/usb_phy.h +components/usb/include/usb/usb_types_stack.h + +### To be fixed: files which don't compile for esp32s3 target: + +components/driver/include/driver/dac_common.h +components/efuse/esp32s3/include/esp_efuse_table.h +components/soc/esp32s3/include/soc/world_controller_struct.h +components/soc/esp32s3/usb_periph.h + +### To be fixed: files which don't compile for esp32c3 target: + +components/driver/include/driver/touch_pad.h +components/efuse/esp32c3/include/esp_efuse_table.h +components/esp_system/port/include/private/esp_private/trax.h +components/espcoredump/include/port/xtensa/esp_core_dump_summary_port.h +components/riscv/include/esp_private/panic_reason.h +components/riscv/include/riscv/interrupt.h +components/riscv/include/riscv/rvruntime-frames.h +components/soc/esp32c3/include/soc/apb_ctrl_struct.h +components/soc/esp32c3/include/soc/apb_saradc_struct.h +components/soc/esp32c3/include/soc/efuse_struct.h +components/soc/esp32c3/include/soc/gpio_sd_struct.h +components/soc/esp32c3/include/soc/i2s_struct.h +components/soc/esp32c3/include/soc/ledc_struct.h +components/soc/esp32c3/include/soc/rtc_cntl_struct.h +components/soc/esp32c3/include/soc/rtc_i2c_struct.h +components/soc/esp32c3/include/soc/spi_mem_struct.h +components/soc/esp32c3/include/soc/spi_struct.h +components/soc/esp32c3/include/soc/syscon_struct.h +components/soc/esp32c3/include/soc/uart_struct.h +components/soc/esp32c3/include/soc/uhci_struct.h + +### To be fixed: files which don't compile for esp32c2 target: + +components/driver/deprecated/driver/i2s_types_legacy.h +components/driver/deprecated/driver/i2s.h +components/driver/deprecated/driver/rmt_types_legacy.h +components/driver/deprecated/driver/rmt.h +components/driver/include/driver/i2s_common.h +components/driver/include/driver/i2s_pdm.h +components/driver/include/driver/i2s_std.h +components/driver/include/driver/i2s_tdm.h +components/driver/include/driver/rmt_common.h +components/driver/include/driver/rmt_encoder.h +components/driver/include/driver/rmt_rx.h +components/driver/include/driver/rmt_tx.h +components/driver/include/driver/rmt_types.h +components/driver/include/driver/sigmadelta.h +components/efuse/esp32c2/include/esp_efuse_table.h +components/soc/esp32c2/include/soc/rtc_cntl_struct.h +components/soc/esp32c2/include/soc/spi_mem_struct.h +components/soc/esp32c2/include/soc/syscon_struct.h +components/soc/esp32c2/include/soc/uart_struct.h