Hi,
Can you tell us the part number you are using?
generally, we provide the api function to erase/program flash, the api function is saved in flash and copied to program RAM and execute in program RAM.
In detail, if you use Processor Expert(PE), the PE generates the api function to erase/program flash. If the silicon does not support PE, we have example code to erase/program flash in application code.
Hope it can help you
BR
XiangJun Rong