CircuitPython build process

Where can I find instructions to build a CircuitPython binary for myself? Are we using the official AdaFruit distribution? I was expecting to find something in the Gamebuino github but saw nothing… did I just miss it?

I was expecting to find at least the python libraries mentioned in the examples, gamebuino_meta, etc.

I think it’s a fork of the official distribution, modified to fit with the loader of the Meta. Of what I know it hasn’t been open-sourced yet but it’s planned to be. Maybe @Sorunome can say more about that.

That is all correct

I was thinking of playing around with building more of a mini-OS and CircuitPython would probably be a good foundation since you can already run Python scripts. But no idea how many of the RAM/flash is used already in the default build, etc.

It uses about 20K ram and about all but 0x8000 flash

I wonder how large a python program you can write before you hit RAM issues… Python is pretty dynamic a language. And 12k for the interpreter isn’t a lot.

Are the programs loading into RAM or running from disk (ie, read, parse, execute one line at a time) - do you know? I’m not that familiar with the Python VM or if that’s even possible. Though I guess the IO speed would limit you a lot also if that were the case.

Very curious about this. :slight_smile:

Programs are running from the 0x8000 virtual flash drive that it exposes via USB. If you haven’t yet, you should try the binary

That wouldn’t tell me much about how it works. :slight_smile: I should go see how accessible the source code is.

Programs are running from the 0x8000 virtual flash drive that it exposes via USB.

Oh, so it’s not exposing the real flash drive? And you’d have to expand on “running from”… if the program isn’t actually loaded into RAM then I presume it’d be using just the 512 byte buffer in the FAT driver (plus perhaps another buffer in the Python code)… in any case that wouldn’t be very optimal if a program was larger than 512 or crossed block boundaries. IE, it’d be paging in and out constantly.

No, but you know what features it has so that stuff like this:

is more easily understandable.

It currently does not expose the real flash drive due to only having limited time to implement stuffs and so circuitpython does not have any sd capability currently

You’d also easily see this once you tried circuitpython out: the program runs from flash. As that uses circuitpythons internal implemetnation, not too sure what is ram buffered there and what not

I think we’re talking around each other a bit. I know it’s not loaded into the ROM. I think I was asking a question more about the internal workings of the Python VM and whether the whole program has to be loaded into RAM before it can executed or if it can be just read from disk and run “one line at a time” so to speak, as a lot of simple BASIC interpreters would do.

No, it doesn’t load the entire script into ram prior executing

Interesting. It seems with your I/O latency that running from “disk” could be really scary if your program was longer than one block (512 bytes). Without the code being published yet I’d have to imagine you’re using the existing Gamebuino libraries for hardware support (correct me if I’m wrong) and that means that if you ever wound up with a program running a tight loop across a block boundary that your speed would drop very low as the interpreter spends all it’s time loading both blocks from the dick back to back.

Yeah, it uses the gamebuino meta library, just added python bindings for that (and disabled all the SD card stuffs, as we use SdFat in the library which is tightly bound to the arduino framework, which is conflicting with what circuitpython uses)