Commit Graph

1074 Commits

Author SHA1 Message Date
morris
26a22512eb refactor(hal): extract assist_debug, debug_probe and trace into esp_hal_debug_assist
Move the following modules from the hal component into a new dedicated
esp_hal_debug_assist component, following the esp_hal_timg pattern:

- assist_debug (hal + target-specific LL headers)
- debug_probe (types + target-specific LL headers)
- riscv_trace (hal + types + source + target-specific LL headers)
- trace_ll (esp32/esp32s2/esp32s3 target-specific LL headers)

Update the following components to depend on esp_hal_debug_assist:
esp_system, riscv, bootloader_support, esp_hw_support, esp_riscv_trace

Remove riscv_trace_hal.c from the hal component.
2026-07-21 11:28:11 +08:00
Renz Christian Bagaporo
faca8f56a3 Merge branch 'feat/cmakev2_ulp_full_subproject' into 'master'
feat(ulp): initial support for building ULP projects as full subprojects under CMake v2

See merge request espressif/esp-idf!50134
2026-07-16 21:00:32 +08:00
Renz Bagaporo
5b67ff37cd ci(ulp): temporarily disable legacy ULP apps for buildv2
Keep legacy ULP apps on the CMake v1 build path while buildv2 coverage
is limited to full_subproject ULP apps.

Also add the missing esp_driver_gpio dependency to the esp_pm test app
so buildv2 dependency checks see driver/rtc_io.h explicitly.
2026-07-15 10:17:52 +09:00
Frantisek Hrbata
a9ea4f1105 refactor(ulp): provide a ulp_project.cmake subproject wrapper API
Build ULP full subprojects through a dedicated entry file,
components/ulp/cmake/ulp_project.cmake, that wraps tools/cmakev2/idf.cmake
and layers a small ULP API on top, mirroring the cmakev2 layering:

  ulp_project_init      like idf_project_init (init, detect the ULP type,
                        reset the compile/link options inherited from the app)
  ulp_build_executable  like idf_build_executable, plus the embeddable
                        .bin/.h/.ld artifacts
  ulp_project_default   like idf_project_default (single-executable case)

A child project now includes this one file instead of idf.cmake and calls
these helpers directly, so idf_build_executable is used as-is for the
multi-binary case and the module-path indirection (include(IDFULPProject)
resolved via -DCMAKE_MODULE_PATH) is gone.

As a result:
- IDFULPProjectv2.cmake is removed; its setup moves into the wrapper.
- IDFULPProject.cmake becomes the CMake v1-only entry point.
- The ULP component no longer registers a POST_ELF callback; the binary
  artifacts are produced by ulp_build_executable.
- The v2 full-subproject examples (lp_core, riscv, fsm, multi_binary,
  combined) are updated to the new API.
- The ULP subproject API is documented in build-system-v2.rst.

Also fix a latent bug this exercises: idf_build_library emitted linker
scripts as "-T <name>" relying on a following "-L" search directory. GNU
ld only searches -L directories that precede -T, so the direct
esp32ulp-elf-ld link used for ULP FSM failed to open the script. Emit the
absolute path instead, matching what the CMake v1 ULP build already does.

Finally, replace the parent-argument bypass loop that used to live in
IDFULPProjectv2.cmake with --no-warn-unused-cli on the child configure,
and stop passing the unused IDF_PARENT_BUILD_DIR.

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2026-07-15 09:34:05 +09:00
Renz Bagaporo
a78b61cf19 feat(examples): add full-subproject ULP examples 2026-07-15 09:14:35 +09:00
Ivan Grokhotkov (bot)
5e192672a2 ci(system): add startup test config with LTO enabled
Add an opt_os_lto configuration to the startup test app that enables size
optimization together with link-time and compile-time LTO, and run it across
the supported targets so the LTO build is exercised on real hardware in CI.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-14 19:32:19 +02:00
Erhan Kurubas
cdb91d03d5 test(coredump): re-enable extram stack test for esp32p4-rev3 2026-07-14 11:47:14 +02:00
Erhan Kurubas
f561c9d3cf test(coredump): fix psram memory range for esp32s31 and esp32p4 2026-07-14 11:46:34 +02:00
Erhan Kurubas
4eb0163fb9 Merge branch 'enable_esp32s31_jtag_tests' into 'master'
change(ci): enable esp32s31 jtag tests

