https://github.com/esp-rs/esp-storage/pull/29 as an example. The CPU isn't allowed to access the flash while erasing/writing to it.