Skip to content

cpu/esp32: add ESP32-C6 support#21616

Merged
crasbe merged 13 commits intoRIOT-OS:masterfrom
gschorcht:cpu/esp32/add_esp32_c6
Jul 28, 2025
Merged

cpu/esp32: add ESP32-C6 support#21616
crasbe merged 13 commits intoRIOT-OS:masterfrom
gschorcht:cpu/esp32/add_esp32_c6

Conversation

@gschorcht
Copy link
Copy Markdown
Contributor

Contribution description

This PR adds the support for the ESP32-C6 variant, a RISC-V based ESP32x SoC with WiFi, IEEE802.15.4 and Bluetooth 5 (LE). It includes a board definition for the Espressif development board ESP32-C6-DevKitM-1.

Testing procedure

Basic tests for peripherals and ESP-specific modules have to work. Following peripherals and modules have been tested successfully:

Module esp32c6
shell OK
periph/adc OK
periph/can OK
periph/cpuid OK
periph/dac -
periph/flash OK
periph/flashpage OK
periph/gpio OK
periph/gpio_ll OK
periph/gpio_ll_irq OK
periph/hwrng OK
periph/i2c_sw OK
periph/i2c_hw OK
periph/pm OK
periph/pwm OK
periph/rtt_sys OK
periph/rtt_hw OK
periph/sdmmc -
periph/spi OK
periph/timer OK
esp_hw_counter -
esp_ble_nimble OK
esp_ble_nimble + esp_wifi
esp_eth -
esp_idf_gpio_hal OK
esp_idf_usb -
esp_idf_heap OK
esp_ieee802154 OK
esp_now OK
esp_spi_ram -
esp_wifi OK
esp_wifi_ap OK
esp_wifi_enterprise

[-] not supported by ESP32-H2

Issues/PRs references

@github-actions github-actions bot added Area: doc Area: Documentation Area: tests Area: tests and testing framework Area: build system Area: Build system Area: pkg Area: External package ports Area: CI Area: Continuous Integration of RIOT components Area: tools Area: Supplementary tools Area: boards Area: Board ports Platform: ESP Platform: This PR/issue effects ESP-based platforms Area: cpu Area: CPU/MCU ports Area: Kconfig Area: Kconfig integration labels Jul 18, 2025
@gschorcht gschorcht added Type: new feature The issue requests / The PR implemements a new feature for RIOT CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Jul 18, 2025
@riot-ci
Copy link
Copy Markdown

riot-ci commented Jul 18, 2025

Murdock results

✔️ PASSED

3af41ab tests/esp-ci-boards: add CI board for ESP32-C6

Success Failures Total Runtime
10547 0 10547 10m:10s

Artifacts

Copy link
Copy Markdown
Contributor

@crasbe crasbe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As usual, just some styling stuff and typos. Everything else looks good. Next week I should probably have a C6 board for testing, then I can test the BLE and IEEE 802.15.4 PRs afterwards too.

Thank you for your continued herculean effort on the ESP32s :)

@gschorcht gschorcht force-pushed the cpu/esp32/add_esp32_c6 branch 2 times, most recently from e5e8b5d to 7134725 Compare July 24, 2025 06:28
@crasbe
Copy link
Copy Markdown
Contributor

crasbe commented Jul 25, 2025

My ESP32C6 devkit finally arrived and I can try this PR out. Unfortunately it appears that there are two errors occurring:

cbuec@W11nMate:~/RIOTstuff/riot-esp32c6/RIOT$ BOARD=esp32c6-devkit make -C tests/sys/shell flash term -j
make: Entering directory '/home/cbuec/RIOTstuff/riot-esp32c6/RIOT/tests/sys/shell'
Building application "tests_shell" for "esp32c6-devkit" with CPU "esp32".

fatal: No tags can describe 'c8bb53292d08d6449a09823cf554e62ac839cd8c'.
Try --always, or create some tags.
"make" -C /home/cbuec/RIOTstuff/riot-esp32c6/RIOT/pkg/esp32_sdk/
"make" -C /home/cbuec/RIOTstuff/riot-esp32c6/RIOT/pkg/esptool/
python3 -m venv /home/cbuec/RIOTstuff/riot-esp32c6/RIOT/build/pkg/esptool/venv
/home/cbuec/RIOTstuff/riot-esp32c6/RIOT/build/pkg/esptool/venv/bin/pip install esptool==4.9.0
Collecting esptool==4.9.0
  Using cached esptool-4.9.0-py3-none-any.whl
