Hi @Kiruthika_S,
I don’t recommend erasing all flash blocks from within the application.
Full flash erase operation must be executed from SRAM, since the core cannot erase flash while executing code from it, due to the Read-While-Write (RWW) limitation.
In the project you posted, I only see a Debug_FLASH session. To support execution from SRAM, you’ll need to configure a Debug_SRAM session.
Also, keep in mind that partitioning should only be done once during the device’s lifetime, ideally via the programmer before the application is loaded.
Regards,
Daniel