目录

What is a Real-Time Kernel?

Evaluation Boards

Micrium’s µC/Probe

Texas Instruments’ EVALBOT

Summary


This article describes how you can get started with learning about the internals of real-time kernels using a commercial grade kernel, running on actual hardware and using professional grade tools, all for next to nothing.

本文介绍了如何使用商业级内核,在实际硬件上运行以及使用专业级工具来学习实时内核的内部知识,而这一切几乎没有。

What is a Real-Time Kernel?


A real-time kernel is software that manages the time of a CPU (Central Processing Unit) or MPU (Micro Processing Unit) as efficiently as possible. Most kernels are written in C and require a small portion of code written in assembly language in order to adapt the kernel to different CPU architectures.

A kernel provides many useful services to a programmer such as multitasking, interrupt management, inter-task communication and signaling, resource management, time management, memory partition management and more. Most kernels used for embedded systems are ‘preemptive’ meaning that the kernel always executes the most important task that is ready to run. Preemptive kernels are also event driven which basically means that tasks are designed to wait for events to occur in order to execute. For example, a task could wait for a packet to be received on an Ethernet controller, another task could wait for a timer to expire, yet another task can wait for a character to be received on a UART, etc. When the event occurs, the task executes and performs its function. If the event that the task is waiting for doesn’t occur, the kernel runs other tasks. Waiting task consume zero CPU time. Kernels allow you to avoid polling loops which is a bad use of the CPU’s time.

实时内核是一种软件,它可以尽可能高效地管理CPU(中央处理单元)或MPU(微处理单元)的时间。大多数内核都是用C编写的,并且需要一小部分用汇编语言编写的代码才能使内核适应不同的CPU架构。

内核为程序员提供了许多有用的服务,例如多任务处理,中断管理,任务间通信和信令,资源管理,时间管理,内存分区管理等等。嵌入式系统中使用的大多数内核都是“抢先式”的,这意味着内核总是执行准备运行的最重要的任务。抢占式内核也是事件驱动的,这基本上意味着任务被设计为等待事件发生才能执行。例如,一个任务可以等待在以太网控制器上接收到数据包,另一个任务可以等待计时器到期,而另一个任务可以等待在UART上接收字符,等等。当事件发生时,任务执行并执行其功能。如果没有发生任务正在等待的事件,则内核将运行其他任务。等待的任务消耗零的CPU时间。内核使您可以避免轮询循环,这会浪费CPU时间。

Real-time kernels are not limited to high end 32-bit CPUs and in fact, a kernel like Micrium’s µC/OS-III can run comfortably on many 8 and 16-bit CPUs or even DSP (Digital Signal Processing) chips.

Many embedded programmers shy away from using a kernel because they fear that kernels add too much complexity to their application. It turns out that you only need a handful of services to get your project off the ground with a kernel. For example, with µC/OS-III, you can write fairly complex multitasking application with as little as five (5) API functions out of the nearly 70 API calls offered by µC/OS-III.

实时内核不仅限于高端32位CPU,实际上,像Micrium的µC / OS-III这样的内核可以在许多8位和16位CPU甚至DSP(数字信号处理)芯片上轻松运行。

许多嵌入式程序员回避使用内核,因为他们担心内核会给应用程序增加太多的复杂性。事实证明,您只需要少量服务即可使用内核启动您的项目。例如,使用µC / OS-III,您可以使用µC / OS-III提供的近70个API调用中的五(5)个API函数编写相当复杂的多任务应用程序。

Years ago, embedded systems used to be designed by first selecting the microprocessor or microcontroller, then the tools (compiler, assembler, linker and debugger) and finally, you’d figure out how to write the software. Nowadays, many embedded systems are designed by starting with the software requirements and in fact, determining what software components you can purchase off-the-shelf to satisfy your needs. A real-time kernel is one such component and in fact, is generally the first software component you’ll need to select because it establishes the framework upon which you can build your product. Having a kernel allows you to easily add other software components such as a TCP/IP stack, a USB stack (host or device), a file system, a graphical user interface (or GUI) and more. Some of these software components are easy to use but are quite complex to develop. For example, a TCP/IP stack can consist of well over 100,000 lines of C code but, from the application’s programmer’s point of view, you only need to understand and use about 30 or so API functions. In other words, far easier to use that to create.

