compileBDOS.sh 1.1 KB

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