Commit Graph
100 Commits
Author SHA1 Message Date
Adam Múdry 98fee5a68a feat(storage): Add generic partition BDL example
Add an example under examples/storage/generic_partition_bdl that
partitions a raw block device at run time using only the Block Device
Layer (BDL) interface.

The example obtains a whole-disk BDL (SPI flash data partition by
default, or an SD/eMMC card via menuconfig), writes an MBR partition
table onto it with the esp_ext_part_tables managed component (fetched
via idf_component.yml), then creates a generic-partition BDL for each
MBR entry with esp_blockdev_generic_partition_get() and mounts FATFS on
the FAT slice and LittleFS on the LittleFS slice.
2026-09-08 14:38:16 +02:00
Adam Múdry 568ae4126b fix(sdmmc): back off between CMD13 polls while waiting for card to be ready
The loops waiting for the card to leave its busy state started their yield
backoff at 100 ms. A card is typically busy for a few milliseconds after a
write, so the backoff never fired and every write was followed by hundreds
of back-to-back CMD13 commands. Occupying the host controller like this
slows down unrelated work on both cores, not just the calling task.

Delay between polls instead, starting at CONFIG_SD_READY_POLL_PERIOD_START_US
(100 us) and doubling. Both the delay and the configured start period are
capped at one FreeRTOS tick period, where vTaskDelay() already yields and one
command per tick is not a storm. A typical wait now costs a handful of
commands instead of hundreds.

Applies to sdmmc_wait_for_idle(), sdmmc_init_sd_wait_data_ready() and
read_tuning_block().

Closes https://github.com/espressif/esp-idf/issues/19034
2026-09-03 13:30:27 +02:00
Adam Múdry 273953fb64 fix(storage): Re-enable SDMMC related tests for P4 2026-08-27 14:33:37 +02:00
Adam Múdry e0c094da69 fix(sdmmc): release aligned DMA buffer on card deinit 2026-08-27 12:00:24 +02:00
Adam Múdry 482fc91d18 fix(storage): Add support for large generic partition BDLs
Use 64-bit byte offsets and sizes in the generic partition BDL and preserve
64-bit SDMMC addresses until sector conversion.
Return proper ESP-IDF error codes and return output via parameter.
Add large-partition coverage and document the SD/eMMC partition layout.
2026-08-11 16:12:57 +02:00
Adam Múdry f33b1225f0 Merge branch 'fix/sdmmc_fatfs_dma_psram_non_cached_region' into 'master'
fix(sdmmc): Validate DMA buffer address range

Closes IDFGH-17803

See merge request espressif/esp-idf!51041
2026-07-29 12:57:09 +02:00
Adam Múdry a89ca4caf6 fix(sdmmc): Validate DMA buffer address range
Closes https://github.com/espressif/esp-idf/issues/18714
2026-07-28 15:36:44 +02:00
Adam Múdry b1755caa63 Merge branch 'fix/sdmmc_bdl_casting' into 'master'
fix(sdmmc): BDL calculate sectors cast fix

Closes IDFGH-18017

See merge request espressif/esp-idf!51039
2026-07-21 15:15:33 +02:00
Adam Múdry 7961a7a65f fix(sdmmc): BDL calculate sectors cast fix
Closes https://github.com/espressif/esp-idf/issues/18875
2026-07-21 14:06:56 +02:00
Adam Múdry ab352fdbaf Merge branch 'fix/sdmmc_double_buffering_psram_dma_capable' into 'master'
fix(sdmmc): Add a better handling of devices accessing PSRAM through DMA

Closes IDFGH-17455

See merge request espressif/esp-idf!47685
2026-07-02 12:16:19 +02:00
Adam Múdry 0de4ceee63 feat(sdmmc): Use zero-copy TX for SDSPI 2026-07-02 11:39:20 +02:00
Adam Múdry ba4503a9b5 fix(sdmmc): Add a better handling of devices accessing PSRAM through DMA
Closes https://github.com/espressif/esp-idf/issues/18412
2026-07-02 11:39:20 +02:00
Adam Múdry fa8039b5ca Merge branch 'test/vfs_fix_register_check' into 'master'
test(vfs): Test changes regarding VFS register incorrect check fix and fix VFS host test not being run at all

