ntoll / uflash

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

uflash cannot generate hex for microbit v2. #67

Closed crouse12 closed 1 year ago

crouse12 commented 3 years ago

I got a microbit v2. I found that uflash cannot generate .hex for microbit v2. Do you have any plan to update uflash?

ntoll commented 3 years ago

Hi @crouse12 - yes, this is all in hand and something I've been looking into, but the "universal" hex containing MicroPython isn't quite there yet.

I'm in touch with the micro:bit foundation and will follow their lead when they say things are ready. I'm cc'ing @carlosperate (of micro:bit) just for visibility.

crouse12 commented 3 years ago

Thanks for your help.

your-diary commented 3 years ago

Any update?

carlosperate commented 3 years ago

@ntoll I had a look at this during the weekend, and I don't think it's worth adding the universal hex into this project.

The attach method only works on v1, so we would need to implement a way to identify v1 vs v2 (the easiest way is using the pyserial package, but that adds a dependency to this pure-stand-along module). And then at that point the only thing uFlash could do on a V2 is to flash MicroPython on its own (would it throw an error if a user tries to flash a python script into a v2?).

crouse12 commented 3 years ago

@ntoll I had a look at this during the weekend, and I don't think it's worth adding the universal hex into this project.

The attach method only works on v1, so we would need to implement a way to identify v1 vs v2 (the easiest way is using the pyserial package, but that adds a dependency to this pure-stand-along module). And then at that point the only thing uFlash could do on a V2 is to flash MicroPython on its own (would it throw an error if a user tries to flash a python script into a v2?).

I think you don't need to identify microbit v1 vs v2. You can add some instructions for microbit v2. Then, we use these instructions to flash microbit v2.

kjcole commented 3 years ago

Any news? Work-arounds?

ntoll commented 3 years ago

Current master should work for you now. Next Mu will have these fixes too. Thanks and kudos to @carlosperate for making this happen.

carlosperate commented 3 years ago

Just a small correction, current master doesn't yet work for V2, PR https://github.com/ntoll/uflash/pull/72 still needs more tests to be updated before it can be merged and I haven't had the time to do that yet. But if you use the uFlash version from that branch it should work.

ntoll commented 3 years ago

Yeah... sorry @carlosperate - I still need my morning coffee... ;-)

kjcole commented 3 years ago

Thanks.

My "git-fu" is not great, but if I understand correctly, I should use https://github.com/carlosperate/uflash/tree/fs-cli if I want to uflash the v.2.0 today?

carlosperate commented 3 years ago

Yes, but as that is still a work-in-progress the universal hex is read from the the upy-uh.hex file, it is not included directly in the uflash.py file, so you'd need to have both files available (cloning the repo and checking out that branch should work perfectly fine though).

If you want everything in a single file ready to be moved somewhere else you could use the copy inside the Mu editor: https://github.com/mu-editor/mu/blob/master/mu/contrib/uflash.py That file has the universal hex added inside the uflash.py file already.

randomsmith9 commented 3 years ago

Thanks.

My "git-fu" is not great, but if I understand correctly, I should use https://github.com/carlosperate/uflash/tree/fs-cli if I want to uflash the v.2.0 today?

So what does that mean? (I am a developer, but new to python)

using something like python setup.py sdist bdist_wheel to create a package to install locally? and then install from the .whl file

or something like python setup.py develop to install to a local virtual environment.

Then that would give option of using micropython within intellij to flash files to micro bit v2 with the repl (I guess that uflash is a separate dependency for micropython so you can install any version yourself? or I can see that you can use uflash to watch for saves to a file and then you could load it without using the repl from within intellij

carlosperate commented 1 year ago

The uFlash v2.0.0 release includes support for micro:bit V2, so this can be considered done 👍

ntoll commented 1 year ago

Thank you.!