Commit Graph
55 Commits
Author SHA1 Message Date
Meet Patel 108db1bc12 test(ulp): snapshot LP ADC raw reads after GPIO settle
HP was asserting a live LP buffer and starting firmware before ADC/GPIO setup.
That produced leftover-high values and print/assert mismatches on pull-down.

Wait 100 ms for analog settle, then wait for completed scans with a wall-clock
timeout (pdMS_TO_TICKS(1) is zero at a 10 ms tick). Copy a local snapshot and
assert it; do not retry until a reading is in range. Deinit on teardown so a
failed raw-read cannot abort the following stress case.
2026-09-04 11:38:08 +05:30
Meet Patel 81155fe014 test(freertos): give pinned-create tests more stack
2048 bytes is tight once Unity asserts and yields run on the created task.
2026-08-27 15:38:04 +05:30
Meet Patel 47378485c6 test(freertos): cover xTaskCreatePinnedToCore pinning semantics
Existing cases used pinned create only as setup for utility queries.
Assert that dynamic and static create keep the task on the requested
core across yields, and that tskNO_AFFINITY stays unpinned.
2026-08-25 10:48:11 +05:30
Meet Patel 5653dce94c fix(heap): use critical section for task tracking locks 2026-08-24 17:22:59 +08:00
Meet Patel 248c242eb9 fix(efuse): correct MAC_EXT byte order on ESP32-C5 and ESP32-H21
A single 16-bit MAC_EXT field was read little-endian, reversing FF:FE
used for IEEE 802.15.4 EUI 64 extension.

Closes https://github.com/espressif/esp-idf/issues/18955
2026-08-17 22:58:07 +05:30
Meet Patel cd876edf5c Merge branch 'test/idf-additions-withcaps' into 'master'
test(freertos): strengthen IDF additions WithCaps coverage

See merge request espressif/esp-idf!50804
2026-07-23 13:48:18 +05:30
Meet Patel 6062cfd0a1 test(freertos): harden WithCaps OOM sizing and leak checks
Derive OOM sizes from heap totals to avoid size_t overflow, and rely on
Unity setUp/tearDown for create/delete leak detection.
2026-07-16 10:39:25 +05:30
Meet Patel 9131bdab3a test(freertos): strengthen IDF additions WithCaps coverage
Exercise functional use, OOM failure paths, heap restoration, and SPIRAM
placement for WithCaps helpers beyond create-only smoke checks.
2026-07-16 10:12:58 +05:30
Meet Patel bb3406e092 Merge branch 'test/idf-additions-coverage' into 'master'
test(esp_system): relocate FreeRTOS tick hook test

See merge request espressif/esp-idf!50441
2026-07-16 10:00:05 +05:30
Meet Patel 25fe69f946 Merge branch 'bugfix/pthread_find_key_uaf' into 'master'
fix(pthread,ulp): harden TLS key lookup and ULP bss_size validation

Closes SEC-248 and SEC-1122

See merge request espressif/esp-idf!50410
2026-07-11 23:18:21 +05:30
Meet Patel 10c888c859 test(esp_system): relocate FreeRTOS tick hook test
Tick hook registration lives in esp_system, so its scheduler-suspension
coverage belongs in the esp_system unity test app rather than the
freertos IDF additions suite.
2026-07-07 10:11:18 +05:30
Meet Patel 2fd3ccbb19 Merge branch 'test/idf-additions-coverage' into 'master'
test(freertos): expand IDF additions test coverage

See merge request espressif/esp-idf!50303
2026-07-07 09:44:56 +05:30
Meet Patel 8c92af6201 fix(ulp): validate bss_size before zeroing ULP BSS region
Crafted ULP binaries could specify a bss_size larger than the reserved
memory, causing memset to zero past the ULP region boundary.
2026-07-06 22:56:21 +05:30
Meet Patel bf0e452b95 fix(pthread): avoid use-after-free when looking up TLS keys
Concurrent pthread_key_delete could free a key entry after find_key
released the lock but before callers read or invoked its destructor.
2026-07-06 15:29:52 +05:30
Meet Patel d0e018cf6b test(freertos): expand IDF additions test coverage
Improve coverage of idf_additions.h task utility APIs and correct
WithCaps delete usage in existing tests to avoid heap leaks.
2026-07-06 10:45:53 +05:30
Meet Patel 8da676cd87 Merge branch 'feat/ulp_adc_two_channel_example' into 'master'
feat(ulp): demonstrate multi-channel ADC in ULP-RISC-V example

