Because the address i try to erase and prohran in at the bank of the functiob, the 0x400000 - 0x500000 is the one bank, but even i put the code in the ram ,it caused the hardfault too,however ,if i erase at the 0x500000,the function runs well.
So why even the code runs in sram,it will cause hardfault when tried to program at 0x400000?