Collecting bitstring!=4.2.0,>=3.1.6
  Using cached bitstring-4.3.1-py3-none-any.whl (71 kB)
Collecting ecdsa>=0.16.0
  Using cached ecdsa-0.19.1-py2.py3-none-any.whl (150 kB)
Collecting cryptography>=2.1.4
  Using cached cryptography-45.0.5-cp37-abi3-manylinux_2_34_x86_64.whl (4.4 MB)
Collecting PyYAML>=5.1
  Using cached PyYAML-6.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (751 kB)
Collecting argcomplete>=3
  Using cached argcomplete-3.6.2-py3-none-any.whl (43 kB)
Collecting intelhex
  Using cached intelhex-2.3.0-py2.py3-none-any.whl (50 kB)
Collecting pyserial>=3.3
  Using cached pyserial-3.5-py2.py3-none-any.whl (90 kB)
Collecting reedsolo<1.8,>=1.5.3
  Using cached reedsolo-1.7.0-py3-none-any.whl (32 kB)
Collecting bitarray<4.0,>=3.0.0
  Using cached bitarray-3.5.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (312 kB)
Collecting cffi>=1.14
  Using cached cffi-1.17.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (446 kB)
Collecting six>=1.9.0
  Using cached six-1.17.0-py2.py3-none-any.whl (11 kB)
Collecting pycparser
  Using cached pycparser-2.22-py3-none-any.whl (117 kB)
