Hi @PaulHu
If you run this code with no changes on S32K388, it won't work because the flash layout is different.
You can find in the code:
lukaszadrapa_0-1758106090587.png
On S32K344, first sector in block 1 is going to be programmed because S32K344_SecureBootBlinky is forced to this block:
lukaszadrapa_1-1758106113118.png
lukaszadrapa_2-1758106119993.png
But there are 2MB blocks on S32K388, so it's different here:
lukaszadrapa_3-1758106137009.png
It's still block 0, so you need to unlock different block and sector.
And one more thing - be aware that read-while-write (RWW) is supported only between blocks. When block 0 is being programmed, the code must run from another flash block or from RAM.
Regards,
Lukas