ntoll / uflash

A module and command to easily flash Python onto the BBC's micro:bit device.
http://micropython.org/
MIT License
106 stars 27 forks source link

Extract scripts from non-uflash'd hex files #16

Open L0C4RD opened 8 years ago

L0C4RD commented 8 years ago

extract_script() is extended to be able to handle hex files that haven't necessarily been generated directly by uflash, and have perhaps been produced by other means (e.g. a hex dump via SWD.) It still works identically for uflash-generated hex files.

L0C4RD commented 8 years ago

I've slightly modified extract_script() to allow it to work across different versions of the microbit runtime. In all of its previous incarnations, it'd only work when the runtime in the hex file being interrogated was identical to that in the heredoc in uflash.py - now it ought to keep working for all past and future versions of micropython.

In other words: updating the microbit micropython runtime will no longer cause extract_script() to fail.

L0C4RD commented 8 years ago

Removed both the import IntelHex and the import StringIO. Functionality required from each of them is now encapsulated in map_memory(), which builds a representation of the device's flash memory as a Python dictionary.

I'm still getting three errors from make test, however these seem to only occur during testing - when I run the actions that make test is attempting to simulate, I get the output that the test script is expecting.

ntoll commented 8 years ago

I'll take a look and see what fresh eyes bring to the testing problem. Thanks for this work! :-)

ntoll commented 8 years ago

Hi @L0C4RD,

So I've finally managed to find some time to look into this. There are conflicts with the current master - could you perhaps rebase and resolve the conflicts and put the work into a single commit? (git pull master then git rebase -i master).

Also, if you make check you'll see that there are quite a number of code style issues (that should be relatively easy to fix). Most importantly for me is that there is NOT any doc string on the map_memory function. Essentially, could you just copy how all the other functions are documented please?

Assuming the above and the tests can be fixed (something I'll look into) then I believe we're good to merge!

Thanks for your patience.

N.