← index #6950Issue #18497
Off-topic · high · value 1.247
QUERY · ISSUE

esp32: CMake not recognizing menuconfig output

openby bertelschmittopened 2021-02-23updated 2021-04-13
port-esp32

I am compiling for GENERIC_SPIRAM. The new CMake version requires (among other things) the size of the flash memory to be set via menuconfig. However, on running make, the settings written to …/build/sdkconfig are not reflected in .../build-GENERIC_SPIRAM/sdkconfig or .../build-GENERIC_SPIRAM/sdkconfig.combined.
For instance, setting the flash size to 16MB in menuconfig produces this in …/build/sdkconfig

# CONFIG_ESPTOOLPY_FLASHSIZE_1MB is not set
# CONFIG_ESPTOOLPY_FLASHSIZE_2MB is not set
# CONFIG_ESPTOOLPY_FLASHSIZE_4MB is not set
# CONFIG_ESPTOOLPY_FLASHSIZE_8MB is not set
CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y
CONFIG_ESPTOOLPY_FLASHSIZE="16MB"

However, the pertinent entries in …/build-GENERIC_SPIRAM/sdkconfig read like this:

# CONFIG_ESPTOOLPY_FLASHSIZE_1MB is not set
# CONFIG_ESPTOOLPY_FLASHSIZE_2MB is not set
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
# CONFIG_ESPTOOLPY_FLASHSIZE_8MB is not set
# CONFIG_ESPTOOLPY_FLASHSIZE_16MB is not set
CONFIG_ESPTOOLPY_FLASHSIZE="4MB"
CONFIG_ESPTOOLPY_FLASHSIZE_DETECT=y

This causes compilation of code for 4MB, which is not desired.
Apparently, make picks up defaults from /esp32/boards/sdkconfig.base while ignoring the settings produced by menuconfig.

If I make the following edit in /esp32/boards/sdkconfig.base, the compile finishes successfully:

#CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y

However, this is not the desired solution

CANDIDATE · ISSUE

make submodules fails if BOARD is set to enable USB

closedby kdschlosseropened 2025-12-01updated 2025-12-03
bugport-esp32

Port, board and/or hardware

esp32 port generic S3

MicroPython version

master branch

Reproduction

building for the Generic S3 using the SPIRAM_OCT board variant.

Expected behaviour

I am expecting it to compile.

Observed behaviour

-- Building ESP-IDF components for target esp32s3
"idf_component.yml" file was found for components:
micropython/ports/esp32/main
However, the component manager is not enabled.
Failed to resolve component 'espressif__tinyusb'
Call Stack (most recent call first):
esp32_common.cmake:102 (idf_component_get_property)
main/CMakeLists.txt:11 (include)
make: Leaving directory 'micropython/ports/esp32'
HINT: The component 'espressif__tinyusb' could not be found. This could be because: component name was misspelled, the component was not added to the build, the component has been moved to the IDF component manager, the component has been removed and refactored into some other component or the component may not be supported by the selected target.
Please look out for component in 'https://components.espressif.com' and add using 'idf.py add-dependency' command.
Refer to the migration guide for more details about moved components.
Refer to the build-system guide for more details about how components are found and included in the build.

Additional Information

I noticed this in the makefile for the ESP32 port

submodules:
    $(Q)IDF_COMPONENT_MANAGER=0 idf.py $(IDFPY_FLAGS) -B $(BUILD)/submodules -D UPDATE_SUBMODULES=1 reconfigure

I am going to hazard a guess that when running the reconfigure the esp32_common.cmake file gets processed and when it does you have this bit of code inside that file.


if(NOT DEFINED MICROPY_PY_TINYUSB)
    if(CONFIG_IDF_TARGET_ESP32S2 OR CONFIG_IDF_TARGET_ESP32S3 OR CONFIG_IDF_TARGET_ESP32P4)
        set(MICROPY_PY_TINYUSB ON)
    endif()
endif()

and then this

if(MICROPY_PY_TINYUSB)
    string(TOUPPER OPT_MCU_${IDF_TARGET} tusb_mcu)

    list(APPEND MICROPY_DEF_TINYUSB
        CFG_TUSB_MCU=${tusb_mcu}
    )

    list(APPEND MICROPY_SOURCE_TINYUSB
        ${MICROPY_DIR}/shared/tinyusb/mp_usbd.c
        ${MICROPY_DIR}/shared/tinyusb/mp_usbd_cdc.c
        ${MICROPY_DIR}/shared/tinyusb/mp_usbd_descriptor.c
        ${MICROPY_DIR}/shared/tinyusb/mp_usbd_runtime.c
    )

    list(APPEND MICROPY_INC_TINYUSB
        ${MICROPY_DIR}/shared/tinyusb/
    )

    # Build the Espressif tinyusb component with MicroPython shared/tinyusb/tusb_config.h
    idf_component_get_property(tusb_lib espressif__tinyusb COMPONENT_LIB)
    target_include_directories(${tusb_lib} PRIVATE
        ${MICROPY_DIR}/shared/tinyusb
        ${MICROPY_DIR}
        ${MICROPY_PORT_DIR}
        ${MICROPY_BOARD_DIR})
endif()

the line where it is specifically failing is

    idf_component_get_property(tusb_lib espressif__tinyusb COMPONENT_LIB)

The esp32_common.cmake file is being imported in the main/CMakeLists.txt file which idf.py is processing.

Code of Conduct

Yes, I agree

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied