qemu_run.sh 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/bin/sh
  2. # Copyright 2024 Google LLC
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. run_qemu=1
  16. while getopts "n" opt; do
  17. case $opt in
  18. n)
  19. # Just print out the command. Handy for mucking with qemu's command line (adding gdb/tracing).
  20. run_qemu=
  21. esac
  22. done
  23. qemu_bin=$PEBBLE_QEMU_BIN
  24. if [ -z "$qemu_bin" -o ! -x $qemu_bin ]; then
  25. qemu_bin=$(which qemu-system-arm)
  26. fi
  27. if [ -z "$qemu_bin" ]; then
  28. echo "Could not find qemu-system arm, try putting it on your PATH or defining PEBBLE_QEMU_BIN in your environment" >&2
  29. exit 1
  30. fi
  31. qemu_cmd="$qemu_bin -cpu cortex-m3 -M stm32f2xx -nographic -monitor stdio -serial file:qemu_serial.txt -kernel build/tintin.elf -d all"
  32. echo $qemu_cmd
  33. if [ -n "$run_qemu" ]; then
  34. $qemu_cmd
  35. exit $?
  36. fi