多年以前,嵌入式系统的设计首先是选择微处理器或微控制器,然后选择工具(编译器,汇编器,链接器和调试器),最后选择如何编写软件。如今,许多嵌入式系统的设计都是从软件需求入手,实际上是确定可以购买现成的软件组件来满足您的需求。实时内核就是这样一个组件,实际上,它通常是您需要选择的第一个软件组件,因为它建立了可用来构建产品的框架。有了内核,您可以轻松添加其他软件组件,例如TCP / IP堆栈,USB堆栈(主机或设备),文件系统,图形用户界面(或GUI)等。这些软件组件中的某些易于使用,但开发却相当复杂。例如,一个TCP / IP堆栈可以包含100,000行以上的C代码,但是从应用程序程序员的角度来看,您只需要了解和使用大约30个左右的API函数即可。换句话说,使用它来创建要容易得多。

The internals of the µC/OS-III real-time kernel are described in a book I wrote called: µC/OS-III, The Real-Time Kernel. There are in fact six different versions of this book, each featuring a different CPU architecture. Each of these books is available as a free PDF download from the Micrium website.

I personally prefer an actual book so, if you are like me, you can purchase the hardcover book either from Micrium, one of our authorized distributors or Amazon.com.

µC/OS-III is ‘Source Available’ meaning that you can download the FULL source code for µC/OS-III and use it for FREE as long as it’s for educational use or for peaceful research. However, you need to purchase a license (i.e. the rights to use µC/OS-III) if you intend to use µC/OS-III in commercial products or applications.

我写的一本书《 µC / OS-III,实时内核》中介绍了µC / OS-III实时内核的内部结构。实际上,本书有六个不同的版本,每个版本具有不同的CPU架构。这些书中的每本书都可以从Micrium网站免费下载PDF 。

我个人更喜欢一本实际的书,因此,如果您像我一样,可以从我们的授权发行商之一Micrium或Amazon.com购买精装书。

µC / OS-III是“可用的源”,这意味着您可以下载µC / OS-III的完整源代码,并免费使用,只要用于教育或和平研究即可。但是,如果您打算在商业产品或应用中使用µC / OS-III,则需要购买许可证(即使用µC / OS-III的权利)。

Evaluation Boards


An evaluation board is available with each book, allowing the reader to not only learn about what real-time kernels are and how they work but also be able to perform actual experiments on actual hardware.

In order to run the examples provided with each book, you will need to download the code corresponding with the book you are interested in (that depends on what CPU manufacturer or CPU architecture you prefer). The companion projects for each book are available as free downloads from the same web page as shown above.

Finally, each book requires ‘tools’ to allow you to compile and download the example code. The tools that you will need depend on which book and board you get. Evaluation versions of tools can be downloaded for free and links to those are provided in each book. In all cases, you will have to register in order to be able to download these tools.

每本书都有一个评估板,读者不仅可以了解实时内核及其工作原理,还可以在实际硬件上进行实际实验。

为了运行每本书提供的示例,您需要下载与您感兴趣的书相对应的代码(取决于您喜欢的CPU制造商或CPU体系结构)。如上所示,可以从同一网页免费下载每本书的配套项目。

最后,每本书都需要“工具”来允许您编译和下载示例代码。您将需要的工具取决于您所获得的书和纸板。可以免费下载工具的评估版,每本书中都提供了这些工具的链接。在所有情况下,您都必须注册才能下载这些工具。

Micrium’s µC/Probe


All of the examples provided with each book make use of a cool tool called µC/Probe which is available from Micrium. Again, a free evaluation version of µC/Probe can be downloaded from the same Micrium web page as previously described.

µC/Probe is an award-winning Microsoft Windows™-based application that allows a user to display or change the value (at run time) of virtually any variable or memory location on a connected embedded target. The user simply populates µC/Probe’s graphical environment with gauges, numeric indicators, tables, graphs, virtual LEDs, bar graphs, sliders, switches, push buttons, and other components, and associates each of these to a variable or memory location.

With µC/Probe, it is not necessary to instrument the target code in order to display or change variables at run time. In fact, there is no need to add printf() statements, hardware such as Light Emitting Diodes (LEDs), Liquid Crystal Displays (LCDs), or use any other means to get visibility inside an embedded target at run time.

µC/Probe obtains the values from the target either through a J-Tag interface (Segger J-Link), an RS-232C port or an Ethernet port using TCP/IP. For the latter, a TCP/IP stack such as Micrium’s µC/TCP-IP is necessary. The free version of µC/Probe allows you to display or change up to eight application variables. However, it allows you to monitor any µC/OS-III variable since µC/Probe is ‘µC/OS-III Kernel Aware’. Figure 1 shows an example screenshot of µC/OS-III running on the Texas Instruments EVALBOT. The code for this example is provided in the corresponding book.

每本书提供的所有示例均使用一个名为µC / Probe的凉爽工具,可以从Micrium购买。同样,可以从相同的Micrium网页上下载µC / Probe的免费评估版,如前所述。