Installing collected packages: reedsolo, pyserial, intelhex, bitarray, six, PyYAML, pycparser, bitstring, argcomplete, ecdsa, cffi, cryptography, esptool
Successfully installed PyYAML-6.0.2 argcomplete-3.6.2 bitarray-3.5.2 bitstring-4.3.1 cffi-1.17.1 cryptography-45.0.5 ecdsa-0.19.1 esptool-4.9.0 intelhex-2.3.0 pycparser-2.22 pyserial-3.5 reedsolo-1.7.0 six-1.17.0
"make" -C /home/cbuec/RIOTstuff/riot-esp32c6/RIOT/boards
"make" -C /home/cbuec/RIOTstuff/riot-esp32c6/RIOT/boards/esp32c6-devkit
"make" -C /home/cbuec/RIOTstuff/riot-esp32c6/RIOT/core
"make" -C /home/cbuec/RIOTstuff/riot-esp32c6/RIOT/core/lib
"make" -C /home/cbuec/RIOTstuff/riot-esp32c6/RIOT/cpu/esp32
"make" -C /home/cbuec/RIOTstuff/riot-esp32c6/RIOT/drivers
"make" -C /home/cbuec/RIOTstuff/riot-esp32c6/RIOT/sys
"make" -C /home/cbuec/RIOTstuff/riot-esp32c6/RIOT/boards/common/init
"make" -C /home/cbuec/RIOTstuff/riot-esp32c6/RIOT/boards/common/esp32c6
"make" -C /home/cbuec/RIOTstuff/riot-esp32c6/RIOT/cpu/esp32/bootloader
"make" -C /home/cbuec/RIOTstuff/riot-esp32c6/RIOT/cpu/esp32/esp-idf
"make" -C /home/cbuec/RIOTstuff/riot-esp32c6/RIOT/cpu/esp32/freertos
"make" -C /home/cbuec/RIOTstuff/riot-esp32c6/RIOT/cpu/esp32/periph
"make" -C /home/cbuec/RIOTstuff/riot-esp32c6/RIOT/cpu/esp_common
"make" -C /home/cbuec/RIOTstuff/riot-esp32c6/RIOT/boards/common/esp32x
"make" -C /home/cbuec/RIOTstuff/riot-esp32c6/RIOT/sys/app_metadata
"make" -C /home/cbuec/RIOTstuff/riot-esp32c6/RIOT/drivers/periph_common
"make" -C /home/cbuec/RIOTstuff/riot-esp32c6/RIOT/sys/auto_init
"make" -C /home/cbuec/RIOTstuff/riot-esp32c6/RIOT/sys/div
"make" -C /home/cbuec/RIOTstuff/riot-esp32c6/RIOT/sys/frac
"make" -C /home/cbuec/RIOTstuff/riot-esp32c6/RIOT/sys/isrpipe
"make" -C /home/cbuec/RIOTstuff/riot-esp32c6/RIOT/cpu/esp_common/esp-riscv
"make" -C /home/cbuec/RIOTstuff/riot-esp32c6/RIOT/sys/libc
"make" -C /home/cbuec/RIOTstuff/riot-esp32c6/RIOT/cpu/esp_common/freertos
"make" -C /home/cbuec/RIOTstuff/riot-esp32c6/RIOT/cpu/esp_common/periph
"make" -C /home/cbuec/RIOTstuff/riot-esp32c6/RIOT/sys/luid
"make" -C /home/cbuec/RIOTstuff/riot-esp32c6/RIOT/cpu/esp32/esp-idf/common
"make" -C /home/cbuec/RIOTstuff/riot-esp32c6/RIOT/sys/newlib_syscalls_default
"make" -C /home/cbuec/RIOTstuff/riot-esp32c6/RIOT/sys/pm_layered
"make" -C /home/cbuec/RIOTstuff/riot-esp32c6/RIOT/sys/preprocessor
"make" -C /home/cbuec/RIOTstuff/riot-esp32c6/RIOT/cpu/esp32/esp-idf/efuse
"make" -C /home/cbuec/RIOTstuff/riot-esp32c6/RIOT/sys/ps
"make" -C /home/cbuec/RIOTstuff/riot-esp32c6/RIOT/sys/random
"make" -C /home/cbuec/RIOTstuff/riot-esp32c6/RIOT/sys/shell
"make" -C /home/cbuec/RIOTstuff/riot-esp32c6/RIOT/cpu/esp32/esp-idf/gpio
"make" -C /home/cbuec/RIOTstuff/riot-esp32c6/RIOT/sys/shell/cmds
"make" -C /home/cbuec/RIOTstuff/riot-esp32c6/RIOT/sys/stdio
"make" -C /home/cbuec/RIOTstuff/riot-esp32c6/RIOT/sys/stdio_uart
"make" -C /home/cbuec/RIOTstuff/riot-esp32c6/RIOT/sys/test_utils/interactive_sync
"make" -C /home/cbuec/RIOTstuff/riot-esp32c6/RIOT/sys/test_utils/print_stack_usage
"make" -C /home/cbuec/RIOTstuff/riot-esp32c6/RIOT/sys/tsrb
"make" -C /home/cbuec/RIOTstuff/riot-esp32c6/RIOT/sys/ztimer
In file included from /home/cbuec/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/riscv32-esp-elf/sys-include/time.h:12,
                 from /home/cbuec/RIOTstuff/riot-esp32c6/RIOT/build/pkg/esp32_sdk/components/newlib/platform_include/time.h:11,
                 from /home/cbuec/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/riscv32-esp-elf/sys-include/sys/time.h:414,
                 from /home/cbuec/RIOTstuff/riot-esp32c6/RIOT/build/pkg/esp32_sdk/components/newlib/platform_include/sys/time.h:21,
                 from /home/cbuec/RIOTstuff/riot-esp32c6/RIOT/cpu/esp32/syscalls.c:22:
/home/cbuec/RIOTstuff/riot-esp32c6/RIOT/cpu/esp32/syscalls.c: In function 'syscalls_init_arch':
/home/cbuec/RIOTstuff/riot-esp32c6/RIOT/cpu/esp32/syscalls.c:467:5: error: 'struct _reent' has no member named '_reserved_0'
  467 |     _REENT_SDIDINIT(_GLOBAL_REENT) = 0;
      |     ^~~~~~~~~~~~~~~
/home/cbuec/RIOTstuff/riot-esp32c6/RIOT/cpu/esp32/syscalls.c:469:5: error: 'struct _reent' has no member named '_reserved_0'
  469 |     _REENT_SDIDINIT(_GLOBAL_REENT) = 1;
      |     ^~~~~~~~~~~~~~~