See merge request espressif/esp-idf!49674
2026-06-23 14:02:16 +02:00
Adam Múdry 670fb68bc7 test(vfs): Test changes regarding VFS register incorrect check fix 2026-06-22 14:48:13 +02:00
Adam Múdry 199a403d81 fix(vfs): Fix __errno_r(__getreent()) correctness for Linux 2026-06-22 14:01:55 +02:00
Adam Múdry 8f00dfc74b Merge branch 'fix/vfs_fatfs_unregister_path_possible_leak' into 'master'
Fix esp_vfs_fat_unregister_path possible leak, incorrect check in esp_vfs_register_fs_common and optimize memory usage

Closes IDF-15793

See merge request espressif/esp-idf!49596
2026-06-13 02:09:10 +02:00
Adam Múdry 6ef5d42acc fix(vfs): Fix incorrect check in esp_vfs_register_fs_common and optimize memory 2026-06-11 16:34:39 +02:00
Adam Múdry 1f9c627569 fix(fatfs): Fix esp_vfs_fat_unregister_path leak if esp_vfs_unregister fails 2026-06-11 16:29:25 +02:00
Adam Múdry 1ef3e39078 Merge branch 'fix/sd_freq_clamping' into 'master'
fix(sdmmc): Handle nonsensical max freq correctly

Closes IDFGH-14477

See merge request espressif/esp-idf!49526
2026-06-10 12:30:09 +02:00
Adam Múdry f2a583a260 fix(sdmmc): Handle nonsensical max freq correctly
Closes https://github.com/espressif/esp-idf/issues/15250
2026-06-10 11:48:51 +02:00
Adam Múdry c55b61d99f Merge branch 'fix/python3.14_test_fatfsgen' into 'master'
fix(fatfs): fix operator precedence bug in BootSector.__str__ for Python 3.14 compatibility

Closes IDF-15550

See merge request espressif/esp-idf!47479
2026-04-13 16:08:16 +02:00
Adam Múdry b29b9dc4d2 Merge branch 'feat/cmake_add_partition_flash_binary_function' into 'master'
feat(esp_partition): Add esp_partition_register_target Cmake function

Closes IDF-11870 and DOC-14244

See merge request espressif/esp-idf!37176
2026-04-13 15:54:27 +02:00
Adam Múdry 749c446a7e feat(esp_partition): Add esp_partition_flash_binary() CMake function
Add a new CMake function esp_partition_flash_binary() that provides a
unified API for registering partition data binaries to be flashed. It
replaces the direct esptool_py_flash_target calls scattered across
components (spiffs, fatfs, nvs_flash) with a single function that:

- Resolves partition offset from the partition table automatically
- Determines encryption requirements (auto-detect or ALWAYS_PLAINTEXT)
- Creates per-partition flash targets (e.g. idf.py <partition>-flash)
- Optionally includes the binary in `idf.py flash` via FLASH_IN_PROJECT

On the linux target, the function registers binaries for pre-loading
into the emulated flash. A build-time manifest (linux_flash_data.txt)
is generated via file(GENERATE), and partition_linux.c reads it at
runtime to copy each binary into the memory-mapped flash buffer at
the correct offset.

The partition_ops example is updated to use the new function and
includes a custom_partition with pre-built data to demonstrate the
full workflow, including on the linux target.
2026-04-10 15:22:50 +02:00
Adam Múdry 5867550fb8 fix(fatfs): fix operator precedence bug in BootSector.__str__ for Python 3.14 compatibility
The condition filtering attributes lacked parentheses, causing the
'not startswith(_)' guard to only apply to str attributes. Python 3.14's
new __firstlineno__ (int) class attribute leaked into the output.

Also includes ruff auto-formatting fixes (imports, trailing commas,
union type annotations).
2026-04-09 15:36:43 +02:00
Adam Múdry d8c30644c7 fix(fatfs): fix formatting in relevant python files to satisfy pre-commit check 2026-04-09 12:56:30 +02:00
Adam Múdry 1d0d45f203 fix(fatfs): fix a bug in SFN generation from LFN and rewrite to match C algorithm
Rewrite build_lfn_short_entry_name() and add _gen_numname_suffix() helper
to match the gen_numname() algorithm in ff.c. This fixes:

- chr(order) producing raw binary instead of ASCII digits
- Collision for order >= 10 when str(order) makes the name exceed 8 chars
- Hex suffix with dynamic stem shortening (matching C implementation)
- CRC16-CCITT hash for seq > 5 to reduce collision probability

Also fix LDIR_Name2_SIZE typo in long_filename_utils.py (should be
LDIR_Name3_SIZE), which made the assertion guard too permissive.

Add ShortFilenameGenerationTestCase with 9 unit tests covering single-digit,
multi-digit, hash-based, and collision-free generation scenarios.
2026-04-09 12:53:43 +02:00
Adam Múdry b644580c68 Merge branch 'fix/sdmmc_cmd_err_switch_case_handling' into 'master'
fix(sdmmc): sdmmc_cmd.c fixed error handling in certain if and switch statements

Closes IDF-15455

See merge request espressif/esp-idf!46677
2026-03-18 14:57:52 +01:00
Adam Múdry cfcfb3f9eb fix(sdmmc): sdmmc_cmd.c fixed error handling in certain if and switch statements 2026-03-17 00:26:43 +01:00
Adam Múdry 366700747d feat(sdmmc): Try to reallocate smaller DMA buffer if larger one failed 2026-03-16 13:37:01 +01:00
Adam Múdry 653cea9c94 fix(sdmmc): Multi-block read/writes support refactor + tests and documentation added 2026-03-16 13:33:03 +01:00
Adam Múdry e78b76fab2 Merge branch 'fix/sdmmc_sdspi_retry_crc_check' into 'master'
fix(sdspi): 0x106 error during SD card init via SPI related fixes

See merge request espressif/esp-idf!44308
2026-02-05 15:11:29 +01:00
Adam Múdry 16e56b6368 docs: Provide translation for esp_vfs_fat_register function prototype update 2026-02-04 16:33:40 +01:00
Adam Múdry d58b9406d8 fix: Update examples etc. to use esp_vfs_fat_register
Instead of deprecated esp_vfs_fat_register_cfg
2026-02-04 16:33:40 +01:00
Adam Múdry 38256a6b11 refactor(fatfs): Update esp_vfs_fat_register function prototype
to match esp_vfs_fat_register_cfg
2026-02-04 16:33:40 +01:00
Adam Múdry 006b95f384 fix: Update cherryusb_host and examples using esp_tinyusb and usb_host_msc 2026-02-04 14:07:13 +01:00
Adam Múdry 543c7b9bff fix(sdspi): 0x106 error during SD card init via SPI related fixes
Try to turn on CRC16 again if first failed, allow disabling of CRC check altogether

Releated https://github.com/espressif/esp-idf/issues/15450
2026-02-02 15:44:59 +01:00
Adam Múdry 9d155077af Merge branch 'fix/fatfs_test_apps_remove_esp32c3_from_sdcard_sdmode_test' into 'master'
fix(fatfs): fatfs test_apps remove esp32c3 from sdcard_sdmode test

Closes IDF-15244