µC / Probe是屡获殊荣的基于Microsoft Windows™的应用程序,它使用户可以在运行时显示或更改连接的嵌入式目标上几乎任何变量或内存位置的值(在运行时)。用户只需将仪表,数字指示器,表格,图形,虚拟LED,条形图,滑块,开关,按钮和其他组件填充到µC / Probe的图形环境中,然后将它们分别与变量或存储位置关联即可。

使用µC / Probe,无需插装目标代码即可在运行时显示或更改变量。实际上,无需在运行时添加printf()语句,诸如发光二极管(LED),液晶显示器(LCD)之类的硬件,也无需使用任何其他方法来获得嵌入式目标内部的可见性。

µC / Probe通过J-Tag接口(Segger J-Link),RS-232C端口或使用TCP / IP的以太网端口从目标获取值。对于后者,必须使用TCP / IP堆栈,例如Micrium的µC / TCP-IP。µC / Probe的免费版本允许您显示或更改最多八个应用程序变量。但是,由于µC / Probe是“ µC / OS-III内核感知”,它允许您监视任何µC / OS-III变量。图1显示了在德州仪器EVALBOT上运行的µC / OS-III的屏幕截图示例。该示例的代码在相应的书中提供。

Texas Instruments’ EVALBOT


One of the coolest evaluation boards available with a µC/OS-III book is the Texas Instruments EVALBOT which is shown in Figure 2. The EVALBOT is a small robotic device that features a board with a Stellaris® LM3S9B92 microcontroller with Ethernet, USB OTG (On-The-Go), and I2S. The kit contains wheels that are easy to attach to the board, a display, batteries, a USB cable, and a CD with the IAR tools, the StellarisWare® software, and all the necessary documentation. A block diagram of the electronics found on this board is shown in Figure 3.

The EVALBOT comes as a kit where you assemble all the mechanical components with all the electronics already pre-assembled. You can purchase this kit from Texas Instruments’ online web store or a TI authorized distributor.

It takes about one hour to put together an EVALBOT. The examples provided in the µC/OS-III book will allow you to display text onto the small OLED display, control the LEDs, the motor driving each wheel, reading ‘bumper’ sensors so you can run the EVALBOT in autonomous mode and have it change its course as it hits objects.

µC / OS-III书中可用的最酷的评估板之一是德州仪器(TI)的EVALBOT,如图2所示。EVALBOT是一种小型机器人设备,其电路板带有带以太网的Stellaris®LM3S9B92微控制器,USB OTG( On-The-Go)和I2S。该套件包含易于安装到板上的轮子,显示器,电池,USB电缆和带有IAR工具,StellarisWare®软件以及所有必要文档的CD。图3显示了该板上的电子设备的框图。

EVALBOT作为套件提供,在其中您可以组装所有已预先组装好的所有电子部件的机械部件。您可以从德州仪器(TI)的在线网上商店或TI授权的经销商处购买此套件。

组装一个EVALBOT大约需要一个小时。µC / OS-III书中提供的示例将使您可以在小型OLED显示屏上显示文本,控制LED,驱动每个车轮的电动机,读取“保险杠”传感器,以便您可以在自动模式下运行EVALBOT撞击物体时改变其路线。

Summary


A real-time kernel is an increasingly useful software component that allows you to efficiently use the resources of a microprocessor or microcontroller, and create a framework upon which you can build simple or complex applications or products. You can download any or all of six µC/OS-III books in PDF format for FREE. These books describe what a real-time kernel is, what you can do with a real-time kernel and, provides plenty of examples that you can actually try using one of the companion evaluation boards. The source code for µC/OS-III is also available as a FREE download from the Micrium website. If you are an embedded software developer and you are new to real-time kernels then, you will find that a kernel is a useful tool to add to your toolbox. ■

实时内核是一种越来越有用的软件组件,它使您可以有效地使用微处理器或微控制器的资源,并创建一个可以在其上构建简单或复杂的应用程序或产品的框架。您可以免费下载PDF格式的六本µC / OS-III书籍中的任何一本或全部。这些书描述了实时内核是什么,实时内核可以做什么,并提供了大量示例,您可以实际使用其中一个评估板进行尝试。µC / OS-III的源代码也可以从Micrium网站免费下载。如果您是嵌入式软件开发人员,并且不熟悉实时内核,那么您会发现内核是添加到工具箱中的有用工具。■