make[2]: *** [/home/cbuec/RIOTstuff/riot-esp32c6/RIOT/Makefile.base:157: /home/cbuec/RIOTstuff/riot-esp32c6/RIOT/tests/sys/shell/bin/esp32c6-devkit/cpu/syscalls.o] Error 1
make[2]: *** Waiting for unfinished jobs....
esptool.py v4.9.0
Creating esp32c6 image...
Merged 1 ELF section
Successfully created esp32c6 image.
make[1]: *** [/home/cbuec/RIOTstuff/riot-esp32c6/RIOT/Makefile.base:31: ALL--/home/cbuec/RIOTstuff/riot-esp32c6/RIOT/cpu/esp32] Error 2
make: *** [/home/cbuec/RIOTstuff/riot-esp32c6/RIOT/tests/sys/shell/../../../Makefile.include:763: application_tests_shell.module] Error 2
make: Leaving directory '/home/cbuec/RIOTstuff/riot-esp32c6/RIOT/tests/sys/shell'

First it tries to get something with an invalid tag and then it seems to select the wrong SDK. This is odd because I ran the export script, but it does not appear to actually alter the PATH variable:

cbuec@W11nMate:~/RIOTstuff/riot-esp32c6/RIOT$ echo $PATH > before.txt
cbuec@W11nMate:~/RIOTstuff/riot-esp32c6/RIOT$ dist/tools/esptools/export.sh esp32c6
Extending PATH by /home/cbuec/.espressif/tools/riscv32-esp-elf/esp-14.2.0_20241119/riscv32-esp-elf/bin
To make this permanent, add this line to your ~/.bashrc or ~/.profile:
PATH=$PATH:/home/cbuec/.espressif/tools/riscv32-esp-elf/esp-14.2.0_20241119/riscv32-esp-elf/bin
cbuec@W11nMate:~/RIOTstuff/riot-esp32c6/RIOT$ echo $PATH > after.txt
cbuec@W11nMate:~/RIOTstuff/riot-esp32c6/RIOT$ diff before.txt after.txt
cbuec@W11nMate:~/RIOTstuff/riot-esp32c6/RIOT$ echo $PATH
.....:/snap/bin:/home/cbuec/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin:/home/cbuec/.espressif/tools/xtensa-esp32s3-elf/esp-12.2.0_20230208/xtensa-esp32s3-elf/bin:/home/cbuec/.espressif/tools/xtensa-esp-elf/esp-14.2.0_20241119/xtensa-esp-elf/bin

Adding the PATH manually does not change the behavior of the compilation though. It still gives the same error.

What worked is removing the other SDK from my ~/.bashrc, so that it wouldn't select the old SDK.

Not sure what the best way forward is here, but considering the C6 needs a newer SDK, it's not unlikely that $USER will run into the same issue that an old SDK will be present and selected


Searching for the SHA checksum reveals that it's the ESP32 SDK:

PKG_VERSION=c8bb53292d08d6449a09823cf554e62ac839cd8c

It's quite odd though because that IS a valid commit ID of that repository: https://github.com/espressif/esp-idf/tree/c8bb53292d08d6449a09823cf554e62ac839cd8c

The error only occurs on the first compilation run, not on the second one.


Speaking of race conditions: When calling make flash term, the esptool is called even though the compilation fails. It appears to create an image just with the bootloader? (See the trace further up)

This does not happen when not using multiple threads.


I also noticed a typo in the documentation (unrelated to this PR). It should be `export.sh` instead of `install.sh` in this line. https://github.com/RIOT-OS/RIOT/blob/f572bbeef9d1d769ba0c4ec72e356105907bd487/cpu/esp32/doc.md?plain=1#L538

I could make a separate PR, but I want to avoid a merge conflict with your PR.

@crasbe
Copy link
Copy Markdown
Contributor

crasbe commented Jul 25, 2025

I successfully tested tests/sys/shell and tests/drivers/ws281x though :)

@gschorcht
Copy link
Copy Markdown
Contributor Author

fatal: No tags can describe 'c8bb53292d08d6449a09823cf554e62ac839cd8c'.
Try --always, or create some tags.

