compileAndSend.sh 1.2 KB

12345678910111213141516171819202122232425262728293031
  1. #!/bin/bash
  2. # script for compiling a bare metal C program, and send it to the FPGC, without doing tests
  3. echo "Processing: $1"
  4. # for each c file, compile and run
  5. echo "Compiling C code to B32P ASM"
  6. if (./bcc $1 ../Assembler/code.asm) # compile c code and write compiled code to code.asm in Assembler folder
  7. then
  8. echo "C code successfully compiled"
  9. echo "Assembling B32P ASM code"
  10. if (cd ../Assembler && python3 Assembler.py > ../Programmer/code.list) # compile and write to code.list in Programmer folder
  11. then
  12. echo "B32P ASM code successfully assembled"
  13. # convert list to binary files and send to FPGC
  14. if [[ $2 == "flash" || $2 == "write" ]]
  15. then
  16. (cd ../Programmer && bash compileROM.sh && echo "Flashing binary to FPGC flash" && python3 flash.py write -v verify.bin)
  17. else
  18. (cd ../Programmer && bash compileROM.sh noPadding && echo "Sending binary to FPGC" && python3 uartFlasher.py)
  19. fi
  20. else # assemble failed, run again to show error
  21. echo "Failed to assemble B32P ASM code"
  22. cd ../Assembler && python3 Assembler.py
  23. fi
  24. else # compile failed
  25. echo "Failed to compile C code"
  26. fi