嵌入式python? [英] embedded python?

查看:108
本文介绍了嵌入式python?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我喜欢Python!我已经使用它几年了,并且发现它是一种高效的语言。我向我的开发者传福音

朋友,我可能负责出售至少10本Alex

Martelli书籍。我现在处于能够使用

Python进行大型项目的幸运位置,因此我有一个问题。


我们正在开发一个分布式应用程序在大约6个b $ b $节点上运行,硬件资源有限。我们的硬件

目标是66 MHz ARM型处理器,16 Mb内存。我们还没有选择

特定的硬件;我们试图根据价格限制将硬件目标纳入
。每个设备都需要能够处理大约2 b / b $ b bbs(是公斤,而不是超级)的网络流量。


我打算最少原型Python中的系统。如果我们能够通过将Python嵌入到硬件中来生产Python,那将会很棒。我的

问题是否有人在

嵌入式系统中使用python有任何实际经验?两大类问题:


1)那里有嵌入的蟒蛇吗?这些节点可能会运行某种形式的Linux,但我并不特别愿意花费多少资金来移植python。任何支持Python的嵌入式Linux?

一般的想法?


2)Python的资源需求是什么?

网络相关模块增加了多少开销?显然,一旦编写原型,我就能确定我们的

应用程序的资源使用情况,但我很好奇

关于其他人过去的经历。


总之,嵌入python是否真实?


非常感谢您的想法和评论!


谢谢,

Alex

解决方案

Alexander May写道:

我们正在开发一个运行在大约六千个节点上的分布式应用程序,其硬件资源有限。我们的硬件目标是66 MHz ARM型处理器,16 Mb ram。我们还没有选择具体的硬件;硬件目标是我们根据价格限制尝试适应的目标。每个设备需要能够处理大约2
kbs(是公斤,不是兆)的网络流量。


你提到网络,所以你可能有以太网(?)接口,以及

计划TCP或UDP,在这种情况下你可能首先需要考虑

操作系统...... Python不会自动为你提供支持
网络,它只是使用底层操作系统支持。

我打算Python中的系统最少原型。如果我们能够通过将Python嵌入到硬件中来生产Python,那将会很棒。我的
问题是,有没有人在嵌入式系统中使用python有任何实际经验?


是的,这里有一些人曾经使用嵌入式

Python系统,包括我(在过去的雇主)。

1)那里有嵌入的蟒蛇吗?节点可能会运行某种形式的Linux,但我并不特别喜欢将端口用于移植python。任何支持Python的嵌入式Linux?
一般的想法?


我怀疑你需要做多少搬运。除非你正在考虑的Linices是非常不寻常的,否则它们应该看起来很像其他Linux,并且Python可能在很大程度上保持不变。无论如何,任何所需的

更改都可能在您不需要的区域。再一次,确保你真正考虑到你真正需要的除了

网络之外的OS资源。

多任务?信号?音频?

GUI?等......

2)Python的资源需求是什么?
网络相关模块增加了多少开销?


_socket.pyd在Win32上是49212,在Linux上是124040(可能包含调试

符号表?),对于Python 2.3.4。这包括

很多文档字符串,所以你可以在编译过程中使用可配置的设置轻松缩小它。

In简而言之,嵌入python是否真实?




绝对可以。我们首先使用33MHz 386(或286?)兼容的b $ b板,只有1MB的闪存和1MB的RAM,以及一个没有网络的微型嵌入式操作系统。这需要一点点削减,例如删除

浮点支持,但是大部分时间这些东西都是#defines在编译期间支持的b $ b。我认为我们在Python 1.5.2上基于
。 (这是在几年前。)性能,然而,
然而,结果证明是不够的,我们决定通过保持Python并切换到更快的速度来获得更多的b $ b更快的硬件

(比放弃Python并用C语言完成)。


下一个版本是100MHz 486兼容32MB RAM和

Compact Flash作为硬盘。我们选择32MB闪存作为目标,然后使用64MB进行原型设计并继续使用它,因为

CF卡越来越便宜。这个版本运行了vanilla Linux

,所有非必要的东西都被移除了,而且Python的库存重新编译了

来自我认为没有变化的来源。我们从生成的二进制文件中删除了一些库

文件(例如unicodedata.so)以减少

的足迹。


我知道其他人在这个范围内的硬件上做了类似的事情,

但我还不知道有什么免费的。不确定

是否有意义,因为每个人都使用不同的硬件

这类东西...


我可以从这次经历中给出的主要建议是,如果你的硬件并没有完全削减它,考虑把钱花在更好的硬件而不是立即放弃任何想法

使用Python。另一方面,你有6K节点,而我们b
不到几百,所以规模经济只是

在我们的案例中并没有那么多,开发成本是最大的考虑因素。在您的情况下,在每个

单元上保存


100可能比节省几千小时

的开发时间更重要。 ..你的电话。


-Peter


> 1)那里有嵌入的蟒蛇吗?节点很可能是

运行某种形式的Linux,但我并不特别喜欢将端口用于移植python。任何支持Python的嵌入式Linux?
一般的想法?



Python在运行Linux的基于ARM的PDA上运行良好 - 参见
http://www.vanille.de/projects/python.spy 获取信息还有一个令人惊讶的数额