Really strange. If I remember correctly, I've never seen this error before, even when switching back and forth between different SDK versions.

This is odd because I ran the export script, but it does not appear to actually alter the PATH variable:

🤔 Obviously, we need to improve the script a little. It checks whether the compiler for the architecture is already included in the PATH, but the check is not version-sensitive 😟

More bad

Extending PATH by .espressif/tools/riscv32-esp-elf/esp-14.2.0_20241119/riscv32-esp-elf/bin
To make this permanent, add this line to your ~/.bashrc or ~/.profile:

is printed out even if the path was not added. It suggests that the PATH was extended by the right version of the compiler for the architecture.

@gschorcht
Copy link
Copy Markdown
Contributor Author

The script problem is not new for ESP32-C6, it affects all ESP32x variants and should be fixed, probably as a separate PR.

@crasbe
Copy link
Copy Markdown
Contributor

crasbe commented Jul 25, 2025

As always: Stackoverflow to the rescue! https://stackoverflow.com/a/6445255

This is the command that causes the error:

ESP32_SDK_VER_CMD = $(shell git -C $(PKG_SOURCE_DIR) describe --tags $(PKG_VERSION))

I ran the following command: QUIET=0 QUIETER=0 BOARD=esp32c6-devkit make -C tests/sys/shell flash term and this is (part of) the output:

...
Applying: esp_wifi/esp32c6/esp_adapter: fix missing include
Applying: bt/controller: fix include path for esp32c6
Applying: esp_system/cpu_start: keep PLL running for lower CPU freqencies
Applying: esp_lcd: increase DMA buffer size for better performance
touch /home/cbuec/RIOTstuff/riot-esp32c6/RIOT/build/pkg/esp32_sdk/.pkg-state.git-patched
fatal: No tags can describe 'c8bb53292d08d6449a09823cf554e62ac839cd8c'.
Try --always, or create some tags.
echo "#define IDF_VER \"\"" > /home/cbuec/RIOTstuff/riot-esp32c6/RIOT/build/pkg/esp32_sdk/components/esp_idf_ver.h
make[1]: Leaving directory '/home/cbuec/RIOTstuff/riot-esp32c6/RIOT/pkg/esp32_sdk'
...

As you can see, the result of the git describe command is empty (because an error occured).

This only happens the very first time I call the make command in a fresh repository or after I ran make distclean -j (The multithreading saves you a LOT of time here btw).

In terms of fixing that, I'll have to tinker with the proposed solutions in Stackoverflow some more. But yeah, this is fine for a separate PR. I just wanted to document my experience :)

@crasbe
Copy link
Copy Markdown
Contributor

crasbe commented Jul 25, 2025

Alternatively to make distclean, you can just delete pkg/esp32_sdk. That's even faster.

@crasbe
Copy link
Copy Markdown
Contributor

crasbe commented Jul 25, 2025

I found the issue. Apparently the SHA1 sum is not correct for the v5.4 tag: https://github.com/espressif/esp-idf/tree/v5.4 has 67c1de1eebe095d554d281952fde63c16ee2dca0 instead of c8bb53292d08d6449a09823cf554e62ac839cd8c. Changing that fixes the error message.

This also results in build/pkg/esp32_sdk/components/esp_idf_ver.h having the right version.

@gschorcht
Copy link
Copy Markdown
Contributor Author

gschorcht commented Jul 25, 2025

This only happens the very first time I call the make command in a fresh repository or after I ran make distclean -j (The multithreading saves you a LOT of time here btw).

Hm, I can't reproduce it after removing build/pkg/esp32_sdk:

BOARD=esp32c6-devkit make -j4 -C tests/sys/shell
make: Verzeichnis „tests/sys/shell“ wird betreten
Building application "tests_shell" for "esp32c6-devkit" with CPU "esp32".

git-cache: cloning from cache. tag=commitc8bb53292d08d6449a09823cf554e62ac839cd8c-1228706
"make" -C /home/gs/src/RIOT-Xtensa-ESP.esp-idf-5.4/pkg/esp32_sdk/ 
"make" -C /home/gs/src/RIOT-Xtensa-ESP.esp-idf-5.4/pkg/esptool/ 

Might it be that it is because I use git-cache so that the repository is cloned from the local Git Cache and doesn't take time?