Closes IDF-14691, IDF-14692, IDF-14942, and IDFCI-11113

See merge request espressif/esp-idf!50149
2026-07-14 11:39:22 +02:00
Chen Chen
5456956d14 Merge branch 'contrib/github_pr_18832' into 'master'
fix(mocks): add missing `esp_hal_*` includes (GitHub PR)

Closes IDFGH-17968

See merge request espressif/esp-idf!50720
2026-07-14 17:29:12 +08:00
Chen Chen
221f1725c9 fix: update flash encryption mock build check
Use a non-deprecated bootloader support API in the mock build test.
Keep the test focused on validating the generated bootloader support mock.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-14 16:03:22 +08:00
Erhan Kurubas
8ea2d7be4d ci(coredump): enable esp32h4 tests 2026-07-08 23:54:08 +02:00
Erhan Kurubas
4cf35efa35 test(usb_serial_jtag): pin console uart to ttyUSBx port 2026-07-08 12:59:44 +02:00
Marius Vikhammer
ff88ad88a9 Merge branch 'test/linux-full-component-build' into 'master'
test: add Linux full component build app

See merge request espressif/esp-idf!50377
2026-07-08 10:13:12 +08:00
morris
651d6a283f refactor(esp_common): centralize ALIGN_UP/ALIGN_DOWN into esp_macros.h
Remove ~50 duplicate local definitions of ALIGN_UP/ALIGN_DOWN/ALIGN_UP_BY/
ALIGN_DOWN_BY across the codebase and replace them with canonical
ESP_ALIGN_UP/ESP_ALIGN_DOWN from esp_macros.h.
2026-07-06 13:36:06 +08:00
Marius Vikhammer
bd25b59620 test: add Linux full component build app
Exercise unrestricted Linux-target builds so unsupported hardware-only components are caught by CI.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-06 13:26:17 +08:00
Aditya Patwardhan
2468defbff Merge branch 'feat/update_documentation_and_cleanup_for_s31' into 'master'
enable tests and cleanup JIRA references for s31

Closes IDF-14629 and IDF-14628

See merge request espressif/esp-idf!49273
2026-07-06 10:31:47 +05:30
Erhan Kurubas
0586fb67c2 Merge branch 'coredump_test_fixes' into 'master'
Coredump fixes

Closes IDF-15881 and IDF-13849

See merge request espressif/esp-idf!48439
2026-07-03 16:38:00 +02:00
nilesh.kale
9144db695a feat: enable tests and cleanup jira references for s31 2026-07-03 15:31:51 +05:30
Erhan Kurubas
815a38b7f4 test(espcoredump): run test_tcb_corrupted with custom stack 2026-07-02 23:09:05 +02:00
Sudeep Mohanty
6ab1fe654d test(kasan): disable kasan_test under build system v2 2026-07-01 13:17:25 +02:00
Sudeep Mohanty
b3951f4013 fix(test_apps): override config defaults unused by these tests
These tests enable features they do not use -- the VFS console, Wi-Fi task core pinning, and
the DS peripheral -- which shift memory layout, interrupt allocation, and peripheral access
enough to fail them. Override the unused options in each test's sdkconfig and ignore the
resulting unknown-symbol build warnings.
2026-07-01 13:17:25 +02:00
harshal.patil
64e694541b fix(panic): handle absent IROM/DROM alignment gap in spiram-xip memprot tests
The spiram-xip IROM/DROM alignment tests assumed the XIP region always
leaves an alignment gap before the next MMU page: they executed into the
gap and expected an instruction access fault followed by a register dump.
When the section ends exactly on an MMU page boundary there is no gap - the
device prints "<IROM/DROM> alignment gap not added into heap" and returns,
the framework restarts cleanly (esp_restart_noos, no panic), and the test
timed out waiting for a register dump.
2026-06-29 13:00:54 +05:30
Michael (XIAO Xufeng)
c1b218b640 Merge branch 'fix/mmap_cache_flash_wr' into 'master'
fix(mmap): fixed mmap read data wrong when flash being erased/written and cache not disabled

