blob: df3248b28561714474d4830d1e24a160213d283a [file] [log] [blame]
#!/bin/bash
# Copyright 2023 The Pigweed Authors
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
# Flash an elf using the Blackmagic probe.
DEVBMP="/dev/ttyBmpGdb"
FOUND_BMP=$(python -m gonk_tools.find_serial_port -p 'Black Magic Probe' -1) && DEVBMP=$FOUND_BMP
arm-none-eabi-gdb -nx --batch \
-ex "set confirm off" \
-ex "target extended-remote ${DEVBMP}" \
-ex "monitor version" \
-ex "monitor tpwr enable" \
-ex "monitor swdp_scan" \
-ex "attach 1" \
-ex "load" \
-ex "compare-sections" \
-ex "kill" \
$@