@crasbe
Copy link
Copy Markdown
Contributor

crasbe commented Jul 25, 2025

With git-cache, this is the state of the repository:

cbuec@W11nMate:~/RIOTstuff/riot-esp32c6/RIOT/build/pkg/esp32_sdk$ git status
Not currently on any branch.
Untracked files:
  (use "git add <file>..." to include in what will be committed)
        .pkg-state.git-downloaded
        .pkg-state.git-patched
        .pkg-state.git-patched.d
        .pkg-state.git-prepared
        components/esp_idf_ver.h

nothing added to commit but untracked files present (use "git add" to track)
cbuec@W11nMate:~/RIOTstuff/riot-esp32c6/RIOT/build/pkg/esp32_sdk$ git describe --tags
v5.4-343-gfba737fc15

So what does git-cache do differently than the normal process?

I know that this is going beyond this PR, but the fact is that if one is not using git-cache, the components/esp_idf_ver.h file is not correctly generated. Not sure what consequences this has, but if it's not at least somewhat important, you wouldn't create it in the Makefile 😅

@gschorcht
Copy link
Copy Markdown
Contributor Author

cbuec@W11nMate:~/RIOTstuff/riot-esp32c6/RIOT/build/pkg/esp32_sdk$ git describe --tags
v5.4-343-gfba737fc15

fba737fc15 is the commit of your patched version of the SDK. But you get a valid output from git describe.

Not sure what consequences this has, but if it's not at least somewhat important, you wouldn't create it in the Makefile

ESP-IDF just requires that IDF_VER is defined as any version string which becomes part of the meta-data in the application image.

@gschorcht
Copy link
Copy Markdown
Contributor Author

gschorcht commented Jul 25, 2025

This is what the git status looks for me:

cbuec@W11nMate:~/RIOTstuff/riot-esp32c6/RIOT/build/pkg/esp32_sdk$ git status
HEAD detached from c8bb53292d
Untracked files:
  (use "git add <file>..." to include in what will be committed)
        .pkg-state.git-downloaded
        .pkg-state.git-patched
        .pkg-state.git-patched.d
        .pkg-state.git-prepared
        components/esp_idf_ver.h

nothing added to commit but untracked files present (use "git add" to track)

Setting the Commit ID to the latest commit in the release branch does not work because patching fails, but setting it for example to tag v5.4.1 works:

It doesn't seem that this one failed. It would have been interesting what git describe --tags said in this case.

@crasbe
Copy link
Copy Markdown
Contributor

crasbe commented Jul 25, 2025

Okay, this is mean:

RIOT/pkg/pkg.mk

Lines 154 to 177 in 51958b3

ifneq (,$(GIT_CACHE_RS))
$(PKG_SOURCE_DIR)/.git: $(PKG_SPARSE_TAG) | $(PKG_CUSTOM_PREPARED)
$(if $(QUIETER),,$(info [INFO] cloning $(PKG_NAME)))
$(Q)rm -Rf $(PKG_SOURCE_DIR)
$(Q)$(GIT_CACHE_RS) clone --commit $(PKG_VERSION) $(addprefix --sparse-add ,$(PKG_SPARSE_PATHS)) -- $(PKG_URL) $(PKG_SOURCE_DIR)
else ifeq ($(GIT_CACHE_DIR),$(wildcard $(GIT_CACHE_DIR)))
$(PKG_SOURCE_DIR)/.git: | $(PKG_CUSTOM_PREPARED)
$(if $(QUIETER),,$(info [INFO] cloning $(PKG_NAME)))
$(Q)rm -Rf $(PKG_SOURCE_DIR)
$(Q)mkdir -p $(PKG_SOURCE_DIR)
$(Q)$(GITCACHE) clone $(PKG_URL) $(PKG_VERSION) $(PKG_SOURCE_DIR)
else
# redirect stderr so git sees a pipe and not a terminal see https://github.com/git/git/blob/master/progress.c#L138
$(PKG_SOURCE_DIR)/.git: | $(PKG_CUSTOM_PREPARED)
$(if $(QUIETER),,$(info [INFO] cloning without cache $(PKG_NAME)))
$(Q)rm -Rf $(PKG_SOURCE_DIR)
$(Q)mkdir -p $(PKG_SOURCE_DIR)
$(Q)git init $(GIT_QUIET) $(PKG_SOURCE_DIR)
$(Q)$(GIT_IN_PKG) remote add origin $(PKG_URL)
$(Q)$(GIT_IN_PKG) config extensions.partialClone origin
$(Q)$(GIT_IN_PKG) config advice.detachedHead false
$(Q)$(GIT_IN_PKG) fetch $(GIT_QUIET) --depth=1 -t --filter=blob:none origin $(PKG_VERSION)
$(Q)$(GIT_IN_PKG) checkout $(GIT_QUIET) $(PKG_VERSION) 2>&1 | cat
endif

