-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clean up tinyprog for releasing #36
Conversation
* Add README.md to the rendering. * Add MANIFEST.ini * Add tox.ini for testing in Python versions.
Also add a tinyprog --version argument to get the tinyprog version that is currently installed.
@ewenmcneill - Please take a look. |
96cf89f
to
506b087
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than the comments mentioned, it looks basically okay to me. There's a bunch of code churn but most of it seems to be caused by intentional reformatting. With the TypeError
correction, and the formatting string fixups, I'm able to run successfully.
The addition of a --version
seems very helpful (although I've not installed your pull request version in a way that works properly for me).
Ewen
(tinyfpga) ewen@parthenon:/src/tinyfpga/packages/TinyFPGA-Bootloader/programmer$ PYTHONPATH=. python3 /src/fpga/litex-buildenv/build/conda/bin/tinyprog --program-image /src/fpga/litex-buildenv/build/tinyfpga_bx_base_lm32.minimal//image-gateware+bios+micropython.bin
TinyProg CLI
------------
Using device id 1d50:6130
Only one board with active bootloader, using it.
Programming /dev/ttyACM0 with /src/fpga/litex-buildenv/build/tinyfpga_bx_base_lm32.minimal//image-gateware+bios+micropython.bin
Programming at addr 028000
Waking up SPI flash
442884 bytes to program
Programming and Verifying: 100%|█████████| 443k/443k [00:10<00:00, 40.6kB/s]
Success!
(tinyfpga) ewen@parthenon:/src/tinyfpga/packages/TinyFPGA-Bootloader/programmer$
def boot(self): | ||
try: | ||
self.ser.write(b"\x00") | ||
self.ser.flush() | ||
except: | ||
except Exception: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mithro is writeTimeoutError
an exception? I'm both unclear whether that's true, and also on one run I did have programming bail out due to a writeTimeoutError
which I hadn't seen happen before.
Ewen
(tinyfpga) ewen@parthenon:/src/tinyfpga/packages/TinyFPGA-Bootloader/programmer$ PYTHONPATH=. python3 /src/fpga/litex-buildenv/build/conda/bin/tinyprog --program-image /src/fpga/litex-buildenv/build/tinyfpga_bx_base_lm32.minimal//image-gateware+bios+micropython.bin
TinyProg CLI
------------
Using device id 1d50:6130
Only one board with active bootloader, using it.
Programming /dev/ttyACM0 with /src/fpga/litex-buildenv/build/tinyfpga_bx_base_lm32.minimal//image-gateware+bios+micropython.bin
Programming at addr 028000
Waking up SPI flash
442884 bytes to program
Programming and Verifying: 1%| | 5.63k/443k [00:01<01:31, 4.80kB/s]
Traceback (most recent call last):
File "/src/fpga/litex-buildenv/build/conda/bin/tinyprog", line 11, in <module>
sys.exit(main())
File "/src/tinyfpga/packages/TinyFPGA-Bootloader/programmer/tinyprog/__main__.py", line 455, in main
if not fpga.program_bitstream(addr, bitstream):
File "/src/tinyfpga/packages/TinyFPGA-Bootloader/programmer/tinyprog/__init__.py", line 497, in program_bitstream
return self.program_sectors(addr, bitstream)
File "/src/tinyfpga/packages/TinyFPGA-Bootloader/programmer/tinyprog/__init__.py", line 441, in program_sectors
max_length=256)
File "/src/tinyfpga/packages/TinyFPGA-Bootloader/programmer/tinyprog/__init__.py", line 403, in write
self._write(addr, write_data)
File "/src/tinyfpga/packages/TinyFPGA-Bootloader/programmer/tinyprog/__init__.py", line 389, in _write
self.wait_while_busy()
File "/src/tinyfpga/packages/TinyFPGA-Bootloader/programmer/tinyprog/__init__.py", line 319, in wait_while_busy
while to_int(self.read_sts()) & 1:
File "/src/tinyfpga/packages/TinyFPGA-Bootloader/programmer/tinyprog/__init__.py", line 276, in read_sts
return self.cmd(0x05, read_len=1)
File "/src/tinyfpga/packages/TinyFPGA-Bootloader/programmer/tinyprog/__init__.py", line 262, in cmd
self.ser.write(bytearray(cmd_write_string))
File "/src/tinyfpga/packages/TinyFPGA-Bootloader/programmer/tinyprog/__init__.py", line 94, in write
self.ser.write(data)
File "/src/tinyfpga/tools/lib/python3.5/site-packages/serial/serialposix.py", line 579, in write
raise writeTimeoutError
serial.serialutil.SerialTimeoutException: Write timeout
(tinyfpga) ewen@parthenon:/src/tinyfpga/packages/TinyFPGA-Bootloader/programmer$
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can find:
which suggests writeTimeoutError
is a SerialTimeoutException
:
which seems to be a SerialError
:
which seems to be an IOError
. Which I think should be an Exception
? So I'm a bit unclear what's going on here.
But if it's only writeTimeoutError
that's expected, maybe it'd make sense to be more specific? except Exception
doesn't seem much more useful than except: pass
....
Ewen
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We concluded this was a different path triggering this exception.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(We should probably also be only catching writeTimeoutError here too as you mention.)
@mithro, FTR, the version now in master, with cleanups we went through in person seems to work okay. So I think we just treat it as "merged by having same commits added to Ewen
|
--version
command line argument.