Hi @sandeepc ,
About the bootloader, we have a lot of codes for your reference.
1. SBL/SFW
https://www.nxp.com/docs/en/user-guide/MCUOTASBLSFWUG.pdf
2. sdk
https://mcuxpresso.nxp.com/en/builder?hw=MIMXRT1170-EVK
\SDK_2_15_000_MIMXRT1170-EVK\boards\evkmimxrt1170\ota_examples
About the flash operation, you can refer to SDK:
SDK_2_15_000_MIMXRT1170-EVK\boards\evkmimxrt1170\driver_examples\fsl_romapi
SDK_2_15_000_MIMXRT1170-EVK\boards\evkmimxrt1170\driver_examples\flexspi\nor
Wish it helps you!
If you still have question about it, please kindly let me now.
If your question is solved, please help to mark the correct answer, just to close this case, thanks.
Best Regards,
Kerry