See merge request espressif/esp-idf!50246
2026-07-02 10:00:21 +05:30
Meet Patel 69d755b1e6 feat(ulp): demonstrate multi-channel ADC in ULP-RISC-V example 2026-07-01 14:09:05 +05:30
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
Meet Patel a75231d458 Merge branch 'feat/ulp_adc_multi_channel' into 'master'
feat(ulp): add multi-channel ADC init for ULP

Closes IDFGH-9831 and IDF-15815

See merge request espressif/esp-idf!49671
2026-06-22 10:09:16 +05:30
Meet Patel d72bdfedc9 fix(ulp): force SW channel control in ULP-RISC-V ADC read
On ESP32-S2/S3 the ULP-RISC-V ADC shares the RTC SAR controller with the
main CPU. ulp_adc_init() sets sar1_en_pad_force = 1 so software selects
the channel, but deep-sleep entry resets it to 0 (ULP/HW control). After
that, the per-read channel selection in ulp_riscv_adc_read_channel() is
ignored and every channel returns the same stale value. Single-channel
worked only because the channel never changed.

Re-assert RTC controller (sar1_en_pad_force = 1) before selecting the
channel on each read so multi-channel sampling works after deep sleep.
2026-06-17 21:57:10 +05:30
Meet Patel c0601e512b feat(ulp): add multi-channel ADC init for ULP
ulp_adc_init() could only configure a single ADC channel, so monitoring
several channels from the ULP on one ADC unit was not possible. Add
ulp_adc_multi_channel_init() to configure multiple channels with
per-channel attenuation while keeping the existing single-channel API
unchanged.

Closes https://github.com/espressif/esp-idf/issues/11160
2026-06-16 12:50:58 +05:30
Meet Patel bd4ab32f73 Merge branch 'feat/backtrace-print-all-tasks-riscv' into 'master'
feat(esp_system): add esp_backtrace_print_all_tasks support for RISC-V

See merge request espressif/esp-idf!49012
2026-06-03 11:57:42 +05:30
Meet Patel dd57685c42 feat(esp_system): add esp_backtrace_print_all_tasks support for RISC-V
Extends esp_backtrace_print_all_tasks() to RISC-V targets. For running
tasks, registers are captured using UNW_GET_CONTEXT(); for suspended
tasks, the saved RvExcFrame on the task stack is used. Dual-core support
follows the same IPC pattern as the Xtensa implementation.

Backtrace output adapts to the configured backtrace method:
EH-frame, frame-pointer, or register dump (with a hint to enable
frame-pointer mode).
2026-06-01 19:18:16 +05:30
Meet Patel fd951bfdba Merge branch 'refactor/wdt_soc_supported_guard' into 'master'
refactor(system): wrap WDT code under SOC_WDT_SUPPORTED

Closes IDF-14860

See merge request espressif/esp-idf!46457
2026-03-25 09:47:58 +05:30
Meet Patel c4e2fe2c8b refactor(system): guard WDT with SoC capability macros
Wrap MWDT-related code under SOC_WDT_SUPPORTED so targets without a main
watchdog can compile.

Add SOC_RTC_WDT_SUPPORTED for RTC watchdog usage (bootloader, slow-clock
paths) and regenerate Kconfig.soc_caps.in. Bootloader RWDT setup stays
under SOC_RTC_WDT_SUPPORTED; MWDT flashboot teardown stays under
SOC_WDT_SUPPORTED.