Closes IDFGH-14084

See merge request espressif/esp-idf!29804
2026-06-29 11:44:10 +08:00
Meet Patel
d51e467e7c Merge branch 'feature/add_kasan_support' into 'master'
feat(kasan): add Kernel Address Sanitizer (KASAN) support for ESP-IDF

Closes IDF-13467

See merge request espressif/esp-idf!48106
2026-06-25 11:30:48 +05:30
Meet Patel
383e9adb82 feat(kasan): add Kernel Address Sanitizer (KASAN) support for ESP-IDF
Add KASAN support for detecting heap memory safety bugs (buffer
overflows, underflows, use-after-free) at runtime using compiler
instrumentation and shadow memory. Gated behind
CONFIG_IDF_EXPERIMENTAL_FEATURES, with touch points kept to esp_system
and heap so other components stay untouched.

- Core runtime (esp_system/kasan.c, esp_kasan.h): nibble-based shadow
  memory in DRAM, poison/unpoison, per-access validation, and __asan_*
  stubs; hot-path stubs in IRAM so they stay valid with the flash cache
  off. Shadow init runs before heap bring-up.
- Heap integration (heap/heap_kasan*.c): alloc/free hooks add redzones,
  a quarantine FIFO, and shadow updates.
- Panic handling: disable checks once at the panic handler entry so
  backtrace and stack dumps can read redzones without nested reports.
- Build system: -fsanitize=kernel-address for app code, with HAL, SoC,
  esp_rom, SPI flash, esp_hw_support, bootloader_support, FreeRTOS, and
  heap internals excluded from instrumentation.
- Test app (tools/test_apps/system/kasan_test): Unity tests for
  overflow, underflow, use-after-free, and all sized __asan_* stubs,
  with halt and no-halt configurations.
- Docs: document KASAN in the heap memory debugging guide (EN and CN).
2026-06-24 11:27:00 +05:30
Xiao Xufeng
789ce684c9 fix(mmap): fixed some API read wrong data via mmap when flash being erased/written while XIP on PSRAM
Before:

The cache won't be disabled when XIP on psram. But during flash
erasing/programming, read data will be courrupt.

When XIP in psram is enabled, the image is not mapped to the cache so
usually there will be no flash access. The only way to read from flash
is via the driver or use mmap. The driver has protection during erasing,
while th mmap region not.

Now:

Mmap APIs provide a flag to make mmap->unmap region mutually exclusive
to flash erase/programming when XIP from psram. SPI Flash write APIs
will benefit from this. When the flag is used, no concurrent access to
mapped region will happen while writing; otherwise the cache will be
disable to avoid data corruption.

Most ESP-IDF APIs calls mmap with this flag. As for users calling
mmap-like APIs directly, they can choose whether to enable this by a
flag.

Closes https://github.com/espressif/esp-idf/issues/14897
2026-06-16 01:00:43 +08:00
Konstantin Kondrashov
54b649a0c9 Merge branch 'feature/linux_esp_time_new' into 'master'
feat(esp_timer): Adds support Linux target

Closes IDF-5723

See merge request espressif/esp-idf!49358
2026-06-12 09:05:22 +03:00
Konstantin Kondrashov
f6f24af00a feat(esp_timer): Adds support Linux target 2026-06-11 11:59:25 +03:00
Aditya Patwardhan
67e10e2b56 change(secure_boot): mark ECDSA based Secure Boot V2 as insecure on affected SoCs
ECDSA based Secure Boot V2 is not functional for certain input vectors on
ESP32-C5/C61/H2/P4 and on the preview targets ESP32-H4/H21. RSA based Secure
Boot V2 is the recommended scheme where the SoC supports it. This issue will be
fixed in a future hardware ECO revision; more details will be shared through the
hardware errata document.

