Hello kerryzhou,
1) You can use the official SDK directly, eg the led_blinky project.
Am already using LED blinkly demo code from SDK. Only modified LED gpio pin as per my board.
2)When you debug the code, whether the address is the flash address?
My Program counter when debugged and break point at main is 0x70003b44 <main+4> so it is internal flash address.
3) Do you enable the XIP function?
Yes I believe i have done this using pre-processor directives.
4) Do you leave the UART boot pins?
I am not using these pins now but these are not brought out in my prototype board.
As i am using a prototype board and not EVK board, the prototype board does not contain the usb required for the serial download mode
so i cannot use the MCUBootUtility.
One change i see in my schematic is DCDC pins are not used on my prototype board so i have to comment the code in BOARD_BootClockRUN function as below for the code to run

I have already done this change in code but still see the issue. Is this issue related to DCDC pins?
My point is why the issue arises only when debugger is connected. If i have a board which is programmed a day before and If debugger is not connected at all the program runs fine. As soon as the debugger is connected to the board it stops running for a while.
Is there any pull up/pull down configuration for JTAG which is required in firmware?
Thanks
Regards,
Anuj