ESP_INT_WDT, ESP_TASK_WDT_EN, and BOOTLOADER_WDT_ENABLE depend on
SOC_WDT_SUPPORTED where applicable. Build xt_wdt.c only when
SOC_XT_WDT_SUPPORTED. Provide no-op panic WDT helpers when
SOC_WDT_SUPPORTED is disabled.
2026-03-24 14:57:43 +05:30
Meet Patel 3cef5673ff Merge branch 'refactor/enable_fsm_and_riscv_ulp_simultaneously' into 'master'
refactor(ulp): Allow both ULP-FSM and ULP-RISCV to enable at build time

Closes IDFGH-11916

See merge request espressif/esp-idf!45751
2026-03-17 19:29:43 +05:30
Meet Patel 5df38b48f4 docs(ulp): Updated the docs for ULP fsm and ULP riscv support
Updated the documentation of ULP, as we have updated kconfig options
and build files to allow selecting both ULP FSM and ULP RISCV
simultaneously at compile time.
2026-03-16 22:09:06 +05:30
Meet Patel 13f894799c feat(ulp): New example to show ulp fsm and riscv used in same app
This example shows how to have both ULP FSM and RISCV enabled in kconfig
simultaneously, and use them one after another at run time. A new
parameter TYPE is passed to ulp_embed_binary() function to specify fsm
or riscv in CMakeLists.txt. This way, both ulp_fsm and ulp_riscv source
files can be compiled by their respective toolchains under the same
project.

The example shows ULP FSM incrementing a counter from 0 to 100, ULP
RISC-V incrementing from 100 to 500 and main CPU incrementing from 500
to 1500.
2026-03-15 14:01:30 +05:30
Meet Patel a3f167f1c4 refactor(ulp): Allow both ULP-FSM and ULP-RISCV to enable at build time
Updated kconfig option type and other supporting changes in build system
to allow enabling both ULP FSM and ULP RISCV simultaneously. Users can
choose at run time which one to initialize and use.
NOTE: Both ULP FSM and ULP RISCV can't be used simultaneously at run
time because they share some common hardware like RTC slow memory space.

Closes https://github.com/espressif/esp-idf/issues/12999
2026-03-15 14:01:30 +05:30
Meet Patel b9210b3474 Merge branch 'contrib/github_pr_18208' into 'master'
fix(ulp): correct LP I2C interrupt wait cycle duration (GitHub PR)

Closes IDFGH-17203

See merge request espressif/esp-idf!45931
2026-02-24 10:35:26 +05:30
Meet Patel 7b30754d33 fix(ulp): correct ULP LP and RISCV interrupt wait cycle duration
Current implementation of interrupt wait cycle calculation depends on a
delay and local counter method, which is inaccurate in achieving precise
timeouts. This commit updates the implementaion to use CPU cycles
instead, as they are more accurate.

Closes https://github.com/espressif/esp-idf/pull/18208
2026-02-19 13:32:31 +05:30
Meet Patel cc4c3380f1 Merge branch 'bugfix/fence_instruction_spinlock' into 'master'
fix(spinlock): Added fence instruction in spinlock acquire and release

Closes IDFCI-3828

See merge request espressif/esp-idf!44815
2026-01-07 17:45:28 +05:30
Meet Patel 4b02a7e320 fix(spinlock): Added fence instruction in spinlock acquire and release
The existing spinlock mechanism possibly has an overlap of memory
operations during multi core execution, as visible in CI testing. When
running the example inter_cpu_critical_section, shared count increment
stops at 299999 instead of reaching 300000, but this only happens
randomly 1 out of 10 times. It is suspected that a memory operation
happens simultaneously from both core, even though spinlock protection
is in place.

To handle this problem, a memory barrier (fence instruction) is added
at critical places during spinlock acquire and release, to ensure that
all memory operations upto that point are completed and synchronised
before proceeding further.
2026-01-06 10:13:00 +05:30
Meet Patel a07b83fcb9 refactor(lp_wdt): Remove reference of JIRA ticket from code
No further actions for this JIRA ticket are pending. The neccessary test
cases have already been added to verify some additional functionalities.
Hence, removing the TODO reference from code for internal JIRA ticket.
2026-01-05 09:54:11 +05:30
Meet Patel 12a1ecc8b7 Merge branch 'bugfix/adc_read_ci_issue2' into 'master'
fix(lp_adc): Fix LP ADC 1-byte read CI issue on ESP32P4

