It's too much work for us to help you check the bare-metal code one by one.
1.you can provide me your demo code so i can help you troubleshooting.
2.you can refer to this post, have you maped the flash operations to sram?
https://community.nxp.com/t5/S32K-Knowledge-Base/Example-S32K144-Flash-RW-simple/ta-p/1110000