PlatformIO Community

Debugging with jlink on Sered Xiao

Hi,

Just wired up a jlink to my seeed xiao samd21 based board.

Couple of odd issues,

  1. when starting the debugger always stops here
    ^~~~~~~~~
    Archiving .pio\build\seeed_xiao\libFrameworkArduino.a
    *** [.pio\build\seeed_xiao\firmware.elf] C:\icotest\fc-range\PowerPortMax\SystemController\FC5000 PowerController.pio\build\seeed_xiao\firmware.elf: The process cannot access the file because it is being used by another process
  • \brief Main entry point of Arduino application
    */
    int main(void)
    {
    init();

I’m using the device as a HID and normally use the USB serial for debugs, this USB device never comes up so I don;t have these capabilities with the link in use. Aware that you have a small amount of time from enurmation to device coming up and suspect that the “break” in the main() causes the USB to fail. Anyways around this?

Using the debugger to track an issue where code gets stuck in a wait loop somewhere I assume, do need to use a separate host or switch to serial debugs? that might not be easy due to pins!

Any ideas?

I’ve read in other topics regarding SAMD21 debugging that 1. removving the bootloader helps (controlled by the linkerscript flash_without_bootloader.ld or that pressing the restart button after starting debugging works.

no restart button but can try the bootloader approach, flashing by jlink works well if you host the USB on a separate machine, I’ll try the suggestion in next day or so

thanks