tornewuff / pycorn Goto Github PK
View Code? Open in Web Editor NEWAn interpreted operating system written in Python.
License: GNU General Public License v3.0
An interpreted operating system written in Python.
License: GNU General Public License v3.0
Allow to compile and run Pycorn on the Rapsberry Pi board. I have in background since a lot of time to port PyMite to the Rapsberry Pi, but I don't have the time or the ARM knowledges to do it (but I was able to port it to x86 using QEmu , by the way :-) ).
Since my long term purpose was to develop a pure-Python OS over it just from drivers up to process scheudler (more or less the same that Pycorn long term purpose), it would be good to allow it to run over different platforms and interpreters, both for comparation purposes and interoperability.
Develop and add a module to access to FAT filesystems using the FatFS library so we can have a basic filesystem where to start working on. Maybe it's not the perfect one (I would prefer to develop a custom RAM-based ObjectStorage that automatically does a persistent store of the Python objects, deleting any conception about volumes or storages or anything), but it's enough for the current stage of the project. Info about how to compile it for Raspberry Pi on their forums.
Regarding to the API, we can use the FatFS native one, or use the PyFilesystem project (I used it in the past and like the concept, but dislike their focus on high level inexperienced users making it dificult and very ineficient for low level developers), or develop our own one, putting atention on versatility in a similar way PyFilesystem or FUSE try to achieve, eficiency and pythonic style (for example, seeing and accessing directories as dict objects, or more agresively, directly as plain set objects, that's more close to the reality and low level concepts).
I use mkimage.py to create boot stcipt for arm platform (unrelated to pycorn).
Mkimage from Ubuntu 16.04
mkimage -A arm -O linux -T script -C none -n "bootscript" -d boot.script u-boot.scr
00000000 27 05 19 56 18 76 24 35 5b 89 19 25 00 00 00 48 |'..V.v$5[..%...H|
00000010 00 00 00 00 00 00 00 00 75 42 39 3a 05 02 06 00 |........uB9:....|
00000020 62 6f 6f 74 73 63 72 69 70 74 00 00 00 00 00 00 |bootscript......|
00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000040 00 00 00 40 00 00 00 00 31 31 31 31 31 31 31 31 |[email protected]|
00000050 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 |1111111111111111|
00000060 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 |1111111111111111|
00000070 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 |1111111111111111|
00000080 31 31 31 31 31 31 31 0a |1111111.|
00000088
mkimage.py
python mkimage.py -A arm -O linux -T script -C none -n "bootscript" -d boot.script u-boot.scr
00000000 27 05 19 56 94 43 04 e9 5b 89 19 0b 00 00 00 40 |'..V.C..[......@|
00000010 00 00 00 00 00 00 00 00 fb fa 04 76 05 02 06 00 |...........v....|
00000020 62 6f 6f 74 73 63 72 69 70 74 00 00 00 00 00 00 |bootscript......|
00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000040 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 |1111111111111111|
00000050 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 |1111111111111111|
00000060 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 |1111111111111111|
00000070 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 0a |111111111111111.|
00000080
Look like mkimage.py skips length and some padding.
I fixed it for my project, but not tested it thoroughly c1f634e.
Reproduction steps:
from metal import cpu
cpu.SystemControlCoprocessor.main_id.implementor
You get the following error:
Traceback (most recent call last):
File "", line 1, in
File "/initrd/metal/bits.py", line 65, in get
File "/initrd/metal/bits.py", line 46, in extract
TypeError: unsupported operand type(s) for &: 'NoneType' and 'long'
From looking into this, this is because:
So if I'd set the values of a field first I'd expect this to be okay.
But in a read-only register like main_id, it doesn't make sense to do that - and yet nowhere in setting up the register does self._cachedvalue gets set, so any attempt at get on any of main_id's fields will cause a TypeError.
Pycorn needs a nice logo. The obvious thing is some kind of visual pun involving snakes and something that doesn't too closely resemble the Acorn logo (http://en.wikipedia.org/wiki/File:AcornComputersLtdLogo.jpg) but one better (and less trademark-infringe-y) option would be to instead imitate the style of the BBC Micro logo (http://en.wikipedia.org/wiki/File:BBC_owl.svg) to draw something Pythonic :)
Vector format, ideally svg, would be preferred.
There were some proposals on the old bugtracker: https://bugs.launchpad.net/pycorn/+bug/319616
The bootstrap assumes it's okay to allocate pages from the space after where the rom was loaded. The ARM linux boot protocol kinda guarantees that 16KB of ram is available below the beginning of the rom, which we use, but nothing else (and even this doesn't exist in xip). It should instead parse the ATAGs to find where physical ram is.
We also don't work in XIP configs or if loaded to a non-page-aligned address...
There should be docstrings for the modules/functions provided in embryo/metal/etc.
libgcc and newlib get built for generic ARM, without any machine-specific CFLAGS. It would be nice if it could optimise them for the machine being used, but this would make them machine-specific and the structure and docs would need updating to match.
This is particularly relevant for the raspberry pi port, which won't be able to use the hardfloat ABI otherwise.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.