See merge request espressif/esp-idf!45495
2026-01-29 15:57:25 +01:00
Adam Múdry 1e195254e7 fix(fatfs): fatfs test_apps remove esp32c3 from sdcard_sdmode test 2026-01-28 13:42:33 +01:00
Adam Múdry d989204741 fix(fatfs): Calculate max_pos in wl_fatfsgen.py safe mode correctly 2026-01-22 15:17:36 +01:00
Adam Múdry 5e8a6c0816 fix: Satisfy Python formatter 2026-01-22 15:11:17 +01:00
Adam Múdry b831cccdd3 Merge branch 'fix/example_sd_card_pytest_wrong_timeout' into 'master'
fix(examples): Fixed wrong timeout placement in examples/sd_card/* pytest

Closes IDFCI-7325

See merge request espressif/esp-idf!44944
2026-01-12 04:31:53 +01:00
Adam Múdry fdaeef206c fix(examples): Fixed wrong timeout placement in examples/sd_card/* pytest 2026-01-08 15:19:35 +01:00
Adam Múdry f9b9eadc44 Merge branch 'fix/fatfs_pytest_expecting_typo' into 'master'
fix(sd): Fixed typo in pytest output expectation

Closes IDFCI-5088 and IDFCI-3728

See merge request espressif/esp-idf!44847
2026-01-07 15:33:03 +01:00
Adam Múdry 712c02e03c fix: Fixed typo in pytest output expectation 2026-01-07 13:35:51 +01:00
Adam Múdry a959111214 fix(sdmmc): sdmmc_get_blockdev fix potential overflow before widen 2025-12-16 14:23:21 +01:00
Adam Múdry cb98f7b5ef Merge branch 'feat/spi_flash_bdl_support' into 'master'
feat(bdl): Add support for spi_flash

Closes IDF-12752

See merge request espressif/esp-idf!42127
2025-12-05 10:29:39 +01:00
Adam Múdry cf95a64365 feat(bdl): Add support for spi_flash 2025-12-04 16:16:28 +01:00
Adam Múdry 862f000805 Merge branch 'feat/sdmmc_bdl' into 'master'
feat(bdl): Add support for SDMMC

Closes IDF-12751

See merge request espressif/esp-idf!39640
2025-11-26 17:46:10 +01:00
Adam Múdry 1725be256d feat(storage): Add support for SDMMC BDL 2025-11-11 14:59:56 +01:00
Adam Múdry 3eb74a7e95 fix(sdspi): esp_driver_sdpsi test app increase timeout to 180 2025-10-09 15:13:23 +02:00
Adam Múdry 94083867a7 Merge branch 'refactor/fatfs_vfs_functions' into 'master'
fix(storage): Refactor FATFS VFS functions to be easier to understand

Closes IDF-14044

See merge request espressif/esp-idf!41679
2025-09-28 22:54:49 +02:00
Adam Múdry beaf579f9b fix(storage): Refactor FATFS VFS functions to be easier to understand 2025-09-26 18:17:15 +08:00
Adam Múdry 56160675e7 Merge branch 'feat/sdspi_option_to_disable_waiting_for_miso_poll_busy' into 'master'
feat(sdspi): Add an option to modify the waiting time for MISO before sending next command

Closes IDFGH-15977 and IDFGH-9089

See merge request espressif/esp-idf!41175
2025-08-22 12:51:45 +02:00
Adam Múdry 9db29df39a feat(sdspi): Add an option to modify wait time for MISO before sending next command
Closes https://github.com/espressif/esp-idf/issues/16909
2025-08-20 08:57:51 +02:00
Adam Múdry a9c5a2ae4a Merge branch 'feat/perf_benchmark_support_esp32p4' into 'master'
feat(storage): Update emmc and perf_benchmark example to work with ESP32-P4, fix SDMMC slot deinit bug in legacy driver

Closes IDF-13394 and IDF-13483

See merge request espressif/esp-idf!39826
2025-07-01 08:59:53 +02:00
Adam Múdry 20313f82e6 feat(storage): Update emmc and perf_benchmark example to work with ESP32-P4 2025-06-26 14:00:23 +02:00
Adam Múdry 7154cd3173 feat(sdmmc): Add ESP32-P4 eMMC test board definition 2025-06-26 14:00:22 +02:00
Adam Múdry 1ab7235b9e fix(sdmmc): Legacy driver slot deinit set NULL after free 2025-06-26 14:00:22 +02:00
Adam Múdry 5106b95910 fix(storage): Fix storage examples readmes mentioning espotool 2025-06-18 15:58:07 +02:00
Adam Múdry e326d533de feat(storage): Bump LittleFS to 1.20.0 2025-06-18 15:56:47 +02:00
Adam Múdry 8925459572 Merge branch 'docs/filesystem_considerations_readonly_nvs' into 'master'
docs: Added a mention of read-only NVS in filesystem considerations document

Closes IDF-12520

See merge request espressif/esp-idf!38887
2025-05-22 20:31:52 +02:00
Adam Múdry e0be50d9b5 docs: Added a mention of read-only NVS in filesystem considerations document 2025-05-22 19:18:01 +02:00
Adam Múdry f0f0286ec2 Merge branch 'feat/nvs_pytest_add_non_ascii_string_test' into 'master'
feat: Add NVS generator check test for CRC of non-ASCII strings

Closes IDF-12979

See merge request espressif/esp-idf!38630
2025-04-29 22:30:45 +08:00
Adam Múdry 71921a450f feat: Add NVS generator check test for CRC of non-ASCII strings 2025-04-23 05:10:29 +02:00
Adam Múdry 93ff1aec46 Merge branch 'feat/remove_const_from_voltopart' into 'master'
feat(fatfs/diskio): Remove const from PARTITION VolToPart

Closes IDFGH-13211

See merge request espressif/esp-idf!38150
2025-04-16 23:46:19 +08:00
Adam Múdry 82dac1f1bd fix(fatfs): Mistake in Kconfig for FATFS_USE_DYN_BUFFERS 2025-04-09 09:18:02 +02:00
Adam Múdry b5b2fbc87d feat(fatfs/diskio): Remove const from PARTITION VolToPart
Closes https://github.com/espressif/esp-idf/issues/14148
2025-03-31 13:35:39 +02:00
Adam Múdry 3ab1ddaab5 Merge branch 'feat/read_only_nvs' into 'master'
feat(nvs): Allow read-only NVS partitions smaller than 0x3000

Closes IDFGH-14558

See merge request espressif/esp-idf!36767
2025-03-28 17:49:08 +08:00
Adam Múdry 4a6b99bc4a feat(nvs): Optimize read-only NVS loading 2025-03-27 12:42:04 +01:00
Adam Múdry 851e869bb2 fix: parttool print subprocess output on fail 2025-03-27 15:50:27 +08:00
Adam Múdry d8ebca368c feat(nvs): Allow read-only NVS partitions smaller than 0x3000
E.g. for factory settings data

Closes https://github.com/espressif/esp-idf/issues/15317
2025-03-27 15:50:27 +08:00
Adam Múdry 58fbcfb407 Merge branch 'feat/ff_fs_nofsinfo_kconfig' into 'master'
feat(fatfs): Add an option to set FF_FS_NOFSINFO value

Closes IDFGH-14467

See merge request espressif/esp-idf!36592
2025-03-20 20:18:52 +08:00
Adam Múdry d87a6d4b61 feat(fatfs): Add Kconfig options to set FF_FS_NOFSINFO value
Closes https://github.com/espressif/esp-idf/issues/15241
2025-02-21 21:39:44 +08:00
Adam Múdry bbd9acee93 Merge branch 'test/reenable_perf_benchmark_c61' into 'master'
test: Re-enable perf_benchmark test for C61

Closes IDF-10977

See merge request espressif/esp-idf!37073
2025-02-20 19:35:43 +08:00
Adam Múdry fcb1e8ad5c test: Re-enable perf_benchmark test for C61 2025-02-18 13:53:56 +01:00
Adam Múdry 8e519e0126 Merge branch 'fix/test_nvs_gen_check_read_only_part_support' into 'master'
fix: test_nvs_gen_check.py support for read-only NVS partitions

Closes IDF-12238

See merge request espressif/esp-idf!36829
2025-02-11 23:28:34 +08:00
Adam Múdry de053738e1 Merge branch 'bugfix/sdmmc_reset_pins_slot_width' into 'master'
fix(sdmmc): fix reset of pins above slot width

Closes IDFGH-14570

See merge request espressif/esp-idf!36725
2025-02-11 19:15:43 +08:00
Adam Múdry 0c2cbd12f1 fix: test_nvs_gen_check.py support for read-only NVS partitions 2025-02-10 15:45:17 +01:00
Adam Múdry 30196f9430 fix(sdmmc): SDMMC concurrency change active slot only after the slot is initialized
Fixes counting of initialized slots
2025-01-27 03:41:01 +01:00
Adam Múdry 4b79cb964f Merge branch 'fix/tusb_midi_task_stack_overflow' into 'master'
fix(examples): tusb_midi task stack overflow fix

Closes IDFGH-14002

See merge request espressif/esp-idf!34914
2024-11-14 23:38:30 +08:00
Adam Múdry 7e9782b67e fix(examples): tusb_midi task stack overflow fix 2024-11-14 13:03:27 +01:00
Adam Múdry cf44fc6a1f Merge branch 'fix/sdmmc_test_acmd22_esp32p4_fix' into 'master'
fix(sdmmc): Fix ACMD22 DMA buffer problem for ESP32-P4

Closes IDFCI-2499

See merge request espressif/esp-idf!34826
2024-11-13 06:53:49 +08:00
Adam Múdry b0ffe15514 fix(sdmmc): Fix ACMD22 DMA buffer problem for ESP32-P4 2024-11-12 14:55:19 +01:00
Adam Múdry 1689c7e14f Merge branch 'fix/nvs_generator_test_fail_due_to_safer_write_namespace_function' into 'master'
fix(nvs): Fix the NVS generator test (write_namespace safer behavior change)

Closes IDF-11674

See merge request espressif/esp-idf!34828
2024-11-12 15:38:22 +08:00
Adam Múdry ba2bf2f512 fix(nvs): Fix the nvs generator test (write_namespace safer behavior change) 2024-11-11 22:38:47 +01:00
Adam Múdry 97e669214c fix(littlefs): Allow LittleFS image generation on Windows + version bump
Closes https://github.com/espressif/esp-idf/issues/12900
2024-11-06 14:08:44 +01:00
Adam Múdry b2e0bd9200 Merge branch 'fix/sdmmc_send_acmd22_after_multiple_write_cmd' into 'master'
fix(sdmmc): Send ACMD22 if CMD25 fails

Closes IDF-9630

See merge request espressif/esp-idf!34376
2024-11-06 04:34:06 +08:00
Adam Múdry 6bf2d91c4d test(sdmmc): Add test_apps test for sdmmc component 2024-11-05 02:36:43 +01:00
Adam Múdry 9386b58e17 fix(sdmmc): Generalize waiting for card idle to a function 2024-11-05 02:36:42 +01:00
Adam Múdry 2c1bec2c70 fix(sdmmc): Send ACMD22 if CMD25 fails
Send the number of the written write blocks (ACMD22) after
write multiple blocks fails (CMD25)
2024-10-31 14:30:51 +01:00
Adam Múdry 4f3cfbe297 Merge branch 'fix/correct_alloc_function_in_example' into 'master'
fix(storage/example): correct alloc function

Closes IDF-10653

See merge request espressif/esp-idf!32516
2024-10-22 19:47:44 +08:00
Adam Múdry c7a86a23dc Merge branch 'fix/ssdmmc_send_cmd_set_relative_addr_rca' into 'master'
fix(sdmmc): Retry to get another RCA if the previous response was 0

Closes IDF-9631

See merge request espressif/esp-idf!34131
2024-10-19 00:07:28 +08:00
Adam Múdry 9c7609a0e7 fix(sdmmc): Send status (CMD13) even if write/read command fails 2024-10-17 00:58:48 +08:00
Adam Múdry 3f838d7843 fix(sdmmc): Improve SD card state checking after write/read command 2024-10-17 00:58:48 +08:00
Adam Múdry 72bbb8c857 fix(sdmmc): Retry to get another RCA if the previous response was 0 2024-10-14 03:25:55 +02:00
Adam Múdry d7cb8f5b9a Merge branch 'docs/nvs_check_documentation' into 'master'
Docs: Add nvs_check.py documentation

Closes IDF-11024

See merge request espressif/esp-idf!33952
2024-10-10 22:03:45 +08:00
Adam Múdry c672db530b docs(nvs): Document nvs_check.py functions 2024-10-08 08:33:32 +02:00
Adam Múdry 20d1a480ab feat(nvs): Add raw_data variable to NVS_Partition class in nvs_parser.py 2024-10-01 15:18:27 +02:00
Adam Múdry 98cf50d140 Merge branch 'fix/nvs_tool_false_duplicate_warning' into 'master'
fix(nvs): nvs_tool.py refactor, reduce false duplicate warnings, add a test

Closes IDF-10684

See merge request espressif/esp-idf!32449
2024-09-04 11:05:44 +08:00
Adam Múdry 347800bcda Merge branch 'fix/sdmmc_host_init_slot_possible_bad_shift_op' into 'master'
fix(sdmmc): Fix possible bad bit shift operation

Closes IDF-10759

See merge request espressif/esp-idf!32885
2024-08-30 23:55:14 +08:00