blob: 8b87f093e01d4a85514af4f02221b22318d5f209 [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 disable" \
-ex "monitor swdp_scan" \
-ex "attach 1" \
-ex "load" \
-ex "compare-sections" \
-ex "kill" \
-ex "shell sleep 1" \
-ex "monitor reset" \
$@