Closes IDFCI-5374 and IDFCI-5375

See merge request espressif/esp-idf!44637
2025-12-30 13:04:57 +05:30
Meet Patel 017ae532c0 fix(lp_adc): Fix LP ADC 1-byte read CI issue on ESP32P4
This is a follow up commit on top of below commit:
c061c781a3

This commit further increases the ADC_TEST_LOW_VAL threshold from 2165
to 2200, because some tests were found to be failing with ADC reading
values such as 2171, 2172, 2182 etc. Suspecting the ADC callibration or
surrounding temperature to cause such fluctuations which need higher
threshold to avoid test failures.
2025-12-29 13:26:14 +05:30
Meet Patel 1099383968 Merge branch 'docs/watchdog_api_doc_changes' into 'master'
docs(watchdogs): Updating API reference guide for Watchdog Timer

Closes IDF-2756 and IDF-2009

See merge request espressif/esp-idf!44202
2025-12-22 11:40:51 +05:30
Meet Patel f131522ca1 Merge branch 'bugfix/adc_read_ci_issue' into 'master'
fix(lp_adc): Fix LP ADC 1-byte read CI issue on ESP32P4

Closes IDFCI-5374 and IDFCI-5375

See merge request espressif/esp-idf!44363
2025-12-22 11:39:15 +05:30
Meet Patel 275f4469d7 docs(watchdogs): Updating API reference guide for Watchdog Timer
Updated the watchdog timer API reference guide to improve explanation
of some existing points.

Also added two new sections in the document:
1. Timeout Stages
2. Common error logs when WDT triggers and possible resolutions
2025-12-18 12:11:34 +05:30
Meet Patel c061c781a3 fix(lp_adc): Fix LP ADC 1-byte read CI issue on ESP32P4
The low power ADC in ESP32P4 sometimes reads the data value as 2160,
2161 or a bit greater than that when running the CI test case named
esp32p4.defaults.test_lp_core -> LP ADC 1 raw read stress test. However,
the test only passes if value stays below the LOW_VAL threshold of 2160.
Hence, updated the LOW_VAL threshold to 2165 keeping some margin,
because ADC readings may differ slightly from board to board, so this
type of small variations in ADC values are expected.
2025-12-18 11:18:39 +05:30
Meet Patel b11ce34971 Merge branch 'contrib/github_pr_17848' into 'master'
Bump up log_v2's max arg count (GitHub PR)

Closes IDFGH-16764

See merge request espressif/esp-idf!43256
2025-11-12 10:02:34 +05:30
Meet Patel b340a1ff15 Merge branch 'bugfix/rtc_wdt_test_app' into 'master'
fix(test_rtc_wdt): Fixed CI test failures for RTC WDT by increasing margin

Closes IDFCI-4816, IDFCI-4835, IDFCI-5863, IDFCI-4799, and IDFCI-4817

See merge request espressif/esp-idf!42959
2025-10-29 12:18:22 +05:30
Meet Patel 4b7a049ad7 fix(test_rtc_wdt): Fixed CI test failures for RTC WDT by increasing margin
The CI tests for RTC WDT test app were failing because we allowed only
20% margin between configured vs actual timeout of wdt. However, the
RC oscillator accuracy on some boards is very poor and it results in
almost 25% difference between configured and actual timeout. Hence,
increased the failure margin from 20% to 30%. Also some boards like
ESP32P4 have known problem and gives timeout after twice the configured
time. Hence, increased the wdt interrupt wait time to three times the
configured value, so we don't miss the interrupts for such boards.
2025-10-28 09:54:54 +05:30
Meet Patel fbe73cce82 Merge branch 'bugfix/esp_event_performance_test_fix' into 'master'
fix(esp_event): Updated minimum events dispatched test pass criteria

Closes IDF-12299

