Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wear_levelling example don't work with 512K partitions size (IDFGH-7517) #9084

Closed
nopnop2002 opened this issue Jun 2, 2022 · 3 comments
Closed
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally

Comments

@nopnop2002
Copy link

nopnop2002 commented Jun 2, 2022

Environment

$ idf.py --version
ESP-IDF v5.0-dev-3202-ga2d5041492-dirty

Problem Description

I tried this.

I changed partitions_example.csv:

# Name,   Type, SubType, Offset,  Size, Flags
# Note: if you have increased the bootloader size, make sure to update the offsets to avoid overlap
nvs,      data, nvs,     0x9000,  0x6000,
phy_init, data, phy,     0xf000,  0x1000,
factory,  app,  factory, 0x10000, 1M,
storage,  data, fat,            , 512K,
#storage,  data, fat,     ,        1M,

example don't work.

Debug Logs

I (27) boot: ESP-IDF v5.0-dev-3202-ga2d5041492-dirty 2nd stage bootloader
I (27) boot: compile time 11:42:42
I (28) boot: chip revision: 1
I (32) boot_comm: chip revision: 1, min. bootloader chip revision: 0
I (39) boot.esp32: SPI Speed      : 40MHz
I (44) boot.esp32: SPI Mode       : DIO
I (48) boot.esp32: SPI Flash Size : 2MB
I (53) boot: Enabling RNG early entropy source...
I (58) boot: Partition Table:
I (62) boot: ## Label            Usage          Type ST Offset   Length
I (69) boot:  0 nvs              WiFi data        01 02 00009000 00006000
I (77) boot:  1 phy_init         RF data          01 01 0000f000 00001000
I (84) boot:  2 factory          factory app      00 00 00010000 00100000
I (91) boot:  3 storage          Unknown data     01 81 00110000 00080000
I (99) boot: End of partition table
I (103) boot_comm: chip revision: 1, min. application chip revision: 0
I (110) esp_image: segment 0: paddr=00010020 vaddr=3f400020 size=08864h ( 34916) map
I (132) esp_image: segment 1: paddr=0001888c vaddr=3ffb0000 size=02648h (  9800) load
I (136) esp_image: segment 2: paddr=0001aedc vaddr=40080000 size=0513ch ( 20796) load
I (147) esp_image: segment 3: paddr=00020020 vaddr=400d0020 size=1a704h (108292) map
I (186) esp_image: segment 4: paddr=0003a72c vaddr=4008513c size=06954h ( 26964) load
I (197) esp_image: segment 5: paddr=00041088 vaddr=50000000 size=00010h (    16) load
I (203) boot: Loaded app from partition at offset 0x10000
I (204) boot: Disabling RNG early entropy source...
I (217) cpu_start: Pro cpu up.
I (218) cpu_start: Starting app cpu, entry point is 0x40081040
0x40081040: call_start_cpu1 at /home/nop/esp-idf/components/esp_system/port/cpu_start.c:152

I (0) cpu_start: App cpu up.
I (232) cpu_start: Pro cpu start user code
I (232) cpu_start: cpu freq: 160000000 Hz
I (232) cpu_start: Application information:
I (237) cpu_start: Project name:     wear_levelling_example
I (243) cpu_start: App version:      v5.0-dev-3202-ga2d5041492-dirty
I (250) cpu_start: Compile time:     Jun  2 2022 11:42:34
I (256) cpu_start: ELF file SHA256:  acfddc36ac10872c...
I (262) cpu_start: ESP-IDF:          v5.0-dev-3202-ga2d5041492-dirty
I (269) heap_init: Initializing. RAM available for dynamic allocation:
I (276) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (282) heap_init: At 3FFB2F90 len 0002D070 (180 KiB): DRAM
I (289) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (295) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (301) heap_init: At 4008BA90 len 00014570 (81 KiB): IRAM
I (309) spi_flash: detected chip: generic
I (312) spi_flash: flash io: dio
W (316) spi_flash: Detected size(4096k) larger than the size in the binary image header(2048k). Using the size in the binary image header.
I (330) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (340) example: Mounting FAT filesystem
W (350) vfs_fat_spiflash: f_mount failed (13)
I (350) vfs_fat_spiflash: Formatting FATFS partition, allocation unit size=4096
E (360) vfs_fat_spiflash: f_mkfs failed (14)
E (360) example: Failed to mount FATFS (ESP_FAIL)


@espressif-bot espressif-bot added the Status: Opened Issue is new label Jun 2, 2022
@github-actions github-actions bot changed the title wear_levelling example don't work with 512K partitions size wear_levelling example don't work with 512K partitions size (IDFGH-7517) Jun 2, 2022
@igrr
Copy link
Member

igrr commented Jun 2, 2022

Hi @nopnop2002,
For the default 4kB FAT sector size, 512kB is a bit too short for the minimal FAT partition plus wear levelling data. FAT has a minimum of 128 sectors, so the FAT part needs at least 512kB. Wear levelling needs another 4 sectors (16kB) at this partition size.

If you need to use a partition smaller than 528kB, you can change the FAT sector size to 512 bytes in menuconfig.

@nopnop2002
Copy link
Author

Thank you for your quick response.

I added the following to sdkconfig.defaults.

It worked.

#
# Wear Levelling
#
CONFIG_WL_SECTOR_SIZE_512=y
CONFIG_WL_SECTOR_SIZE=512
CONFIG_WL_SECTOR_MODE_SAFE=y
CONFIG_WL_SECTOR_MODE=1

@espressif-bot espressif-bot added Resolution: Done Issue is done internally Status: Done Issue is done internally and removed Status: Opened Issue is new labels Jun 13, 2022
@franz-ms-muc
Copy link
Contributor

franz-ms-muc added a commit to franz-ms-muc/esp-idf that referenced this issue Mar 8, 2023
512K is too small, need to be 528K. see espressif#9084
espressif-bot pushed a commit that referenced this issue May 31, 2023
512K is too small, need to be 528K. see #9084
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally
Projects
None yet
Development

No branches or pull requests

4 participants