Here is the output from GB, stepping through FLASHIAP_CopyRamToFLash()
FLASHIAP_CopyRamToFlash (dstAddr=0, srcAddr=0x20003f04 <ucHeap+12968>, numOfBytes=256,
systemCoreClock=537034752)
at /Users/caseykelso/dev/mutex.io.firmware/firmware/drivers/fsl_flashiap.c:78
78 command[0] = kIapCmd_FLASHIAP_CopyRamToFlash;
(gdb) n
79 command[1] = dstAddr;
(gdb) n
80 command[2] = (uint32_t)srcAddr;
(gdb) n
81 command[3] = numOfBytes;
(gdb) n
82 command[4] = systemCoreClock / HZ_TO_KHZ_DIV;
(gdb) n
83 iap_entry(command, result);
(gdb) n
85 return translate_iap_status(result[0]);
(gdb) p result
$1 = {21, 536887368, 536872380, 536887000}
(gdb) p/x result
$2 = {0x15, 0x20004048, 0x200005bc, 0x20003ed8}
(gdb)
You can see here that the result is 21 decimal, 0x15 Hex.
The fsl_flashiap.h file from the SDK_2.5.0_LPC54628J512defines these status codes
/*!
* @brief Flashiap status codes.
*/
enum _flashiap_status
{
kStatus_FLASHIAP_Success = kStatus_Success, /*!< Api is executed successfully */
kStatus_FLASHIAP_InvalidCommand = MAKE_STATUS(kStatusGroup_FLASHIAP, 1U), /*!< Invalid command */
kStatus_FLASHIAP_SrcAddrError =
MAKE_STATUS(kStatusGroup_FLASHIAP, 2U), /*!< Source address is not on word boundary */
kStatus_FLASHIAP_DstAddrError =
MAKE_STATUS(kStatusGroup_FLASHIAP, 3U), /*!< Destination address is not on a correct boundary */
kStatus_FLASHIAP_SrcAddrNotMapped =
MAKE_STATUS(kStatusGroup_FLASHIAP, 4U), /*!< Source address is not mapped in the memory map */
kStatus_FLASHIAP_DstAddrNotMapped =
MAKE_STATUS(kStatusGroup_FLASHIAP, 5U), /*!< Destination address is not mapped in the memory map */
kStatus_FLASHIAP_CountError =
MAKE_STATUS(kStatusGroup_FLASHIAP, 6U), /*!< Byte count is not multiple of 4 or is not a permitted value */
kStatus_FLASHIAP_InvalidSector =
MAKE_STATUS(kStatusGroup_FLASHIAP,
7), /*!< Sector number is invalid or end sector number is greater than start sector number */
kStatus_FLASHIAP_SectorNotblank = MAKE_STATUS(kStatusGroup_FLASHIAP, 8U), /*!< One or more sectors are not blank */
kStatus_FLASHIAP_NotPrepared =
MAKE_STATUS(kStatusGroup_FLASHIAP, 9U), /*!< Command to prepare sector for write operation was not executed */
kStatus_FLASHIAP_CompareError =
MAKE_STATUS(kStatusGroup_FLASHIAP, 10U), /*!< Destination and source memory contents do not match */
kStatus_FLASHIAP_Busy =
MAKE_STATUS(kStatusGroup_FLASHIAP, 11U), /*!< Flash programming hardware interface is busy */
kStatus_FLASHIAP_ParamError =
MAKE_STATUS(kStatusGroup_FLASHIAP, 12U), /*!< Insufficient number of parameters or invalid parameter */
kStatus_FLASHIAP_AddrError = MAKE_STATUS(kStatusGroup_FLASHIAP, 13U), /*!< Address is not on word boundary */
kStatus_FLASHIAP_AddrNotMapped =
MAKE_STATUS(kStatusGroup_FLASHIAP, 14U), /*!< Address is not mapped in the memory map */
kStatus_FLASHIAP_NoPower = MAKE_STATUS(kStatusGroup_FLASHIAP, 24U), /*!< Flash memory block is powered down */
kStatus_FLASHIAP_NoClock =
MAKE_STATUS(kStatusGroup_FLASHIAP, 27U), /*!< Flash memory block or controller is not clocked */
};
---