-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Port to Frosted OS #2634
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Port to Frosted OS #2634
Conversation
Thanks for the submission. Unfortunately this kind of thing is really outside the scope of the current plans for MicroPython. See #2602. There is already preliminary support for uPy on top of Zephyr, and see also #2501 for another RTOS. What are the benefits of frosted and how does uPy fit into its "ecosystem" and its vision/long-term plans? |
@dpgeorge , @pfalcon thanks for the comments. Let me try to provide some background. Insane-adding-machines is a small community that has been developing frosted for 18 months now. Unlike most embedded OSes targeting the same devices (Cortex-M), we focus on hard kernel/userspace separation, memory safety and full POSIX compliance. Kernel space code is GPL, but our libC has a permissive license that allows linking applications and libraries as separate binaries. uPy runs in userspace and would be distributed with its original license. We already maintain a small set of userspace tools including a shell, some unix utilities and network configuration tools. The final goal of this preliminary port would be to have a usable python interpreter in userspace, with a strong focus on networking (socket), and support for pthreads as our kernel already provides both for C programs at this time. I should have checked #2602 myself and realize that such a PR this is not in line with your current development cycle. I understand that this PR as is introduces quite some duplication from the unix port, as that's what it is based on, as we already provide the syscalls needed for the minimal interpreter to run "unix-style". There is on the other hand some interest from the community to expand this port by providing specific support for sensors drivers etc. Moreover, the unix port seems to be sized for more powerful platforms, while we want to be a bit closer to the resources needed by the stm-hal port. For these reasons we started an off-tree, self-contained port which allows for more fine-tuned configuration and gives some flexibility to change platform-specific code. In our plans, the /frosted dir will see some clean-up for modules that are currently not in use, and later on, the addition of a few OS-specific features. The only modification currently needed to compile our port against the upstream code is the define in py/emitglue.c for the definition of The goal for this PR was to hear from you folks about the technical choices we've taken so far and receive some hints on how to proceed. While the code is pretty much self-contained in the frosted directory it is easy to follow upstream development, so we have no urge for an inclusion, but it would be appreciated if we could receive more pointers so that when this project is in a better state and more in line with your vision and goals, it would probably allow for a cleaner PR which I expect to come in the near future. If you want to know more, continue this discussion or just chat with us, we're always on IRC (#frosted channel on freenode), so feel free to pass by and say hello. Meanwhile, thanks again for checking this submission at its early stage, and apologies for the long reply. |
@danielinux thanks for the detailed reply.
Yes, this bit was always temporary and overdue for a proper clean up (basically to make the lexer and the precompiled-bytecode loader use the same back-end file-reading code). I've now done that in 6b239c2 (and other surrounding commits), so you should be able to have a completely self-contained patch for the frosted port. |
Thanks @dpgeorge - our branch is now updated, and the current patch is completely self-contained. |
Just an update on this. Since this PR has been submitted, Frosted has added support for pthreads, hence it is possible to enable threading in our branch now. A small We'll keep you posted. ⛄ ❤️ 🐍 |
@danielinux : Here's a comment I wanted to give long ago: as far as I understand, FrostedOS strives to be POSIX-compliant, and we have a POSIX port of MicroPython under So, feel free to see what it would take to make unix port to build/run on Frosted. Otherwise, I'm not sure if it's practical to have another port of 5000+ lines, majority of which is just duplication of existing code. And if you seriously think about upstreaming, you should also think about CI support (that's necessary, but not sufficient condition; see travis-esp8266 branch for a CI setup which includes adhoc toolchain requirements, etc.). |
Starting the port on Frosted helped us a lot indeed to complete and improve (part of) our POSIX system call API. I agree with you that a more valid approach could have been to adapt the We've chosen to go this way mostly to try and be less invasive and avoid tampering with the unix port. Also, Here are a few open points we would need to address when moving our integration under
Keeping a separate port has allowed us for a much simpler compile-time configuration (most of the parameters are hardcoded), customized feature shrinking, rapid merge back (which is important due to your current high commit rate). Moreover, some code from the unix port is still in We appreciate the heads-up about the upstream inclusion process. I'd say we continue our research on a separate directory for now, and we'll ensure to get our port up to your quality standards if/when we are moving back to FYI, The current size of a micropython binary compiled for frosted : Thank you for taking the time to check and comment. |
Thanks again for this PR. Unfortunately it's not possible to support/maintain this new port in this repository, and the zephyr port already provides similar functionality with a lot of hardware/boards supported. It would be great to see this Frosted OS port continued as an out-of-tree (ie not in this repo) port, using MicroPython as a submodule. This is now made a lot easier to do in the past few years. |
Hey @dpgeorge thanks for taking the time to comment on this PR. We haven't been following frosted for while now, but we are still proud of our custom micropython port with threading on Cortex-M. We'll be keeping our off-tree module as suggested. |
Sounds good! Please do mention it at https://forum.micropython.org and link from the wiki at https://wiki.micropython.org |
This PR adds support for ⛄ Frosted ⛄
Please comment on this pull request and/or consider for inclusion upstream.
Frosted (https://github.com/insane-adding-machines/frosted) is a Free embedded OS providing POSIX calls.
For this reason, this initial port has been initially based on the existing UNIX port. The idea is to extend the support later on to have full working sockets and threads.
sys
module OKusocket
/socket
modules loading fine, with still some minor glitches to fix (Allocation onsocket.bind()
)How to test:
make
micropython
onto your board xipfs