[ststm32]Can not upload bin throw the jlink

There is my question, I use STM32L476RG in my personal project, under the macos, the PCB board is designed by myself


but based on the Nucleo, here is my ini file:

I use the jlink-EDU, when I upload my program always be failed like this:

I tried so many times, at last I find a solution, but i think it’s not right,
I open the SEGGER J-Flash Lite and click the Erase Chip button, then I upload the program in VSCODE, and it will be succeed, but I don’t know why? And how it works?


Could you help me?

Seems like write protection? [SOLVED] STM32L052 failed to erase sectors - J-Link/Flasher related - SEGGER - Forum

I note that your are writing to address 0x00000000 with the J-Flash Lite and to address 0x08000000 with PlatformIO/OpenOCD. Depending on the BOOT0 and BOOT1, 0x00000000 can be aliased to 0x08000000 or it can point somewhere else. Could that be the difference? What are the BOOT0 and BOOT1 levels?

thank you for your replay .
boot0 connected 10k resistor to the ground ,and boot1 leave it float

i dont think its the problem

OK
I find the problem, I use the wrong code, the pointer is wrong. Sorry
#include <mod_lora_rak.h>

Mod_LoRa_RAK::Mod_LoRa_RAK(HardwareSerial &_serial, int _pwr_en_pin, int _reset_pin)
{
	*at_serial = &_serial;
	pwr_en_pin = _pwr_en_pin;
	rst_pin    = _reset_pin;

	rssi = 0;
	snr  = 0;

	mod_response = " ";
}

look at the *at_serial, I should change it to at_serial