Use Jlink to update xiao via SWD port

Hi all,
I want to use Jlink to update my board via swd port. Before flashing my program, I had to erase the board.However a sector of flash seems to be locked the following message shows that gave erase commnad and return error:

How do I unset the memory protect flag ?

I finally found that we should set BOOTPORT 2 if we want to disable memory protection for bootloader section. more information
we can disable the last line in the bootloader code and then erase all memory section.

//setBootProt(2); // 8k

    while (1) {
    }
1 Like