I am trying to understand the flash writing code I found in the EEPROM emulation (https://github.com/PaulStoffregen/co...ensy4/eeprom.c) and the flasher4 OTA code.

A lot is going on to set up the sequence LUT and IP command control registers, some of which I find very little documentation about (for example the specific commands that can go to the LUT). But my main issue is with how the target address is communicated.

At line 264, in eepromemu_flash_write() it reads:
Code:
FLEXSPI_IPCR0 = (uint32_t)addr & 0x00FFFFFF;
I suppose it means that the first IP command control register is set to the start address of the write.
Does it mean the EEPROM starts at 0x00FFFFFF ? What is the purpose of the 0x00FFFFFF mask?

In the eepromemu_flash_erase_sector() function at line 302, there is:
Code:
FLEXSPI_IPCR0 = (uint32_t)addr & 0x00FFF000;

If I want to write to an arbitrary program flash address, to what would I need set the IPCR0?

Thank you for any help