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

Upstream source of firmware.hex ? #46

Closed WayneKeenan closed 6 years ago

WayneKeenan commented 6 years ago

Hi,

Please can you tell me where the baked-in default firmware.hex is from? (e.g. which branch or tag in the BBCMicroBit MicroPython repo)

Thanks Wayne

ntoll commented 6 years ago

You can use the os module to get the Git commit hash relating to the build, like this:

>>> os.uname()
(sysname='microbit', nodename='microbit', release='1.0', version="micro:bit v1.0-b'ee6ddc8' on 2018-3-19; MicroPython v1.9.2-34-gd64154c73 on 2017-09-01", machine='micro:bit with nRF51822')

The important bit is version. The micro:bit v1.0-b'ee6ddc8' gives us the commit hash ee6ddc8. We can also see that this version of MicroPython for the micro:bit is based on upstream MicroPython at commit hash gd64154c73.

Hope this helps.

WayneKeenan commented 6 years ago

thanks again :)

WayneKeenan commented 6 years ago

With what compiler and on what platform is it built?

Sorry to be a pedant. But for example, if the toolchain uses a more recent newlib then there are ~300 bytes of RAM not available.

Which may be important, and there are perhaps other toolchain imposed differences.

ntoll commented 6 years ago

This isn't the place to discuss such things (wrong project)... ;-)

You should be asking here: https://github.com/bbcmicrobit/micropython

(Hope this helps).

WayneKeenan commented 6 years ago

Who built it for you?

WayneKeenan commented 6 years ago

Sorry if I missed a binary release

carlosperate commented 6 years ago

To be fair, since there are no binary releases, the origin and environment that built the MicroPython included in uFlash is a valid question for this repository.

ntoll commented 6 years ago

@WayneKeenan @carlosperate it was built by @dpgeorge -- although when I have the right tool chain installed I just compile them myself as per the instructions in the README at the MicroPython for micro:bit repository.

WayneKeenan commented 6 years ago

I do compile myself too happily, but my resulting build isn't necesariliy the same thing as what is in the uflash repo, I'm not looking for exact, but I'd like to know how my toolchain affects the differences.

I ask not from the point of view of an end-user, per se, but from the point of view of a system integrator building a custom MicroPython hex and trying to understand the implications for an end user (e.g. available RAM)

Hence my question, how /is/ the uflash one built?

What is: your os? your gcc version? your yotta version? less so... your cmake version? others?

Because as I've found (in the MicroPython source) things like the version of newlib actually used effects end user RAM availability.

ntoll commented 6 years ago

Aha... OK so this is definitely a question for Damien via the repos linked to above. uFlash just flashes micro:bits and has no opinions about the hex file it comes with, IYSWIM.

WayneKeenan commented 6 years ago

but you ship a default hex with Mu/uflash, so that's what I'm trying to understand.

WayneKeenan commented 6 years ago

hence the title :)

ntoll commented 6 years ago

Right... so Mu uses whatever is in uflash, that's currently what Damien built, and I don't know the answer to the questions you ask. However, if you ask Damien in the linked-to MicroPython repository (so others have visibility on this) then I'm pretty certain he'll answer. :-)

In fact, I'm pretty certain there are tickets in that repos about this very question which may already answer your questions.

ntoll commented 6 years ago

AFAICT you're asking how the hex was built from MicroPython source in a repos related to a downstream project. My advice is simply to ask back upstream in the MicroPython repos since the person who knows the answers maintains that repository.

ntoll commented 6 years ago

I want to be very clear... I'm not trying to be unfriendly or fob you off, I just think you'll have a better chance of getting the information you seek if you ask in the MicroPython repos linked to above. I sincerely hope this helps. :-)

WayneKeenan commented 6 years ago

I'm sorry, I'm not trying to be a troll or pain, I just would like to know for end user reasons, you'll see why soon :)

ntoll commented 6 years ago

Good for you! And you're certainly not a troll or a pain. I look forward to the fruits of your labours (assuming you get the answers you seek). Hurrah! :-)

dpgeorge commented 6 years ago

Hence my question, how /is/ the uflash one built?

What is: your os? your gcc version? your yotta version? less so... your cmake version? others?

Because as I've found (in the MicroPython source) things like the version of newlib actually used effects end user RAM availability.

There's currently no way to track these pieces of information for any given hex file. And even with all the above info it still might not be possible to make an equivalent build.

I usually use Arch Linux with the latest arm-none-eabi-gcc version. It was probably gcc 7.3.0. I think it was the old newlib version so it would have that extra bit of RAM.

While the compiler can subtly change end-user behaviour (eg change in stack usage and available stack for the user) the main thing to be aware of is that newer newlib's will cost 300 bytes RAM.