Skip to content

ESP32: Remove ESP IDF SDK's defines from Swift compiler invocation (-DXYZ=ABC) #199

@ole

Description

@ole

I can successfully build the blink example for the ESP32 IDF SDK and flash it to an ESP32-C6. Great!

During the build, I'm seeing a few warnings from the Swift compiler that it cannot handle defines of the form -DABC=XYZ:

idf.py build

Output:

…
[530/540] Building Swift Module '__idf_main' with 2 sources
warning: conditional compilation flags do not have values in Swift; they are either present or absent (rather than 'IDF_VER="60720790"')
warning: conditional compilation flags do not have values in Swift; they are either present or absent (rather than 'MBEDTLS_CONFIG_FILE="mbedtls/esp_config.h"')
warning: conditional compilation flags do not have values in Swift; they are either present or absent (rather than 'MBEDTLS_MAJOR_VERSION=4')
warning: conditional compilation flags do not have values in Swift; they are either present or absent (rather than 'SOC_MMU_PAGE_SIZE=CONFIG_MMU_PAGE_SIZE')
warning: conditional compilation flags do not have values in Swift; they are either present or absent (rather than 'SOC_XTAL_FREQ_MHZ=CONFIG_XTAL_FREQ')
warning: conditional compilation flags do not have values in Swift; they are either present or absent (rather than 'TF_PSA_CRYPTO_USER_CONFIG_FILE="mbedtls/esp_config.h"')
[532/540] Performing configure step for 'bootloader'
…

It's not a big deal, but ideally I'd like to get rid of these warnings.

Does anyone know how to either:

  1. Remove these defines (presumably set by the IDF SDK CMake config) from the Swift compiler invocation entirely, or
  2. Pass these defines only to C files via -Xcc, similar to what the current CMake file does for -march and -mabi

I tried for two hours to get this to work, but I'm not familiar enough with either CMake or the ESP SDK config to even figure out in which CMake properties these values are stored and how they end up in the Swift compiler invocation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions