STM32 Flash erase sector 0
My problem is when I erase sector 0 AC6 give an error for address wrapping


Remember that the first item on page zero is the interrupt vector table.

Your problem sounds a lot like you have interrupts enabled. This would only work in case you moved the vector table to a RAM address using the SCB-&gt;VTOR register. Note that the vector table needs an address with the lowest byte all zero (256 byte aligned).


  Is there a anyway to erase sector0 with a embedded program?


This usually needs a bit of preparation:


disable interrupts (or use VTOR above)
erase page
write new page content
enable interrupts


A power fail (or any other Reset) could "brick" the device, if it happened between the erase and the new write.