LPC 1768 Flashing and Debugging

So probably your firmware is broken for some reason and the mcu simply crashes and enter HardFault handler. Are you sure flags, startup/linker files are correct for this target?

Edit: found this here, but don’t know how to properly add it to platformIO: mbed-os/tools/targets/LPC.py at master · ARMmbed/mbed-os · GitHub

I assume that’s the patch you use in your extra_script.py?