Introduction to Real-Time Kernels相关推荐

  1. keras bi-lstm_LSTM用于文本生成的应用介绍-使用Keras和启用GPU的Kaggle Kernels

    keras bi-lstm by Megan Risdal 梅根·里斯达尔(Megan Risdal) LSTM用于文本生成的应用介绍-使用Keras和启用GPU的Kaggle Kernels (An ...

  2. 带你走进Kaggle Kernels(内附视频讲解)

    更为详细内容,请查看文末视频链接. 在这一集的AI奇遇记中,我们的任务是介绍Kaggle Kernels是什么,以及如何开始使用它们. Kaggle是一个用来研究和共享数据科学的平台,你可能听说过Ka ...

  3. 李菲菲课程笔记:Deep Learning for Computer Vision – Introduction to Convolution Neural Networks

    转载自:http://www.analyticsvidhya.com/blog/2016/04/deep-learning-computer-vision-introduction-convoluti ...

  4. CUDA系列学习(一)An Introduction to GPU and CUDA

    本文从软硬件层面讲一下CUDA的结构,应用,逻辑和接口.分为以下章节: (一).GPU与CPU (二).CUDA硬件层面 (三).CUDA安装 (四).CUDA 结构与接口 4.1 Kernels 4 ...

  5. 【论文阅读】A Gentle Introduction to Graph Neural Networks [图神经网络入门](6)

    [论文阅读]A Gentle Introduction to Graph Neural Networks [图神经网络入门](6) GNN playground Some empirical GNN ...

  6. 学习笔记:Adaptive Convolutional Kernels

    学习笔记:Adaptive Convolutional Kernels Abstract 背景: 随着图像识别的发展,我们发展的卷积神经网络已经像复杂化和深度化发展.为了减少计算复杂网络的资源要求,我 ...

  7. 可变形卷积系列(三) Deformable Kernels,创意满满的可变形卷积核 | ICLR 2020

    论文提出可变形卷积核(DK)来自适应有效感受域,每次进行卷积操作时都从原卷积中采样出新卷积,是一种新颖的可变形卷积的形式,从实验来看,是之前方法的一种有力的补充.   来源:晓飞的算法工程笔记 公众号 ...

  8. 3D Instances as 1D Kernels

    Abstract 我们引入了一种3D实例表示,称为实例内核,其中实例由一维向量表示,这些向量对3D实例的语义.位置和形状信息进行编码.我们表明,实例内核通过简单地扫描整个内核来实现简单的mask推断场 ...

  9. 支持向量机论文翻译——使用不匹配字符串核函数的支持向量机进行蛋白质分类 Mismatch String Kernels for SVM Protein Classification

    免费查看该论文的链接:Mismatch String Kernels for SVM Protein Classification 摘要: 我们介绍了一种字符串核函数(注:支持向量机SVM中数据升维使 ...

最新文章

  1. SURF算法与源码分析、下
  2. Scalaz(25)- Monad: Monad Transformer-叠加Monad效果
  3. python程序开发模块化_python-17-Python文件两种用途、模块化程序开发
  4. MacOS 常用命令汇总
  5. android7.0提示定位,解决android7.0上某些PopuWindow显示位置不正确的问题
  6. Linux系统下MySQL导出数据库和导入数据库的命令
  7. Java定义变量x初始值为3,JAVA 第一章
  8. 连通子图什么意思_一道物理竞赛题揭开“希罗喷泉”的神秘面纱,到底什么物理原理?...
  9. SSRF 漏洞危害大,应避免被利用攻击内网应用!| 原力计划
  10. DNS配置,主从,子域,转发
  11. 单例模式中为什么用枚举更好
  12. floyd算法求最短路径_算法题-蜜蜂采蜜最短路径
  13. Android 求职简历
  14. Python实现商场管理系统
  15. PCB多层板设计总结-层的分布设置
  16. Java实现蓝桥杯VIP算法训练 预测身高
  17. 进展:Pegasus的自动化编译测试
  18. Spring学习总结01--Spring了解,IOC,DI
  19. 杭州电子科技大学程序设计竞赛(2016’12)- 网络同步赛 1004
  20. 右键新建选项里面没有新建文件夹--win10

热门文章

  1. Java 学习多态笔记
  2. 仿百度,豆瓣读书文库阅读器
  3. c语言双链表从右向左遍历,有没有大佬在的,我这双向链表怎么没办法遍历
  4. E: Sub-process /usr/bin/dpkg returned an error code (1) Ubuntu安装apt-get命令报错
  5. docker-compose安装镜像
  6. Wireshark验证TCP三次握手四次挥手
  7. [JAVA基础]你知道Java的四种引用类型吗
  8. 面试中经常会被问到的70个问题
  9. jQuery 的上传图片预览插件
  10. 给GridView分页