A Neopixel solution for Colorlight boards ...
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

39 lines
1.2 KiB

#!/usr/bin/env python3
#
# prepare_firmware.py
#
# Utility to temporarily move project local resources to LiteX path
# (w/ backing up of original data)
#
# Hint: Don't forget to adjust local litex path BEFORE usage!
#
# History:
# --------
# 25.10.20/KQ Initial version
#
import os
import shutil
import litex.soc
def copyjob():
path2firmware = os.path.dirname(litex.soc.__file__) + "/software/bios/"
localpath = os.environ["PWD"] + "/firmware/"
originalfilename = "main.c"
backupfilename = "main.c.bak"
backupfilename2 = "main.c.original"
if os.path.isfile(path2firmware + backupfilename): # Check for existing backup
print("Backup already exists")
else: # Ok, no backup. Let's create one in-place & one to our local project directory ...
print("Preparing backup first ...")
shutil.copy2(path2firmware + originalfilename, path2firmware + backupfilename)
shutil.copy2(path2firmware + originalfilename, localpath + backupfilename2)
print("Backups in-place & to local project path finished.")
print("Copying project firmware to target path ...")
shutil.copy2(localpath + originalfilename, path2firmware + originalfilename)
if __name__ == "__main__":
copyjob()