runTests.sh 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/bin/bash
  2. retList=()
  3. # loop though c file arguments, compile them and run them
  4. for filename in "$@"
  5. do
  6. echo "Processing: $filename"
  7. # for each c file, compile and run
  8. echo "Compiling C code to B32P ASM"
  9. if (./bcc $filename ../Assembler/code.asm) # compile c code and write compiled code to code.asm in Assembler folder
  10. then
  11. echo "C code successfully compiled"
  12. echo "Assembling B32P ASM code"
  13. if (cd ../Assembler && python3 Assembler.py > ../Programmer/code.list) # compile and write to code.list in Programmer folder
  14. then
  15. echo "B32P ASM code successfully assembled"
  16. # convert list to binary files and send to FPGC
  17. (cd ../Programmer && bash compileROM.sh noPadding && echo "Sending binary to FPGC" && python3 uartFlasher.py testMode)
  18. retVal="$?"
  19. echo "$filename exited with code: $retVal"
  20. retList+=("$retVal")
  21. else # assemble failed, run again to show error
  22. echo "Failed to assemble B32P ASM code"
  23. cd ../Assembler && python3 Assembler.py
  24. fi
  25. else # compile failed
  26. echo "Failed to compile C code"
  27. fi
  28. # sleep alternative since it is broken in WSL1
  29. read -t 0.1
  30. done
  31. echo "Got the follwing return values:"
  32. echo ${retList[@]}