run_qemu_arc.sh 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #!/bin/bash
  2. # THIS SCRIPT IS USED TO RUN QEMU ARC EMULATOR DIRECTLY ON CI ONLY.
  3. # USUALLY, you SHOULD NOT RUN IT ON YOUR LOCAL MACHINE.
  4. # INSTEAD, YOU SHOULD USE `west build -t run` COMMAND.
  5. # Two arguments. first is the path to the zephyr-sdk, second is the path to the zephyr elf.
  6. if [ "$#" -ne 2 ]; then
  7. echo "Usage: $0 <path_to_zephyr_sdk> <path_to_zephyr_elf>"
  8. exit 1
  9. fi
  10. ZEPHYR_SDK_PATH=$1
  11. ZEPHYR_ELF_PATH=$2
  12. if [ ! -d "$ZEPHYR_SDK_PATH" ]; then
  13. echo "Error: Zephyr SDK path does not exist: $ZEPHYR_SDK_PATH"
  14. exit 1
  15. fi
  16. if [ ! -f "$ZEPHYR_ELF_PATH" ]; then
  17. echo "Error: Zephyr ELF file does not exist: $ZEPHYR_ELF_PATH"
  18. exit 1
  19. fi
  20. # this command is copied from the content of build.ninja which is generated by west build.
  21. # please do not modify it unless synchronizing with the build.ninja file.
  22. $ZEPHYR_SDK_PATH/sysroots/x86_64-pokysdk-linux/usr/bin/qemu-system-arc \
  23. -cpu arcem -m 8M \
  24. -nographic -no-reboot -monitor none \
  25. -global cpu.firq=false \
  26. -global cpu.num-irqlevels=15 \
  27. -global cpu.num-irq=25 \
  28. -global cpu.ext-irq=20 \
  29. -global cpu.freq_hz=10000000 \
  30. -global cpu.timer0=true \
  31. -global cpu.timer1=true \
  32. -global cpu.has-mpu=true \
  33. -global cpu.mpu-numreg=16 \
  34. -net none \
  35. -pidfile qemu.pid \
  36. -chardev stdio,id=con,mux=on \
  37. -serial chardev:con \
  38. -mon chardev=con,mode=readline \
  39. -icount shift=6,align=off,sleep=off \
  40. -rtc clock=vm \
  41. -kernel $ZEPHYR_ELF_PATH