# Copyright (c) 2024 GARDENA GmbH
#
# SPDX-License-Identifier: Apache-2.0

source [find interface/ftdi/olimex-arm-usb-ocd-h.cfg]
source [find interface/ftdi/olimex-arm-jtag-swd.cfg]

source [find target/sim3x.cfg]

# On SiM3U1xx, doing a chip reset also takes down the debug port. For this reason, we disable the
# chip reset and instead only reset the Cortex M via the AIRCR SYSRESETREQ bit, as suggested in the
# chip's errata:  https://www.silabs.com/documents/public/errata/SiM3U1xx-SiM3C1xxErrata.pdf
cortex_m reset_config sysresetreq

$_TARGETNAME configure -event gdb-attach {
        echo "Debugger attaching: halting execution"
        reset halt
        gdb_breakpoint_override hard
}

$_TARGETNAME configure -event gdb-detach {
        echo "Debugger detaching: resuming execution"
        resume
}
