在嵌入式系统上组织数据的最佳方式是什么?
我之前没有为嵌入式系统做过太多编程,现在我必须为相对较小的东西创建一些脚本(<60MB RAM,几乎所有这些都已经被其他更关键的进程使用,处理器小于〜500MHz) 。我无法运行一直运行的东西,所以 Firebird 被淘汰了。我建议使用 sqllite,但更熟悉该平台的人告诉我,即使这样也可能会消耗太多内存和处理能力。
我将在 Perl 中对原型进行编程,并且可能需要重新编写我在 C 中创建的脚本,以便以后获得更好的性能。我希望以后重做时能够重用我创建的数据结构。到目前为止,我的大部分经验都是在 MySQL 中,所以如果语法与此类似那就太好了。有什么建议吗?
抱歉,我无法对我正在使用的平台进行更多描述。
I haven't done much programming for Embedded Systems before, and now I have to create some scripts for something relatively tiny (<60MB RAM, almost all of which is already used by other more critical processes, the processor is less ~ 500MHz). I can't run something that is on all the time, so Firebird is out. I suggested sqllite, but people more familiar with the platform have told me that even that is likely to consume too much memory and processing power.
I will be programming the prototype in Perl, and will likely need to re-write the scripts I create in c for better performance later on down the road. I'd like to be able to reuse the data structures I create when I re-do it later on. Most of my experience thus far has been in MySQL, so it would be great if the syntax was simliar to that. Any suggestions?
Sorry I can't be more descriptive about the platform I'm working on.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Berkeley DB。
Berkeley DB.
根据您的描述,我会考虑 Berkley DB 或类似的键值存储。
您还可以从 Perl 将数据序列化为 C 结构。处理这个问题的传统方法是使用
pack
,但对于更复杂的结构来说这是一个痛苦。我发现 Convert::Binary::C 是非常适合处理用于 C 结构的数据。您可以向 CBC 提供结构声明并配置它来处理编译器的字节顺序、int 大小等。您还可以提供在打包或解包值时执行的代码。例如,如果您有一个定点数的 typedef,则可以配置 CBC 将其解包为 Perl 中的浮点数,然后在打包该数字时将其转换回定点数。
我使用此工具处理内存转储并准备映像以部署到嵌入式系统,取得了巨大成功。
From what you describe I'd look at Berkley DB or a similar key value store.
You can also serialize your data to C structures from Perl. The traditional way to handle this is to use
pack
, but its a pain for more complex structures. I have found that Convert::Binary::C is great for working with data destined for C structures.You can feed CBC a struct declaration and configure it to handle your compiler's endianness, int size and so forth. You can also provide code to execute when packing or unpacking a value. For example if you have a typedef for a fixed point number, you can configure CBC to unpack it into a float in Perl, and then convert back to fixed point when the number is packed.
I have had great success using this tool to work with memory dumps and to prepare images for deployment to embedded systems.
作为建议,您可能需要考虑使用 lua 来编写脚本,它非常快,并且可以在生产系统中使用,并且很容易绑定到 c。
你需要一个关系数据库吗?
在嵌入式系统上,您经常使用简单的存储系统,例如基于文件的系统。一般来说,您想要的灵活性越高,需要的开销就越大。
等等......
也许键/值存储会给你查询和存储的最佳折衷方案。
as a suggestion, you may want to consider lua for scripting, its pretty fast, and can be used in production systems and very easy to bind to c.
do you need a relational database?
quite often on embedded systems you use a simple storage system, like a file based system. in general the more flexibility you want, the more overhead you will need.
and so on...
Perhaps a key / value store would give you the best compromise for query and storage.