Hi, when I upload code to my XIAO nrf52840 sense board via Jlink / SWD, the upload script always resets and halts the CPU at main(), no matter if I use built_type = debug or built_type = release. The code can only be started by staring a debug session in PIO and pressing “Continue” after CPU is halted at main() temporary breakpoint. Is there any way to configure PIO / JLink to upload and run the code, like it is the case when uploading via USB?
Here is the last part of the upload log:
Connecting to target via SWD
InitTarget() start
InitTarget() end - Took 2.83ms
Found SW-DP with ID 0x2BA01477
DPIDR: 0x2BA01477
CoreSight SoC-400 or earlier
Scanning AP map to find all available APs
AP\[2\]: Stopped AP scan as end of AP map has been reached
AP\[0\]: AHB-AP (IDR: 0x24770011, ADDR: 0x00000000)
AP\[1\]: JTAG-AP (IDR: 0x02880000, ADDR: 0x01000000)
Iterating through AP map to find AHB-AP to use
AP\[0\]: Core found
AP\[0\]: AHB-AP ROM base: 0xE00FF000
CPUID register: 0x410FC241. Implementer code: 0x41 (ARM)
Found Cortex-M4 r0p1, Little endian.
FPUnit: 6 code (BP) slots and 2 literal slots
CoreSight components:
ROMTbl\[0\] @ E00FF000
\[0\]\[0\]: E000E000 CID B105E00D PID 000BB00C SCS-M7
\[0\]\[1\]: E0001000 CID B105E00D PID 003BB002 DWT
\[0\]\[2\]: E0002000 CID B105E00D PID 002BB003 FPB
\[0\]\[3\]: E0000000 CID B105E00D PID 003BB001 ITM
\[0\]\[4\]: E0040000 CID B105900D PID 000BB9A1 TPIU
\[0\]\[5\]: E0041000 CID B105900D PID 000BB925 ETM
Memory zones:
Zone: “Default” Description: Default access mode
Cortex-M4 identified.
PC = 000FBAD0, CycleCnt = 00064018
R0 = 01456718, R1 = 000FBAD1, R2 = 00000001, R3 = 00000000
R4 = 00000000, R5 = 20009649, R6 = 51B1E5DB, R7 = 00000000
R8 = 87EEB07C, R9 = 00000000, R10= 00000000, R11= 00000000
R12= 000047F0
SP(R13)= 2003FFB8, MSP= 2003FFB8, PSP= 00000000, R14(LR) = 000F485F
XPSR = 21000000: APSR = nzCvq, EPSR = 01000000, IPSR = 000 (NoException)
CFBP = 00000000, CONTROL = 00, FAULTMASK = 00, BASEPRI = 00, PRIMASK = 00
FPS0 = 00000000, FPS1 = 00000000, FPS2 = 00000000, FPS3 = 00000000
FPS4 = 00000000, FPS5 = 00000000, FPS6 = 00000000, FPS7 = 00000000
FPS8 = 00000000, FPS9 = 00000000, FPS10= 00000000, FPS11= 00000000
FPS12= 00000000, FPS13= 00000000, FPS14= 00000000, FPS15= 00000000
FPS16= 00000000, FPS17= 00000000, FPS18= 00000000, FPS19= 00000000
FPS20= 00000000, FPS21= 00000000, FPS22= 00000000, FPS23= 00000000
FPS24= 00000000, FPS25= 00000000, FPS26= 00000000, FPS27= 00000000
FPS28= 00000000, FPS29= 00000000, FPS30= 00000000, FPS31= 00000000
FPSCR= 00000000
J-Link>loadbin .pio\\build\\seeed_xiao_nrf52840_sense\\firmware.bin,0x26000
‘loadbin’: Performing implicit reset & halt of MCU.
Reset type: NORMAL ( https://kb.segger.com/J-Link_Reset_Strategies )
Reset: Halt core after reset via DEMCR.VC_CORERESET.
Reset: Reset device via AIRCR.SYSRESETREQ.
Downloading file \[.pio\\build\\seeed_xiao_nrf52840_sense\\firmware.bin\]…
Comparing flash \[100%\] Done.
Erasing flash \[100%\] Done.
Programming flash \[100%\] Done.
Verifying flash \[100%\] Done.
J-Link: Flash download: Bank 0 @ 0x00000000: 1 range affected (24576 bytes)
J-Link: Flash download: Total: 0.974s (Prepare: 0.077s, Compare: 0.026s, Erase: 0.511s, Program: 0.290s, Verify: 0.012s, Restore: 0.055s)
J-Link: Flash download: Program speed: 82 KB/s
O.K.
J-Link>loadbin .pio\\build\\seeed_xiao_nrf52840_sense\\firmware_signature.bin,0x7F000
‘loadbin’: Performing implicit reset & halt of MCU.
Reset type: NORMAL ( https://kb.segger.com/J-Link_Reset_Strategies )
Reset: Halt core after reset via DEMCR.VC_CORERESET.
Reset: Reset device via AIRCR.SYSRESETREQ.
Downloading file \[.pio\\build\\seeed_xiao_nrf52840_sense\\firmware_signature.bin\]…
Comparing flash \[100%\] Done.
Erasing flash \[100%\] Done.
Programming flash \[100%\] Done.
Verifying flash \[100%\] Done.
J-Link: Flash download: Bank 0 @ 0x00000000: 1 range affected (4096 bytes)
J-Link: Flash download: Total: 0.180s (Prepare: 0.045s, Compare: 0.002s, Erase: 0.086s, Program: 0.018s, Verify: 0.001s, Restore: 0.026s)
J-Link: Flash download: Program speed: 222 KB/s
O.K.
J-Link>r
Reset delay: 0 ms
Reset type: NORMAL ( https://kb.segger.com/J-Link_Reset_Strategies )
Reset: Halt core after reset via DEMCR.VC_CORERESET.
Reset: Reset device via AIRCR.SYSRESETREQ.
J-Link>q
Script processing completed.