Python:编程 8051

发布于 2024-09-30 02:34:19 字数 1539 浏览 4 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

甜扑 2024-10-07 02:34:19

Python-on-a-Chip,但是请注意其“免责声明”:

“PyMite 虚拟机没有:

  • 内置编译器
  • 任何 Python 库(不包括电池)
  • 适合初学者的现成解决方案(您需要了解 C 语言以及如何使用微控制器)”

因此,如果提问者对python的目标是避免处理8051的陌生性,这可能没有帮助。

特别是,8051是“哈佛”风格的体系结构,具有独立的RAM和ROM代码空间,并且内部RAM非常有限,而更大的外部RAM只能通过加载特殊的DPTR寄存器然后间接读取或写入来访问,再加上没有外部 RAM 堆栈支持,也没有对基于堆栈的变量的内在支持。因此,大多数“通用”高级语言需要大量定制和重新设计才能在 8051 上运行。

一个好的 8051 专用 C 编译器可以隐藏许多这些低级细节,但最终会消耗大量周期来运行在桌面 CPU 上甚至在大多数较新的嵌入式控制器架构上执行单指令操作,即使您可以忍受这种低效率水平,您仍然需要整理各种内存空间和其他细节。

因此,对于非常熟悉 8051 奇特架构的人来说,让 Python 在 8051 上运行可能是一个具有挑战性的项目。如果您的目标是将 python 转储到 8051 上以避免需要学习这些怪癖,我不确定这是否可能。 (但是,我想 C 编译器会变得越来越好......)

There is Python-on-a-Chip, but note its "disclaimer":

"The PyMite VM DOES NOT HAVE:

  • A built-in compiler
  • Any of Python's libraries (no batteries included)
  • A ready-to-go solution for the beginner (you need to know C and how to work with microcontrollers)"

Thus, if the questioner's goal for python was to avoid dealing with the strangeness of the 8051, this may not help.

In particular, the 8051 is a "Harvard" style architecture, with separate RAM and ROM codespaces, and with very limited internal RAM, and larger external RAM that can be accessed only via loading the special DPTR register and then reading or writing indirectly, plus there's no external RAM stack support, nor intrinsic support for stack-based variables. Thus, most "general purpose" high-level languages need lots of customization and reworking to run on the 8051.

A good 8051-specific C-compiler can hide many of these low-level details, but you wind up burning lots of cycles to do things that are single instructions on desktop CPUs and even on most newer embedded controller architectures, and even if you can live with that level of in-efficiency, you still need to sort out the various memory spaces and other specifics.

So, getting Python to work on the 8051 is likely to be a challenging project for someone deeply familiar with its quirky architecture. If your goal is to dump a python onto the 8051 to avoid needing to learn these quirks, I'm not sure that is possible. (But, I suppose the C compilers keep getting better and better...)

病女 2024-10-07 02:34:19

Python-on-a-Chip 看起来和你一样接近我们将会得到。它可以运行一些比 8051 稍微强大一点的东西。

Python-on-a-Chip looks about as close as you're going to get. It can run on some things that are just a bit beefier than the 8051.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文