我正在使用 contiki-os 来模拟一些具有语义功能的微尘。由于 contiki-os (erbium) 是用 C 编写的,但我们的语义库是用 java 编写的。
如果可以在 erbium 或 contiki-os 中利用这些库,这里有人可以指导我吗?还是我必须从头开始重写所有内容?
更新
只是对问题的一个小更新。是否可以在 cooja 模拟器上使用 java 代码?
Cooja 确实是用 Java 编写的。
如果需要,您可以扩展或修改 Cooja。
您可以在 Contiki wiki以及Fredrik Österlind 的众多论文中找到更多关于 Cooja的信息。也许您还应该看看 Fredrik 的博士论文“Improving Low-Power Wireless Protocols with Timing-Accurate Simulation”,主要是关于 Cooja。
You might be able to use something like this:
http://www.codemesh.com/products/junction/
It appears to have a code generator that takes a java bytecode and create C code from it... but it might also need a runtime library that's platform specific.
With all that in mind, I don't think you will be successful. Most of the platforms are nearly out of space and/or flash by the time you are working with Erbuim; I doubt you'll have resources to process java code somehow.
And if you did get some success from this approach it would probably take a lot of time and effort to do so. With that time and effort you probably could have written the C code to do what you need instead.