的ARM二进制文件。请注意,软件包采用ipkg(.ipk)格式。这些

类似于Debian的.deb文件,你可以使用

tar几次获取内容。


Hi,

I love Python! I''ve been using it for a couple of years now and have found
it to be a highly productive language. I evangelize it to my developer
friends and am probably responsible for the sale of at least 10 Alex
Martelli books. I am now in the fortunate position of being able to use
Python for a large project, and as such I have a question.

We are developing a distributed application running on approximately six
thousand nodes with somewhat limited hardware resources. Our hardware
target is 66 MHz ARM style processor with 16 Mb ram. We haven''t selected
specific hardware yet; the hardware target is what we are trying to fit into
based on price constraints. Each device needs to be able to handle about 2
kbs (yes kilo, not mega) worth of network traffic.

I intend to a least prototype the system in Python. It would be great if we
could we could use Python in production by embedding it in the hardware. My
question is does anyone have any real world experience using python in an
embedded system? Two general categories of questions:

1) Are there any embedded Pythons out there? The nodes will likely be
running some form of Linux, but I don''t particularly feel like devoting
resrouces to porting python. Any embedded Linuxes supporting Python?
Thoughts in general?

2) What are the resource requirements of Python? How much overhead do the
network related modules add? Obviously I''ll be able to determine our
application''s resource usage once the prototype is written, but I curious
about other people''s past experience.

In short, is embedding python realistic?

Thoughts and comments are greatly appreciated!

Thanks,
Alex

解决方案

Alexander May wrote:

We are developing a distributed application running on approximately six
thousand nodes with somewhat limited hardware resources. Our hardware
target is 66 MHz ARM style processor with 16 Mb ram. We haven''t selected
specific hardware yet; the hardware target is what we are trying to fit into
based on price constraints. Each device needs to be able to handle about 2
kbs (yes kilo, not mega) worth of network traffic.
You mention network, so presumably you have Ethernet (?) interfaces, and
plan on TCP or UDP, in which case you probably first need to consider
operating systems... Python does not automatically give you support for
networking, it just uses the underlying OS support.
I intend to a least prototype the system in Python. It would be great if we
could we could use Python in production by embedding it in the hardware. My
question is does anyone have any real world experience using python in an
embedded system?
Yes, there are a few people around here who have worked on embedded
Python systems, including me (at a past employer).
1) Are there any embedded Pythons out there? The nodes will likely be
running some form of Linux, but I don''t particularly feel like devoting
resrouces to porting python. Any embedded Linuxes supporting Python?
Thoughts in general?
I doubt you''ll need to do much "porting". Unless the Linices you
are considering are quite unusual, they ought to look a lot like any
other Linux, and Python may well work largely unchanged. Any required
changes could be in areas you don''t need, anyway. Again, make sure
you consider right away exactly what OS resources, other than
networking, that you actually need. Multitasking? Signals? Audio?
GUI? etc...
2) What are the resource requirements of Python? How much overhead do the
network related modules add?
_socket.pyd is 49212 on Win32, and 124040 (probably with debugging
symbol table included?) on Linux, for Python 2.3.4. This includes
lots of doc-strings, though, so you can probably shrink it pretty
easily with a configurable setting during compilation.
In short, is embedding python realistic?



Definitely. We did it first on a 33MHz 386 (or 286?) compatible
board with only 1MB of flash and 1MB of RAM, and a tiny embedded
OS with no networking. That took a little slashing, such as removing
floating point support, but for the most part such things were
supported well by #defines during compilation. I think we based
that one on Python 1.5.2. (It was a few years ago.) Performance,
however, turned out to be inadequate and we decided we''d get
farther faster by keeping Python and switching to faster hardware
(than by ditching Python and doing it all in C).

The next version was a 100MHz 486 compatible with 32MB RAM and
Compact Flash as a hard drive. We picked 32MB flash as the target,
but used 64MB for prototyping and kept using it thereafter because
CF cards kept getting cheaper. This version ran vanilla Linux
with everything non-essential removed, and stock Python recompiled
from sources with, I believe, no changes. We stripped a few library
files from the resulting binary (e.g. unicodedata.so) to reduce the
footprint.

I know others have done similar things on hardware in this range,
but I don''t know of anything freely available yet. Not sure that
would make sense, either, as everybody uses different hardware in
this sort of thing...

The main advice I can give you from this experience is that if
your hardware doesn''t quite cut it, considering putting the money
into better hardware rather than immediately abandoning any thought
of using Python. On the other hand, you have 6K nodes, and we
had less than a few hundred, so the "economies of scale" just
weren''t there as much in our case and development costs were
the largest consideration. In your case, saving


100 on each
unit might be more important than saving a few thousand hours
of development time... your call.

-Peter


> 1) Are there any embedded Pythons out there? The nodes will likely be

running some form of Linux, but I don''t particularly feel like devoting
resrouces to porting python. Any embedded Linuxes supporting Python?
Thoughts in general?



Python runs fine on ARM-based PDAs running Linux -- see
http://www.vanille.de/projects/python.spy for info and a surprising amount
of ARM binaries. Note that the packages are in ipkg (.ipk) format. These
are similar to Debian''s .deb files, and you can get at the contents using
tar a couple of times.


这篇关于嵌入式python?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