实施 Keil MCB1700 评估板程序的最佳方法是什么?
我想为MCB1700评估板开发一个程序。 PC客户端软件从硬盘读取图片。 然后通过套接字(以太网)将图像发送到MCB1700评估板。 MCB1700的服务器通过Socket连接接收来自PC的图像并将其显示在LCD上。
服务器还必须执行以下任务:
- 将图片保存到 U 盘;
- 从U盘读取图片并通过socket发送给客户端;
- 发送和接收信息
- 通过 CAN COM 日志记录
- 。 Socket连接
可以借助CMSIS和RL-ARM库来实现。
但是,据我了解,在这两种情况下,软件都必须侦听传入的 TCP 连接并在无限循环中处理网络事件 - Keil 的所有示例都基于这样的原理。
我一直认为,嵌入式编程使用无限循环是一种糟糕的方法。 此外,我读到了这样有趣的说法
“当然可以在没有 RTOS 的情况下创建实时程序 (通过循环执行一个或多个任务)”
http: //www.keil.com/support/man/docs/rlarm/rlarm_ar_artxarm.htm 那么,据我了解,循环执行大量任务是正常做法?
而(1){ 任务1(); 任务2(); ... 任务N(); }
最好通过中断来处理所有事件。
是否可以使用 CMSIS 和 RL-ARM 库的套接字连接并通过处理中断来组织我的所有软件? 我的服务器(在 MCB1700 上)必须执行很多任务。我想,我应该在我的软件中使用 RTOS RTX。不是这样吗?在没有 RTX 的情况下实施我的软件是否更好?
I want to develop a program for MCB1700 evaluation board.
Client software of PC reads a picture from HDD.
Then it sends the picture to MCB1700 evaluation board through socket (Ethernet).
Server of MCB1700 receives pictures from PC through Socket-connection and displays it on LCD.
Also server must perform such tasks:
- To save picture to USB-stick;
- To read picture from USB-stick and send it to client through socket;
- To send and receive information through CAN
- COM-logging.
- etc.
Socket connection can be implemented with help of CMSIS and RL-ARM libraries.
But, as far as I understood, in both cases sofrware has to listen for incoming TCP-connection and handle network's events in an endless loop - All examples of Keil are based on such principle.
I always thought, that it is a poor way for embedded programming to use endless loops.
Moreover, I read such interesting statement
"it is certainly possible to create real-time programs without an RTOS
(by executing one or more tasks in a loop)"
http://www.keil.com/support/man/docs/rlarm/rlarm_ar_artxarm.htm
So, as I understood, it is normal practice to execute a lot of tasks in loop?while (1) {
task1();
task2();
...
taskN();
}
I think that it is better to handle all events by interrupts.
Is it possible to use socket conection of CMSIS and RL-ARM libraries and organize all my software by handling of interrupts?
My server (on MCB1700) has to perform a lot of tasks. I guess, I should use RTOS RTX in my software. Isn't it so? Is it better to implement my software without RTX?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
简单的实时系统通常在“大循环”架构中运行,其中一些时间关键事件由中断处理。它不是一个“糟糕”的架构,只是有点不灵活,扩展性差,任何变化都可能影响系统的时序和/或所有部分。
RL-TCPnet 并非必须以这种方式工作,但它被设计为独立运行,并且示例也以这种方式工作,因此不依赖于其他库以获得最广泛的适用性。它们只是示例,旨在演示 RL-TCPnet,仅此而已。从这个意义上说,这些示例并不现实,应该适应您的要求。
您可能会设计一个系统,其中所有应用程序代码都在中断处理程序中运行,而网络堆栈是线程上下文中无限循环中的服务,但从架构上来说,这可能比“大循环”架构差得多,因为您可能会结束使用很长的中断处理程序,较高优先级的中断处理程序会饥饿并影响较低优先级的实时响应。您最终会得到一个很难令人满意地安排的系统。此外,并非所有库例程都适合在中断处理程序中执行,因此它会受到相当大的限制。
可以在 RTOS 中的低优先级线程中为网络堆栈提供服务。此类操作的框架在以下部分的文档中进行了描述:使用 RL-带有 RTX 内核的 TCPnet。。这将要求您了解和使用 RL-RTX 内核库,但考虑到您对“大循环”代码的保留,以及系统必须执行的任务的描述,听起来这就是您在任何情况下都想做的事情。如果您选择使用不同的 RTOS,则 RL-TCPnet 可以以类似的方式与任何 RTOS 一起工作。
Simple real-time systems often operate in a "big-loop" architecture, with some time critical events handled by interrupts. It is not a "bad" architecture, bit it is somewhat inflexible, scales poorly, and any change may affect the timing of and or all parts of the system.
It is not true that RL-TCPnet must work this way, but it is designed to run stand alone, and the examples work that way so that there are no dependencies on other libraries for the widest applicability. They are only examples and are intended to demonstrate RL-TCPnet and nothing else. In that sense the examples are not realistic and should be adapted to your requirements.
You might devise a system where all your application code runs in interrupt handlers and the network stack is services in an endless-loop in the thread context, but architecturally that is probably far worse than the "big-loop" architecture, since you may end up with very long interrupt handlers, with the higher priority ones starving and affecting the real-time response of lower priority ones. You end up with a system that is difficult to schedule satisfactorily. Moreover not all library routines are suitable for execution in an interrupt handler, so it would be rather restrictive.
It is possible to service the network stack in a low priority thread in an RTOS. The framework for such operation is described in the documentation in the section: Using RL-TCPnet with RTX kernel.. This will require you to understand and use the RL-RTX kernel library, but given your reservations about "big loop" code, and the description of tasks your system must perform, it sounds like that is what you want to do in any case. If you choose to use a different RTOS, then RL-TCPnet can work in a similar way with any RTOS.