Hi,
The LPC804 has 32K Bytes(32KB) flash, the flash can be grouped by page and sector, one page consists of 64 bytes, one sector consists of 1K bytes or 16 oages, so there is 32 sector from sector0~sector 31, there are 512 pages from page0 to page511.
Because the application code is allocated as low address of flash, and the Page 510 and page 511 in sector 31 are not available for user code because of the boot block. so you have to write the flash between the end page of application code and the page 509.

Secondly, the erase operation is based on sector, but programming operation is based on absolute address.
I suppose that you have referred to iap_flash example in the SDK package.

The example use sector 14 with the macro:
#define DEMO_IAP_FLASH_SECTOR (14)
static uint32_t s_IapFlashPage =
(FSL_FEATURE_SYSCON_FLASH_SECTOR_SIZE_BYTES / FSL_FEATURE_SYSCON_FLASH_PAGE_SIZE_BYTES) * DEMO_IAP_FLASH_SECTOR;
so the page the example wrote is
the variable s_IapFlashPage is 14*(1024/64)=14*16=244 page, the absolute address is 244*64=15616 in decimal =0x3D00 with the following parameter:
(s_IapFlashPage + i) * FSL_FEATURE_SYSCON_FLASH_PAGE_SIZE_BYTES
so first parameter for api IAP_CopyRamToFlash() is the flash address.
If it is not what you expected, pls clarify your question, I am sorry.
This is the flash programming code:
IAP_PrepareSectorForWrite(DEMO_IAP_FLASH_SECTOR, DEMO_IAP_FLASH_SECTOR);
status = IAP_CopyRamToFlash((s_IapFlashPage + i) * FSL_FEATURE_SYSCON_FLASH_PAGE_SIZE_BYTES, &s_PageBuf[0],
FSL_FEATURE_SYSCON_FLASH_PAGE_SIZE_BYTES, SystemCoreClock);
BR
XiangJun Rong