A new hidden Kconfig option SECURE_BOOT_V2_ECDSA_INSECURE marks the affected
mass-production SoCs (ESP32-C5/C61/H2/P4). On these SoCs, when hardware Secure
Boot V2 is enabled, the ECDSA (V2) signing scheme is no longer offered by
default; it must be turned on explicitly via SECURE_BOOT_V2_FORCE_ENABLE_ECDSA
under "Allow potentially insecure options" (CONFIG_SECURE_BOOT_INSECURE). App
signing without hardware Secure Boot is not affected. Note that ESP32-C61 has no
RSA based Secure Boot V2, so it has no Secure Boot scheme enabled by default.

The preview targets ESP32-H4 and ESP32-H21 mark ECDSA Secure Boot V2 as not
supported in their SoC capabilities instead of using the option above. As
ESP32-H4 has no other Secure Boot V2 scheme, Secure Boot is disabled entirely on
it; ESP32-H21 retains RSA based Secure Boot V2.

The security documentation keeps the ECDSA Secure Boot V2 content visible and
adds a warning describing the limitation (including that ECDSA Secure Boot V2 on
ESP32-C61 is not recommended for production). CI apps that exercise ECDSA Secure
Boot V2 on the affected SoCs set CONFIG_SECURE_BOOT_V2_FORCE_ENABLE_ECDSA
accordingly.
2026-06-09 16:55:57 +05:30
Guillaume Souchere
a010738ec2 Merge branch 'feat/new-freertos-linux-simulator' into 'master'
feat(freertos): Refactor linux simulator

Closes IDF-8339

See merge request espressif/esp-idf!43564
2026-06-05 12:18:44 +02:00
Marius Vikhammer
1d311a7349 Merge branch 'feature/psram_freertos' into 'master'
feat(freertos): added option for automatically placing task stacks in PSRAM

Closes IDF-15538, IDF-15539, and IDF-15540

See merge request espressif/esp-idf!48953
2026-06-05 09:08:33 +08:00
Guillaume Souchere
78420f2614 feat(freertos): soft-preempting linux simulator 2026-06-04 11:36:21 +02:00
Marius Vikhammer
d21dc8ca2e feat(freertos): added option for automatically placing task stacks in PSRAM
When CONFIG_FREERTOS_PLACE_TASK_STACKS_IN_EXT_RAM is enabled freertos will
now automatically allocate task stacks to PSRAM.
2026-06-04 16:06:52 +08:00
Guillaume Souchere
d670774f5c feat(esp_common): implement composable error code registration via link-time arrays
Refactor the esp_err_to_name() system to decouple esp_common from
higher-level components. Instead of a monolithic generated table,
each component registers its error codes into a dedicated linker
section (.esp_err_msg_table) via idf_define_esp_err_codes() in its
CMakeLists.txt.

New files:
- tools/err_codes_extract.py: extract ESP_ERR_* defines from headers to CSV
- tools/err_codes_to_c.py: generate C source placing entries into linker section
- tools/err_codes_to_rst.py: generate RST documentation from error codes
- tools/cmake/err_codes.cmake: CMake module providing idf_define_esp_err_codes()
- components/esp_common/include/esp_err_codes.h: esp_err_msg_t typedef
- components/esp_common/src/esp_err_to_name_new.c: new lookup using link-time array
- tools/test_apps/build_system/err_codes_check/: CI test app

Changes:
- Remove all optional component dependencies from esp_common/CMakeLists.txt
- Add .esp_err_msg_table section to all 5 linker scripts
- Register error codes in 18 components via idf_define_esp_err_codes()
- Add new scripts to .gitlab/ci/rules.yml build_check patterns
- use new scripts to generate doc and add CI validation
- Update esp_err.rst to add description of composable code registration
2026-05-28 09:53:32 +02:00
Sudeep Mohanty
301eeba878 Merge branch 'task/buildv2_hygiene_and_dep_declarations' into 'master'
fix(components): generic dep-declaration and scope-leakage hygiene exposed by cmakev2

