开发非x86操作系统

时间:2021-09-30 12:52:44

I have to choose a thesis topic soon and I was considering implementing an operating system for an architecture that is not x86 (I'm leaning towards ARM or AVR). The reason I am avoiding x86 is because I would like to gain some experience with embedded platforms and I (possibly incorrectly) believe that the task may be easier when carried out on a smaller scale. Does anyone have any pointers to websites or resources where there are some examples of this. I have read through most if not all of the OSDev questions on stack overflow, and I am also aware of AvrFreaks and OSDev. Additionally if anyone has had experience in this area and wanted to offer some advice in regards to approach or platform it would be much appreciated.

我必须尽快选择论文主题,并且我正在考虑为不是x86的架构实现操作系统(我倾向于ARM或AVR)。我避免使用x86的原因是因为我希望获得一些嵌入式平台的经验,而且我(可能不正确)认为在较小规模上执行任务可能会更容易。有没有人有任何指向网站或资源的指针,其中有一些例子。我已经阅读了大多数(如果不是全部)关于堆栈溢出的OSDev问题,我也了解AvrFreaks和OSDev。此外,如果任何人有这方面的经验,并希望提供有关方法或平台的一些建议,将非常感谢。

Thanks

10 个解决方案

#1


7  

Developing an (RT)OS is not a trivial task. It is very educational though. My advice to you is to start hardware independent. PC is a good starting point as it comes with plenty of I/O possibilities and good debugging. If you create a kind-of-virtual machine application, you can create something with simple platform capabilities (console output, some buttons/indicators are a good start). Also, you can use files for instance, to output timing (schedules) If you start on 'bare metal' you'll have to start from scratch. Debugging on a LED (on/off/blinking) is very hard and time consuming. My second advice is to define your scope early: is it the scheduler, the communication mechanisms or the file systems you're interested at... ? Doing all can easily end up in a life long project.

开发(RT)OS并非易事。虽然这很有教育意义。我给你的建议是独立启动硬件。 PC是一个很好的起点,因为它具有大量的I / O可能性和良好的调试。如果您创建了一种虚拟机应用程序,您可以创建具有简单平台功能的东西(控制台输出,一些按钮/指示器是一个良好的开端)。此外,您可以使用文件,例如,输出时间(日程安排)如果您从'裸机'开始,您将不得不从头开始。在LED上进行调试(开/关/闪烁)非常困难且耗时。我的第二个建议是尽早定义你的范围:它是调度程序,通信机制还是你感兴趣的文件系统......?做所有事情很容易就会结束一生。

Samek, Miro, Practical UML Statecharts in C/C++ contains some interesting sections on a microkernel. It's one of my favorite books. Advanced PIC Microcontroller Projects in C: From USB to RTOS with the PIC 18F Series seems to cover some of your interests; I haven't read it yet though. Operating Systems: Internals and Design Principles may also bring good insights. It covers all aspects from scheduler to network stack. Good luck!

Samek,Miro,C / C ++中的实用UML状态图包含一些关于微内核的有趣部分。这是我最喜欢的书之一。 C语言中的高级PIC单片机项目:使用PIC 18F系列从USB到RTOS似乎涵盖了您的一些兴趣;我还没读过。操作系统:内部和设计原则也可能带来很好的见解。它涵盖了从调度程序到网络堆栈的所有方面。祝好运!

#2


4  

Seems like you should get a copy of Jean Labrosse's book MicroC/OS.

好像你应该得到Jean Labrosse的书MicroC / OS的副本。

It looks like he may have just updated it too.

看起来他可能刚刚更新了它。

http://micrium.com/page/press_room/news/id:40

http://micrium.com/page/home

This is a well documented book describing the inner workings of an RTOS written in C and ported to many embedded processors. You could also run it on a x86, and then cross compile to another processor.

这是一本记录完备的书,描述了用C语言编写并移植到许多嵌入式处理器的RTOS的内部工作方式。您也可以在x86上运行它,然后交叉编译到另一个处理器。

#3


2  

Contiki might be a good thing to research. It's very small, runs on microcontrollers, and is open source. It has a heavy bias towards networking and communications, but perhaps you can skip those parts and focus on the kernel.

Contiki可能是研究的好东西。它非常小,可在微控制器上运行,并且是开源的。它对网络和通信有很大的偏见,但也许你可以跳过这些部分并专注于内核。

#4


2  

If you choose ARM, pick up a copy of the ARM System Developer's Guide (Sloss, Symes, Wright). Link to Amazon

如果选择ARM,请选择ARM System Developer's Guide(Sloss,Symes,Wright)的副本。链接到亚马逊

Chapter 11 discusses the implementation of a simple embedded operating system, with great explanations and sample code.

第11章讨论了简单嵌入式操作系统的实现,并提供了很好的解释和示例代码。

#5


2  

ARM and AVR are chalk and cheese - you've scoped this very wide!

ARM和AVR都是粉笔和奶酪 - 你的范围非常宽!

You could produce a very different and more sophisticated OS for ARM than AVR (unless you are talking about AVR32 perhaps - which is a completely different architecture?).

您可以为ARM生成一个非常不同且更复杂的ARM操作系统(除非您在谈论AVR32,这可能是一个完全不同的架构?)。

AVR would be far more constraining to the point that the task may be just to trivial for the scope of your thesis. Even specifying ARM does not narrow it down much; low-end ARM parts have small on-chip memories, no MMU and simple peripherals; higher end parts have an MMU, data/instruction caches, often a GPU, sometimes an FPU, hardware Java bytecode execution, and many other complex peripherals. The term 'ARM' covers ARM7, ARM9, ARM11, Cortex M3, Cortex M8, plus a number of architectures intended for use on ASICs and FPGAs - so you need to narrow it down a bit perhaps?

AVR将更加局限于这个任务可能只是为了论文的范围而微不足道。即使指定ARM也不会缩小范围;低端ARM器件具有小型片上存储器,无MMU和简单的外设;高端部件具有MMU,数据/指令缓存,通常是GPU,有时是FPU,硬件Java字节码执行以及许多其他复杂外设。术语“ARM”涵盖ARM7,ARM9,ARM11,Cortex M3,Cortex M8,以及许多旨在用于ASIC和FPGA的架构 - 因此您需要缩小它的范围吗?

If you choose ARM, take a look at these resources. Especially the Insider's Guides from Hitex, and the "Building bare-metal ARM with GNU", they will help you get your board 'up' and form starting point for your OS.

如果选择ARM,请查看这些资源。特别是来自Hitex的Insider's Guides,以及“使用GNU构建裸机ARM”,它们将帮助您“升级”并成为操作系统的起点。

#6


2  

Silly as it may sound, I was recently interested in the Arduino platform to learn some hacking tricks with the help of more experienced friends. There was also this thread for a guy interested in writing an OS for it (although not his primary intention).

听起来很傻,我最近对Arduino平台感兴趣,在更有经验的朋友的帮助下学习一些黑客技巧。对于一个有兴趣为它编写操作系统的人来说,也有这个帖子(尽管不是他的主要目的)。

I think the Arduino is very basic and straightforward as an educational tool for such endeavors. It may worth the try checking it out if it fits the bill.

我认为Arduino作为这种努力的教育工具是非常基本和直接的。如果适合账单,可能值得一试。

#7


1  

alt text http://ecx.images-amazon.com/images/I/3125C47MR4L._SL500_AA180_.jpghttp://www.amazon.com/Operating-Systems-Design-Implementation-3rd/dp/0131429388

替代文字http://ecx.images-amazon.com/images/I/3125C47MR4L._SL500_AA180_.jpghttp://www.amazon.com/Operating-Systems-Design-Implementation-3rd/dp/0131429388

Pretty solid stuff.

相当坚实的东西。

#8


1  

The first thing I recommend is to narrow your thesis topic considerably. OSs are ubiquitous, well researched and developed. What novel idea do you hope to pursue?

我建议的第一件事就是大大缩小你的论文题目。操作系统无处不在,经过深入研究和开发。你希望追求什么新颖的想法?

That said, the AvrX is a very small microkernel that I've used professionally on AVR microcontrollers. It is written in assembly. One person started to port it to C, but hasn't finished the port. Either finalizing the port to C and/or making a C port to the AVR32 architecture would be valuable.

也就是说,AvrX是一个非常小的微内核,我专门用于AVR微控制器。它是用汇编语言编写的。一个人开始将它移植到C,但还没有完成端口。将端口最终确定为C和/或将C端口设置为AVR32架构将是有价值的。

#9


1  

An OS shall not be tightly coupled to any processor so ARM or x86 doesn't matter. It will be a bigger topic, if we start discussing if ARM is embedded and x86 is not. Anyway, there are many many places in which x86 processors are used for embedded software development.

操作系统不应与任何处理器紧密耦合,因此ARM或x86无关紧要。如果我们开始讨论是否嵌入了ARM而x86不是嵌入式,那将是一个更大的话题。无论如何,有许多地方使用x86处理器进行嵌入式软件开发。

I guess most of the kernel code will be just plain C lanugage. There are many free OS that are already available, like for example, embedded linux, Free version of Itron, minix, etc ... It will be a daunting task.

我猜大多数内核代码都只是普通的C语言。有许多已经可用的免费操作系统,例如嵌入式Linux,免费版Itron,minix等......这将是一项艰巨的任务。

But on the other hand, what you can try is, port embedded linux to platforms in which it is not yet working. This will be really useful to the world.

但另一方面,您可以尝试将嵌入式Linux移植到尚未运行的平台。这对世界非常有用。

#10


1  

An RTOS is almost never architecture specific. Refer to any RTOS architecture available on the net and you will notice that a CPU/Hardware abstraction layer abstracts out the CPU. The board specific portions (that deal with peripherals such as com ports, timers etc.) are abstracted by a board support package.

RTOS几乎从不是特定于体系结构的。请参阅网络上提供的任何RTOS体系结构,您会注意到CPU /硬件抽象层将CPU抽象出来。电路板特定部分(处理外围设备,如com端口,定时器等)由电路板支持包抽象。

To begin with, get an understanding of how multi-threading works in a RTOS try implementing a simple context switch code for the CPU of your choice; this will involve code for creating a thread context, saving a context and restoring a saved context. This code will form the basis of your hardware abstraction layer. The initial development can easily be accomplished using a software simulator for the selected CPU.

首先,了解多线程如何在RTOS中工作,尝试为您选择的CPU实现简单的上下文切换代码;这将涉及用于创建线程上下文,保存上下文和恢复已保存上下文的代码。此代码将构成硬件抽象层的基础。使用所选CPU的软件模拟器可以轻松完成初始开发。

I agree with the poster who suggested reading the book, uCOS-II by Jean Labrosse. Samples of context switch code, especially for x86, should be just a google search away!

我赞同海报建议阅读Jean Labrosse的书,即uCOS-II。上下文切换代码的​​示例,特别是对于x86,应该只是谷歌搜索!

#1


7  

Developing an (RT)OS is not a trivial task. It is very educational though. My advice to you is to start hardware independent. PC is a good starting point as it comes with plenty of I/O possibilities and good debugging. If you create a kind-of-virtual machine application, you can create something with simple platform capabilities (console output, some buttons/indicators are a good start). Also, you can use files for instance, to output timing (schedules) If you start on 'bare metal' you'll have to start from scratch. Debugging on a LED (on/off/blinking) is very hard and time consuming. My second advice is to define your scope early: is it the scheduler, the communication mechanisms or the file systems you're interested at... ? Doing all can easily end up in a life long project.

开发(RT)OS并非易事。虽然这很有教育意义。我给你的建议是独立启动硬件。 PC是一个很好的起点,因为它具有大量的I / O可能性和良好的调试。如果您创建了一种虚拟机应用程序,您可以创建具有简单平台功能的东西(控制台输出,一些按钮/指示器是一个良好的开端)。此外,您可以使用文件,例如,输出时间(日程安排)如果您从'裸机'开始,您将不得不从头开始。在LED上进行调试(开/关/闪烁)非常困难且耗时。我的第二个建议是尽早定义你的范围:它是调度程序,通信机制还是你感兴趣的文件系统......?做所有事情很容易就会结束一生。

Samek, Miro, Practical UML Statecharts in C/C++ contains some interesting sections on a microkernel. It's one of my favorite books. Advanced PIC Microcontroller Projects in C: From USB to RTOS with the PIC 18F Series seems to cover some of your interests; I haven't read it yet though. Operating Systems: Internals and Design Principles may also bring good insights. It covers all aspects from scheduler to network stack. Good luck!

Samek,Miro,C / C ++中的实用UML状态图包含一些关于微内核的有趣部分。这是我最喜欢的书之一。 C语言中的高级PIC单片机项目:使用PIC 18F系列从USB到RTOS似乎涵盖了您的一些兴趣;我还没读过。操作系统:内部和设计原则也可能带来很好的见解。它涵盖了从调度程序到网络堆栈的所有方面。祝好运!

#2


4  

Seems like you should get a copy of Jean Labrosse's book MicroC/OS.

好像你应该得到Jean Labrosse的书MicroC / OS的副本。

It looks like he may have just updated it too.

看起来他可能刚刚更新了它。

http://micrium.com/page/press_room/news/id:40

http://micrium.com/page/home

This is a well documented book describing the inner workings of an RTOS written in C and ported to many embedded processors. You could also run it on a x86, and then cross compile to another processor.

这是一本记录完备的书,描述了用C语言编写并移植到许多嵌入式处理器的RTOS的内部工作方式。您也可以在x86上运行它,然后交叉编译到另一个处理器。

#3


2  

Contiki might be a good thing to research. It's very small, runs on microcontrollers, and is open source. It has a heavy bias towards networking and communications, but perhaps you can skip those parts and focus on the kernel.

Contiki可能是研究的好东西。它非常小,可在微控制器上运行,并且是开源的。它对网络和通信有很大的偏见,但也许你可以跳过这些部分并专注于内核。

#4


2  

If you choose ARM, pick up a copy of the ARM System Developer's Guide (Sloss, Symes, Wright). Link to Amazon

如果选择ARM,请选择ARM System Developer's Guide(Sloss,Symes,Wright)的副本。链接到亚马逊

Chapter 11 discusses the implementation of a simple embedded operating system, with great explanations and sample code.

第11章讨论了简单嵌入式操作系统的实现,并提供了很好的解释和示例代码。

#5


2  

ARM and AVR are chalk and cheese - you've scoped this very wide!

ARM和AVR都是粉笔和奶酪 - 你的范围非常宽!

You could produce a very different and more sophisticated OS for ARM than AVR (unless you are talking about AVR32 perhaps - which is a completely different architecture?).

您可以为ARM生成一个非常不同且更复杂的ARM操作系统(除非您在谈论AVR32,这可能是一个完全不同的架构?)。

AVR would be far more constraining to the point that the task may be just to trivial for the scope of your thesis. Even specifying ARM does not narrow it down much; low-end ARM parts have small on-chip memories, no MMU and simple peripherals; higher end parts have an MMU, data/instruction caches, often a GPU, sometimes an FPU, hardware Java bytecode execution, and many other complex peripherals. The term 'ARM' covers ARM7, ARM9, ARM11, Cortex M3, Cortex M8, plus a number of architectures intended for use on ASICs and FPGAs - so you need to narrow it down a bit perhaps?

AVR将更加局限于这个任务可能只是为了论文的范围而微不足道。即使指定ARM也不会缩小范围;低端ARM器件具有小型片上存储器,无MMU和简单的外设;高端部件具有MMU,数据/指令缓存,通常是GPU,有时是FPU,硬件Java字节码执行以及许多其他复杂外设。术语“ARM”涵盖ARM7,ARM9,ARM11,Cortex M3,Cortex M8,以及许多旨在用于ASIC和FPGA的架构 - 因此您需要缩小它的范围吗?

If you choose ARM, take a look at these resources. Especially the Insider's Guides from Hitex, and the "Building bare-metal ARM with GNU", they will help you get your board 'up' and form starting point for your OS.

如果选择ARM,请查看这些资源。特别是来自Hitex的Insider's Guides,以及“使用GNU构建裸机ARM”,它们将帮助您“升级”并成为操作系统的起点。

#6


2  

Silly as it may sound, I was recently interested in the Arduino platform to learn some hacking tricks with the help of more experienced friends. There was also this thread for a guy interested in writing an OS for it (although not his primary intention).

听起来很傻,我最近对Arduino平台感兴趣,在更有经验的朋友的帮助下学习一些黑客技巧。对于一个有兴趣为它编写操作系统的人来说,也有这个帖子(尽管不是他的主要目的)。

I think the Arduino is very basic and straightforward as an educational tool for such endeavors. It may worth the try checking it out if it fits the bill.

我认为Arduino作为这种努力的教育工具是非常基本和直接的。如果适合账单,可能值得一试。

#7


1  

alt text http://ecx.images-amazon.com/images/I/3125C47MR4L._SL500_AA180_.jpghttp://www.amazon.com/Operating-Systems-Design-Implementation-3rd/dp/0131429388

替代文字http://ecx.images-amazon.com/images/I/3125C47MR4L._SL500_AA180_.jpghttp://www.amazon.com/Operating-Systems-Design-Implementation-3rd/dp/0131429388

Pretty solid stuff.

相当坚实的东西。

#8


1  

The first thing I recommend is to narrow your thesis topic considerably. OSs are ubiquitous, well researched and developed. What novel idea do you hope to pursue?

我建议的第一件事就是大大缩小你的论文题目。操作系统无处不在,经过深入研究和开发。你希望追求什么新颖的想法?

That said, the AvrX is a very small microkernel that I've used professionally on AVR microcontrollers. It is written in assembly. One person started to port it to C, but hasn't finished the port. Either finalizing the port to C and/or making a C port to the AVR32 architecture would be valuable.

也就是说,AvrX是一个非常小的微内核,我专门用于AVR微控制器。它是用汇编语言编写的。一个人开始将它移植到C,但还没有完成端口。将端口最终确定为C和/或将C端口设置为AVR32架构将是有价值的。

#9


1  

An OS shall not be tightly coupled to any processor so ARM or x86 doesn't matter. It will be a bigger topic, if we start discussing if ARM is embedded and x86 is not. Anyway, there are many many places in which x86 processors are used for embedded software development.

操作系统不应与任何处理器紧密耦合,因此ARM或x86无关紧要。如果我们开始讨论是否嵌入了ARM而x86不是嵌入式,那将是一个更大的话题。无论如何,有许多地方使用x86处理器进行嵌入式软件开发。

I guess most of the kernel code will be just plain C lanugage. There are many free OS that are already available, like for example, embedded linux, Free version of Itron, minix, etc ... It will be a daunting task.

我猜大多数内核代码都只是普通的C语言。有许多已经可用的免费操作系统,例如嵌入式Linux,免费版Itron,minix等......这将是一项艰巨的任务。

But on the other hand, what you can try is, port embedded linux to platforms in which it is not yet working. This will be really useful to the world.

但另一方面,您可以尝试将嵌入式Linux移植到尚未运行的平台。这对世界非常有用。

#10


1  

An RTOS is almost never architecture specific. Refer to any RTOS architecture available on the net and you will notice that a CPU/Hardware abstraction layer abstracts out the CPU. The board specific portions (that deal with peripherals such as com ports, timers etc.) are abstracted by a board support package.

RTOS几乎从不是特定于体系结构的。请参阅网络上提供的任何RTOS体系结构,您会注意到CPU /硬件抽象层将CPU抽象出来。电路板特定部分(处理外围设备,如com端口,定时器等)由电路板支持包抽象。

To begin with, get an understanding of how multi-threading works in a RTOS try implementing a simple context switch code for the CPU of your choice; this will involve code for creating a thread context, saving a context and restoring a saved context. This code will form the basis of your hardware abstraction layer. The initial development can easily be accomplished using a software simulator for the selected CPU.

首先,了解多线程如何在RTOS中工作,尝试为您选择的CPU实现简单的上下文切换代码;这将涉及用于创建线程上下文,保存上下文和恢复已保存上下文的代码。此代码将构成硬件抽象层的基础。使用所选CPU的软件模拟器可以轻松完成初始开发。

I agree with the poster who suggested reading the book, uCOS-II by Jean Labrosse. Samples of context switch code, especially for x86, should be just a google search away!

我赞同海报建议阅读Jean Labrosse的书,即uCOS-II。上下文切换代码的​​示例,特别是对于x86,应该只是谷歌搜索!