-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
Description
Description
I've been using mpremote heavily over the past week to upload .py/.mpy files to my board via UART. Twice, my MCU ran into mysterious errors that were fixed simply by re-uploading the same file. That strongly suggested the transferred file got corrupted during transmission (likely due to marginal serial line quality).
Would it be possible to add a simple verification mechanism (like a checksum or CRC) for file transfers? (Commands need checksum also if it is a long function)
Code Size
We can implement this to mpremote pc tool. In that case no firmware size incresement
Implementation
I hope the MicroPython maintainers or community will implement this feature
Code of Conduct
Yes, I agree
Update:
In addition to verifying the transmitted file, I believe we should also consider verifying the commands sent from PC to MCU. Like this :
mcu_need_run='''
def cmd_from_mpremote():
...
long function
...
cmd_from_mpremote()
'''
hash_of_mcu_need_run='6789a1b2c3....'
if check(mcu_need_run, hash_of_mcu_need_run):
exec(mcu_need_run)
That sounds will require a lot of changes. But I think it makes sense. From my understanding, mpremote works by sending Python code as string via UART to MCU REPL.
Update again:
When we use mpremote cat, mpremote cp to fetch files from mcu to pc, also, checksum is needed.