See merge request espressif/esp-idf!48739
2026-05-26 10:18:22 +02:00
Renz Bagaporo
f6bf9206cc test(ci): re-enable skipped ESP32-H4 unicore bootloader tests 2026-05-22 11:10:28 +09:00
Sudeep Mohanty
6084733b91 fix(test_apps/g0_components): skip -D injection when Kconfig is processed
The CMakeLists injects CONFIG_ESP_REV_MIN_FULL and CONFIG_XTAL_FREQ on
the command line because those symbols live in esp_common's Kconfig,
which is outside the G0 closure and is not loaded during a restricted
COMPONENTS build. When every discovered component's Kconfig is processed
(IDF_BUILD_V2) the symbols are already defined via their Kconfig
defaults, and the additional -D would conflict with the existing
definition.

Gate the injection so it only runs when the Kconfig is not processed.
2026-05-21 13:58:27 +02:00
Sudeep Mohanty
6c3d8f8de5 fix(g1_components): force VFS_SUPPORT_IO=n for restricted COMPONENTS build
g1_components builds a minimal COMPONENTS list. When every component's
Kconfig is processed, components/vfs/Kconfig sets VFS_SUPPORT_IO=y by
default, and the conditional requires in esp_stdio and esp_libc pull
vfs, esp_driver_uart, and their transitive deps into the closure.

Add an sdkconfig.defaults that forces the symbol off so the dependency
graph stays restricted to the components actually under test.
2026-05-21 13:58:27 +02:00
Sudeep Mohanty
fb7d325b72 test(g1_components): record dep edges surfaced by DEFERRED optional requires
expected_dep_violations only listed the edges visible when
idf_component_optional_requires was a no-op for the dependency graph.
Under build system v2's DEFERRED mode the call propagates the resolved
dependency back into PRIV_REQUIRES, and the graph also captures
esp_common -> {efuse, bootloader_support, app_update} and esp_system ->
esp_app_format.

Add those entries so the script does not flag them when IDF_BUILD_V2
is set.
2026-05-21 13:58:22 +02:00
Sudeep Mohanty
77b7625b81 fix(test_apps/memprot): declare esp_hal_wdt as a private requirement of main
main/{esp32s2,esp32c3,esp32s3}/test_panic.c uses WDT registers from
esp_hal_wdt. Declare it explicitly so the build works under cmakev2's
strict component isolation.
2026-05-21 10:05:48 +02:00
Sudeep Mohanty
bdcd2d611c fix(test_apps/gdb): declare spi_flash as a private requirement of main
main/hello_world_main.c uses spi_flash headers. Declare spi_flash in
PRIV_REQUIRES so the build works under cmakev2's strict component
isolation.
2026-05-21 10:05:48 +02:00
Marius Vikhammer
ddea7a5c42 Merge branch 'ci/panic_test_split_coredump' into 'master'
ci: trim panic_coredump build-test dependencies

See merge request espressif/esp-idf!48442
2026-05-20 15:36:42 +08:00
C.S.M
e4d26b2572 feat(tsens): Add tsens support on esp32s31 2026-05-18 11:07:58 +08:00
Marius Vikhammer
6377ac3ec2 test(panic): refactor panic test to split out coredump 2026-05-15 11:00:44 +08:00
Mahavir Jain
cee71ceb39 Merge branch 'feat/enable_secure_boot_support_for_esp32h4' into 'master'
feat: enable support for secure boot in esp32h4

Closes IDF-12262 and IDF-12966

See merge request espressif/esp-idf!45603
2026-05-13 19:07:25 +05:30
Marius Vikhammer
1a65724653 Merge branch 'ci/h4_core_sys_test' into 'master'
test(ci): re-enable ESP32-H4 in core system test apps

Closes IDF-15602, IDF-15604, IDF-15605, IDF-15606, and IDF-15612

See merge request espressif/esp-idf!48454
2026-05-13 14:24:16 +08:00
Marius Vikhammer
8f6ea2a1ba test(ci): re-enable ESP32-H4 in core system test apps
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-13 09:00:12 +08:00
Konstantin Kondrashov
485ab9aa29 Merge branch 'feature/recovery_bootloader_support' into 'master'
feat(bootloader): Support recovery bootloader for ESP32P4

Closes IDF-15653 and IDF-13165

See merge request espressif/esp-idf!48215
2026-05-12 23:24:40 +03:00
Marius Vikhammer
96333567e8 ci(system): fixing misc core system H4 tests 2026-05-12 17:12:30 +08:00