将 Windows 软件移植到嵌入式/实时操作系统
我有一个针对 Windows 环境的现有代码库,着眼于未来,希望使其尽可能跨平台。 我通过使用跨平台库在标准 Linux 发行版上取得了一些成功,但希望将其扩展到实时和/或嵌入式操作系统。
是否可以将大部分代码库移植到此类系统,或者是否需要针对该环境进行重新实现? 如果需要重新创建零件,这些系统的开发是否需要不同类型的设计方法? 一些供应商提供自己的 IDE 进行开发,这些是必需的吗?或者我们可以或有可能对 GNU 工具链类型构建过程进行标准化吗?
潜在的问题可能是 IPC 处理方面的差异,但如果不进一步了解,很难掌握具体细节。
注意,虽然目前基于 Windows,但并没有特别大量使用 Win32 API(主要是 COM)或 Windows 类型。
谢谢
编辑:: 代码库是 C\C++
I have an existing codebase targeting a Windows environment and with an eye to the future, would like to make this as cross platform as possible.
I've had some sucess with standard Linux distributions by using cross platform libraries but would like to extend this to Realtime and or embedded operating systems.
Would it be possible to port the majority of the codebase to such systems, or would it require reimplentations targeted to that environment? If parts need to be recreated, does development for these systems require a different type of design approach? Some vendors supply their own IDE's for development, are these a necessity or can we or is it possible to standardise on a GNU toolchain type build process?
A potential pothole could be differences in IPC handling but without further exposure it is difficult to get a handle on the specifics.
NB although Windows based presently, there is not particularly heavy use of the Win32 API (mainly COM) or Windows types.
Thanks
edit:: the codebase is C\C++
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
如果您使用的是 Windows COM 接口(我假设您在这里讨论的不是串行端口,而是通用对象模型),您的代码可能需要从中抽象出来。
当您谈论 IPC 时,显然这是一个多任务/多处理类型的代码库。 既然如此,你就必须想出一个办法来应对环境差异。
首先,您将需要某种 RTOS,因为您的应用程序是多任务的。 当您移植到 Linux 时,您可能想考虑使用实时 Linux 版本。 这将最大限度地减少您必须执行的端口数量。
如果您不想使用 Linux 作为嵌入式平台,请使您的代码符合 POSIX 标准(Linux 是),并确保您选择的 RTOS 支持 POSIX。 这样,Linux 和嵌入式平台的移植将基本相同。
最重要的是,COM 将成为您的负担。
由于您没有提到 GUI 的使用,我们不会解决那个蠕虫问题:)
If you are using the windows COM interface (I assume you're not talking about serial port here, but the Common Object Model), your code might need to be abstracted away from that.
As you talk about IPC, then obviously this is a multi-tasking/multi-processing type code base. With that being the case, you will have to somehow come up with a way to deal with the environment difference.
First of all, you will need some kind of RTOS since your application is multi-tasking. As you did a port to Linux, you might want to look into using a version of real-time Linux. This would minimize the number of ports you would have to do.
If you don't want to use Linux as your embedded platform, make your code POSIX compliant (Linux is) and make sure that the RTOS you choose support POSIX. This way, the port to Linux and the embedded platform would be mostly the same.
Bottom line, COM will be your albatros.
Since you don't mention the use of a GUI, we won't address that can of worms :)
最重要的一步是将所有操作系统依赖功能与项目逻辑分离。
完成此操作后,您将立即看到需要移植多少代码才能迁移到新操作系统,并且您将能够顺利开始移植。
The most important step is to separate all OS dependence functions from the project logic.
After you do that, you will see immediately how much code you have to port for migration to new OS, and you will be able to start porting nicely.
如果应用程序主要是 C 和 posix 那么它并不太难。
如今的嵌入式平台可能意味着在紧凑型闪存卡上运行的 XP 或 Linux 的几乎完整副本。
对于 GUI,QT 和 WX 都有嵌入式版本,可以直接绘制小部件。
If the app is mostly C and posix then it isn't too hard.
Embedded platforms today can mean an almost full copy of XP or Linux running on a compact flash card.
For the gui both QT and WX have embedded versions which draw the widgets directly.
我不喜欢在 Windows 上使用 GNU 开发工具,因为 MS Dev Studio 比任何 GNU 工具都要好得多,但最近我一直在使用 Wascana Desktop Developer,它基于 Eclipse 和 GCC,并且显示出前景。
I don't like using GNU dev tools on Windows since MS Dev Studio is sooo much nicer than any GNU tools but recently I've been playing with Wascana Desktop Developer which is based on Eclipse and GCC and it shows promise.
取决于您的嵌入式平台的功能。 如果是 8 位,前面的路会很艰难,但如果是 32 位且具有足够的 RAM 等,则有很多开源跨平台库可用。
我在最后一个嵌入式 GUI 应用程序中使用了 DirectFB,它是轻量级的,还可以,但不是跨平台的。 下次我想我会尝试wxWidgets。
Depends on the capabilities of your embedded platform. If it's an 8-bit, you've got a hard road ahead but if it's 32 bit with decent RAM and such, there are a lot of open source cross-platform libraries available.
I used DirectFB for my last embedded GUI app, it was lightweight and OK but not cross-platform. Next time I think I'll try out wxWidgets.
如果您需要指定使用哪种实时/嵌入式操作系统,您是否考虑过 Windows CE?
If you're in the position of specifying which realtime/embedded OS you use, have you considered Windows CE?