mirror of
https://github.com/Polprzewodnikowy/SummerCart64.git
synced 2024-11-22 05:59:15 +01:00
[SC64][SW] Adjusted primer.py script
This commit is contained in:
parent
ed6d01a066
commit
8a8bf665f9
@ -97,4 +97,4 @@ Congratulations! Your SC64 flashcart should be ready for use!
|
|||||||
|
|
||||||
*`primer.py` threw error on `Bootloader -> SC64 FLASH` step*
|
*`primer.py` threw error on `Bootloader -> SC64 FLASH` step*
|
||||||
|
|
||||||
This issue can be attributed to incorrectly programmed FT232H EPPROM in first programming step. Check again in `FT_PROG` if device was configured properly. Once FPGA and microcontroller has been programmed successfully, `primer.py` script cannot be used again. Please use command `python3 sc64.py --update-firmware sc64_update_package.bin` to try programming bootloader again.
|
This issue can be attributed to incorrectly programmed FT232H EEPROM in the first programming step. Check again in `FT_PROG` program if device was configured properly. Once FPGA and microcontroller has been programmed successfully `primer.py` script needs to be run in special mode. Please use command `python3 primer.py COMx sc64_update_package.bin --only-bootloader` to try programming bootloader again.
|
||||||
|
@ -422,41 +422,41 @@ class SC64BringUp:
|
|||||||
def get_update_info(self) -> str:
|
def get_update_info(self) -> str:
|
||||||
return self.__sc64_update_data.get_update_info()
|
return self.__sc64_update_data.get_update_info()
|
||||||
|
|
||||||
def start_bring_up(self, port: str) -> None:
|
def start_bring_up(self, port: str, only_bootloader: bool=False) -> None:
|
||||||
link = None
|
link = None
|
||||||
try:
|
try:
|
||||||
link = serial.Serial(
|
if (not only_bootloader):
|
||||||
port,
|
link = serial.Serial(
|
||||||
baudrate=self.__SERIAL_BAUD,
|
port,
|
||||||
parity=serial.PARITY_EVEN,
|
baudrate=self.__SERIAL_BAUD,
|
||||||
timeout=self.__SERIAL_TIMEOUT,
|
parity=serial.PARITY_EVEN,
|
||||||
write_timeout=self.__SERIAL_TIMEOUT
|
timeout=self.__SERIAL_TIMEOUT,
|
||||||
)
|
write_timeout=self.__SERIAL_TIMEOUT
|
||||||
|
)
|
||||||
|
|
||||||
stm32_bootloader = STM32Bootloader(link.write, link.read, self.__progress)
|
stm32_bootloader = STM32Bootloader(link.write, link.read, self.__progress)
|
||||||
lcmxo2_primer = LCMXO2Primer(link.write, link.read, self.__progress)
|
lcmxo2_primer = LCMXO2Primer(link.write, link.read, self.__progress)
|
||||||
|
|
||||||
stm32_bootloader.connect(stm32_bootloader.DEV_ID_STM32G030XX)
|
stm32_bootloader.connect(stm32_bootloader.DEV_ID_STM32G030XX)
|
||||||
stm32_bootloader.load_ram_and_run(self.__sc64_update_data.get_primer_data(), 'FPGA primer -> STM32 RAM')
|
stm32_bootloader.load_ram_and_run(self.__sc64_update_data.get_primer_data(), 'FPGA primer -> STM32 RAM')
|
||||||
time.sleep(self.__INTERVAL_TIME)
|
time.sleep(self.__INTERVAL_TIME)
|
||||||
link.read_all()
|
link.read_all()
|
||||||
|
|
||||||
lcmxo2_primer.connect(lcmxo2_primer.DEV_ID_LCMXO2_7000HC)
|
lcmxo2_primer.connect(lcmxo2_primer.DEV_ID_LCMXO2_7000HC)
|
||||||
lcmxo2_primer.load_flash_and_run(self.__sc64_update_data.get_fpga_data(), 'FPGA configuration -> LCMXO2 FLASH')
|
lcmxo2_primer.load_flash_and_run(self.__sc64_update_data.get_fpga_data(), 'FPGA configuration -> LCMXO2 FLASH')
|
||||||
time.sleep(self.__INTERVAL_TIME)
|
time.sleep(self.__INTERVAL_TIME)
|
||||||
link.read_all()
|
link.read_all()
|
||||||
|
|
||||||
stm32_bootloader.connect(stm32_bootloader.DEV_ID_STM32G030XX)
|
stm32_bootloader.connect(stm32_bootloader.DEV_ID_STM32G030XX)
|
||||||
stm32_bootloader.load_flash_and_run(self.__sc64_update_data.get_mcu_data(), 'MCU software -> STM32 FLASH')
|
stm32_bootloader.load_flash_and_run(self.__sc64_update_data.get_mcu_data(), 'MCU software -> STM32 FLASH')
|
||||||
time.sleep(self.__INTERVAL_TIME)
|
time.sleep(self.__INTERVAL_TIME)
|
||||||
link.read_all()
|
link.read_all()
|
||||||
|
|
||||||
sc64 = SC64()
|
|
||||||
bootloader_description = 'Bootloader -> SC64 FLASH'
|
bootloader_description = 'Bootloader -> SC64 FLASH'
|
||||||
bootloader_data = self.__sc64_update_data.get_bootloader_data()
|
bootloader_data = self.__sc64_update_data.get_bootloader_data()
|
||||||
bootloader_length = len(bootloader_data)
|
bootloader_length = len(bootloader_data)
|
||||||
self.__progress(bootloader_length, 0, bootloader_description)
|
self.__progress(bootloader_length, 0, bootloader_description)
|
||||||
sc64.upload_bootloader(bootloader_data)
|
SC64().upload_bootloader(bootloader_data)
|
||||||
self.__progress(bootloader_length, bootloader_length, bootloader_description)
|
self.__progress(bootloader_length, bootloader_length, bootloader_description)
|
||||||
finally:
|
finally:
|
||||||
if (link and link.is_open):
|
if (link and link.is_open):
|
||||||
@ -464,11 +464,19 @@ class SC64BringUp:
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
if (len(sys.argv) != 3):
|
nargs = len(sys.argv)
|
||||||
Utils.die(f'Usage: {sys.argv[0]} serial_port update_file')
|
if (nargs < 3 or nargs > 4):
|
||||||
|
Utils.die(f'Usage: {sys.argv[0]} serial_port update_file [--only-bootloader]')
|
||||||
|
|
||||||
port = sys.argv[1]
|
port = sys.argv[1]
|
||||||
update_data_path = sys.argv[2]
|
update_data_path = sys.argv[2]
|
||||||
|
only_bootloader = False
|
||||||
|
if (nargs == 4):
|
||||||
|
if (sys.argv[3] == '--only-bootloader'):
|
||||||
|
only_bootloader = True
|
||||||
|
else:
|
||||||
|
Utils.die(f'Unknown argument: {sys.argv[3]}')
|
||||||
|
|
||||||
utils = Utils()
|
utils = Utils()
|
||||||
sc64_bring_up = SC64BringUp(progress=utils.progress)
|
sc64_bring_up = SC64BringUp(progress=utils.progress)
|
||||||
|
|
||||||
@ -486,6 +494,10 @@ if __name__ == '__main__':
|
|||||||
Utils.log(sc64_bring_up.get_update_info())
|
Utils.log(sc64_bring_up.get_update_info())
|
||||||
Utils.log()
|
Utils.log()
|
||||||
|
|
||||||
|
if (only_bootloader):
|
||||||
|
Utils.log('Running in "only bootloader" mode')
|
||||||
|
Utils.log()
|
||||||
|
|
||||||
Utils.warning('[ CAUTION ]')
|
Utils.warning('[ CAUTION ]')
|
||||||
Utils.warning('Configure FTDI chip with provided ft232h_config.xml before continuing')
|
Utils.warning('Configure FTDI chip with provided ft232h_config.xml before continuing')
|
||||||
Utils.warning('Connect SC64 USB port to the same computer you\'re running this script')
|
Utils.warning('Connect SC64 USB port to the same computer you\'re running this script')
|
||||||
@ -507,7 +519,7 @@ if __name__ == '__main__':
|
|||||||
original_sigint_handler = signal.getsignal(signal.SIGINT)
|
original_sigint_handler = signal.getsignal(signal.SIGINT)
|
||||||
try:
|
try:
|
||||||
signal.signal(signal.SIGINT, lambda *kwargs: utils.exit_warning())
|
signal.signal(signal.SIGINT, lambda *kwargs: utils.exit_warning())
|
||||||
sc64_bring_up.start_bring_up(port)
|
sc64_bring_up.start_bring_up(port, only_bootloader)
|
||||||
except (serial.SerialException, STM32BootloaderException, LCMXO2PrimerException) as e:
|
except (serial.SerialException, STM32BootloaderException, LCMXO2PrimerException) as e:
|
||||||
if (utils.get_progress_active):
|
if (utils.get_progress_active):
|
||||||
Utils.log()
|
Utils.log()
|
||||||
|
Loading…
Reference in New Issue
Block a user