See merge request espressif/esp-idf!42714
2025-10-27 12:04:57 +05:30
Meet Patel 510a7f792e fix(esp_event): Updated minimum events dispatched test pass criteria
For the dual core chips like ESP32H4 that are running on slow CPU
clock frequency (96MHz), the number of events getting dispatched in
the test case called "performance test - no dedicated task" were
falling short of expectation because of extra overhead with locks
etc when runing with a non dedicated task. Even for other chips like
ESP32S3, if the main CPU core is running at 80MHz, the result is same.
Hence, added a consideration for CPU clock frequency when deciding
pass criteria for this test case.
2025-10-23 10:32:19 +05:30
Meet Patel 6491647fcb Merge branch 'feature/rtc_wdt_test_app' into 'master'
feat(rtc_wdt): Added unity app to test rtc watchdog timer functions

Closes IDF-12273

See merge request espressif/esp-idf!42568
2025-10-16 12:55:13 +05:30
Meet Patel 9b86dc25ab feat(rtc_wdt): Added unity app to test rtc watchdog timer functions
Unity based test app configures RTC WDT to verify following features:
1. Verify all 4 stages of RTC WDT are able to trigger timeout and
   invoke the pre-configured interrupt service routine
2. Verify RTC WDT can reset the main SYSTEM or main SYSTEM + RTC
2025-10-15 12:14:19 +05:30
Meet Patel 0f776d31ae Merge branch 'feature/ulp_riscv_pulse_counter_example' into 'master'
feat(ulp_riscv): Add pulse counter example code for ulp riscv

Closes IDF-14106

See merge request espressif/esp-idf!42107
2025-09-30 10:13:21 +05:30
Meet Patel af895be8f6 feat(ulp_riscv): Add pulse counter example code for ulp riscv
Added a pulse counter example code for ulp riscv chips. The example
works by HP core generating high frequency pulses on a GPIO, which
are counted by ULP core to find out the highest possible frequency
of pulses that can be achieved without missing any edges.
2025-09-26 15:59:07 +05:30
Meet Patel b59b3665c5 Merge branch 'refactor/lp_core_i2c_esp32c5_support' into 'master'
refactor(lp_core_i2c): Modify lp_core_i2c header to support ESP32C5

Closes IDF-14065

See merge request espressif/esp-idf!41885
2025-09-16 10:55:43 +05:30
Meet Patel 93cbfcf139 refactor(lp_core_i2c): Modify lp_core_i2c header to support ESP32C5
lp_core_i2c.h header file has sda and scl pins hardcoded to GPIO6 and
GPIO7 which works only for ESP32C6. ESP32C5 uses GPIO2 and GPIO3 for
I2C SDA and SCL. Hence, added LP_I2C_SCL_IO and LP_I2C_SDA_IO macros
under conditional compilation in library header file, so there is no
need to hardcode I2C GPIO pins and any other test apps or examples
that are including the LP I2C header file can also use Macro directly.
2025-09-15 17:30:20 +05:30
Meet Patel 031a2f2f71 Merge branch 'refactor/ulp_riscv_i2c_logs' into 'master'
refactor(ulp_riscv): Modify i2c read/write API for better logging and return error code

Closes IDFGH-16269 and IDFGH-15237

See merge request espressif/esp-idf!41342
2025-08-22 10:35:37 +05:30
Meet Patel f5b7cb6766 refactor(ulp_riscv): Modify ulp i2c read/write functions to return error code
Updated the i2c read/write APIs ulp_riscv_i2c_master_read_from_device
and ulp_riscv_i2c_master_write_to_device in ulp_riscv component to
return error codes back to the application

Closes https://github.com/espressif/esp-idf/issues/15904
2025-08-20 14:16:44 +05:30
Meet Patel 7abc48157e refactor(ulp_riscv): Modify ESP_EARLY_LOG to ESP_LOG and move it outside critical section
Moved the error logs outside critical section for i2c communication errors
like READ fail, WRITE fail etc. in the ulp_riscv_i2c component

Also changed the error log API from ESP_EARLY_LOG to ESP_LOG, so we can support
tag based filtering and enabling/disabling of logs

Closes https://github.com/espressif/esp-idf/issues/17425
2025-08-20 14:16:44 +05:30