How to create a FAT error for testing?

while(1);
Posts: 18
Joined: Mon May 02, 2022 9:03 pm

How to create a FAT error for testing?

Postby while(1); » Tue Jun 13, 2023 4:06 pm

I want to find out how our system responds when a FAT error occurs during the FAT initialization.

Is there a function or method for killing the FAT file system so that on power up or reboot the initialization process fails?

I tried just opening a file for writing and continuously writing data with no close. This doesn't seem to break things.

I am using IDF 4.4.4 with Arduino.

Thanks,

Mike.

lbernstone
Posts: 793
Joined: Mon Jul 22, 2019 3:20 pm

Re: How to create a FAT error for testing?

Postby lbernstone » Tue Jun 13, 2023 9:47 pm

You can use esptool to target "damage" at a specific spot in the filesystem. For example, using the default fat partition scheme:

Code: Select all

./esptool.py erase_region 0x29000 8
This will clear (0xFF) the first 8 bytes of the partition.

Code: Select all

dd if=/dev/zero of=zeros bs=1 count=8
./esptool.py write_flash 0x29000 zeros
Is the same effect, but with zeros.

ESP_Sprite
Posts: 9582
Joined: Thu Nov 26, 2015 4:08 am

Re: How to create a FAT error for testing?

Postby ESP_Sprite » Wed Jun 14, 2023 2:27 am

lbernstone wrote:
Tue Jun 13, 2023 9:47 pm
You can use esptool to target "damage" at a specific spot in the filesystem. For example, using the default fat partition scheme:

Code: Select all

./esptool.py erase_region 0x29000 8
This will clear (0xFF) the first 8 bytes of the partition.
Note that this likely actually erases 4096 bytes, as that is the minimum quantity the flash chip allows you to erase.

Who is online

Users browsing this forum: No registered users and 77 guests