When a git cache is present, the pkg.mk will make a full clone instead of just the shallow clone with --depth 1. And the latter is the reason why the git describe fails.

Removing the --depth=1 from line 175 fixes the issue:

cbuec@W11nMate:~/RIOTstuff/riot-esp32c6/RIOT/build/pkg/esp32_sdk$ git status
HEAD detached from c8bb53292d
Untracked files:
  (use "git add <file>..." to include in what will be committed)
        .pkg-state.git-downloaded
        .pkg-state.git-patched
        .pkg-state.git-patched.d
        .pkg-state.git-prepared
        components/esp_idf_ver.h

nothing added to commit but untracked files present (use "git add" to track)
cbuec@W11nMate:~/RIOTstuff/riot-esp32c6/RIOT/build/pkg/esp32_sdk$ git describe
v5.4-343-g489632ce97

Now.. obviously that's not a good idea, because for some repositories that would increase the clone time MASSIVELY.
What's a better idea is unshallowing the repository. Unfortunately that means that git will fetch the history, which is about 65MB at the moment.
But I really don't see another possibility at the moment to be honest.

With a fast internet connection, this adds about 16 seconds to the build process, but of course only the first time.

I'll create a separate PR for this, because this is already derailed a bit 😅

@crasbe
Copy link
Copy Markdown
Contributor

crasbe commented Jul 25, 2025

More bad

Extending PATH by .espressif/tools/riscv32-esp-elf/esp-14.2.0_20241119/riscv32-esp-elf/bin
To make this permanent, add this line to your ~/.bashrc or ~/.profile:

is printed out even if the path was not added. It suggests that the PATH was extended by the right version of the compiler for the architecture.

My bad, I can't read the documentation. There is a smöl dot in front of the export script that means that the script is "sourced". I did not know what "sourcing a script" means, but apparently it means that it's run in the same shell as the calling shell and not in a sub-shell.

I'll create another PR to make the documentation more explicit and I have some lines of code to add to the script to check if it was "sourced".

Copy link
Copy Markdown
Contributor

@crasbe crasbe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since all the sidequests are now addressed in separate PRs, this is good to go. Please squash :)

@gschorcht gschorcht force-pushed the cpu/esp32/add_esp32_c6 branch 2 times, most recently from d45a263 to 3af41ab Compare July 28, 2025 18:14
@github-actions github-actions bot removed the Area: CI Area: Continuous Integration of RIOT components label Jul 28, 2025
@crasbe crasbe added this pull request to the merge queue Jul 28, 2025
Merged via the queue into RIOT-OS:master with commit 0005683 Jul 28, 2025
25 checks passed
@gschorcht
Copy link
Copy Markdown
Contributor Author

gschorcht commented Jul 29, 2025

Thanks for reviewing and approving the PR. Now we support more ESP32 variants than the Zephyr project 😉

@gschorcht gschorcht deleted the cpu/esp32/add_esp32_c6 branch July 30, 2025 12:35
@benpicco benpicco added this to the Release 2025.10 milestone Dec 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: boards Area: Board ports Area: build system Area: Build system Area: cpu Area: CPU/MCU ports Area: doc Area: Documentation Area: Kconfig Area: Kconfig integration Area: pkg Area: External package ports Area: tests Area: tests and testing framework Area: tools Area: Supplementary tools CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Platform: ESP Platform: This PR/issue effects ESP-based platforms Type: new feature The issue requests / The PR implemements a new feature for RIOT

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants