[英]What's the best way to organize data on my embedded system?
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). 我以前没有为嵌入式系统做过很多编程,现在我必须为相对较小的东西创建一些脚本(<60MB RAM,其他几乎所有这些都已被其他更关键的进程使用,处理器不到~500MHz)。 I can't run something that is on all the time, so Firebird is out.
我不能一直运行一些东西,所以Firebird已经出局了。 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.
我建议sqllite,但更熟悉该平台的人告诉我,即使这样也可能消耗太多的内存和处理能力。
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. 我将在Perl中编写原型,并且可能需要重新编写我在c中创建的脚本,以便以后获得更好的性能。 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.
到目前为止,我的大部分经验都是在MySQL中,所以如果语法与此类似,那将会很棒。 Any suggestions?
有什么建议么?
Sorry I can't be more descriptive about the platform I'm working on. 对不起,我无法更好地描述我正在处理的平台。
伯克利DB 。
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. 作为一个建议,你可能想要考虑lua脚本,它非常快,并且可以在生产系统中使用,并且很容易绑定到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. 也许键/值存储可以为您提供查询和存储的最佳折衷方案。
From what you describe I'd look at Berkley DB or a similar key value store. 根据您的描述,我会看看Berkley DB或类似的键值商店。
You can also serialize your data to C structures from Perl. 您还可以将数据序列化为Perl中的C结构。 The traditional way to handle this is to use
pack
, but its a pain for more complex structures. 处理这个问题的传统方法是使用
pack
,但它对于更复杂的结构来说是一种痛苦。 I have found that Convert::Binary::C is great for working with data destined for C structures. 我发现Convert :: Binary :: C非常适合处理目的地为C结构的数据。
You can feed CBC a struct declaration and configure it to handle your compiler's endianness, int size and so forth. 您可以为CBC提供结构声明并将其配置为处理编译器的字节顺序,int大小等。 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.
例如,如果您有一个固定点数的typedef,您可以配置CBC将其解压缩到Perl中的浮点数,然后在打包数时转换回固定点。
I have had great success using this tool to work with memory dumps and to prepare images for deployment to embedded systems. 我使用此工具处理内存转储以及准备部署到嵌入式系统的映像方面取得了巨大成功。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.