Writing an OS for Motorola 68K processor. Can I emulate it? And can I test-drive OS development?

StackOverflow https://stackoverflow.com/questions/8883245

Вопрос

Next term, I'll need to write a basic operating system for Motorola 68K processor as part of a course lab material.

Is there a Linux emulator of a basic hardware setup with that processor? So my partners and I can debug quicker on our computers instead of physically restarting the board and stuff.

Is it possible to apply test-driven development technique to OS development? Code will be mostly assembly and C. What will be the main difficulties with trying to test-drive this? Any advice on how to do it?

Это было полезно?

Решение

You certainly can tdd this project. First off decouple all accesses to the hardware with simple routine calls, e.g. getch() and printf, then you can provide simple mocks that provide test input and check output. You can then write well over 90% of the project on a PC using gcc, msdev or xcode. Once you have got some confidence in the decoupling routines you will need very little access to the hardware, and only then to occasionally check that your mocks are acting as you expect.

Keep to C until you find a particular bottle neck, and only then resort to assembler.

Другие советы

I would recommend developing an operating system for the classic Amiga computers, which had different versions of the 68000 processor. Since the Amiga computer is a complete computer and is extremely well documented, I thought this would be a good exercise.

There is an emulator for it called UAE (and Win-UAE) which is very exact and can be configured with different kinds of processors (68000 - 68060) and other capabilities. Normally, you would also need to acquire ROMs for it, but since you are developing an operating system yourself, this is not necessary.

Tools you will need is either Cygwin (for developing under Windows) or a Linux computer. Then you will need cross compilers. This includes both a C compiler and an assembler. Here is a template for creating a simple ROM which changes screen color and flicks the power LED. It will create a file 'kick.rom' which UAE then searches for in the current directory.

Reference on the 68000 instruction set can be found at the links below. Be aware that different assembler programs may use slightly different syntax and instruction set.

If you need to demo the operating system on real hardware, there are modern Amiga clones sold on Ebay and other places. Search for "Minimig".

Update: Nowadays AROS also runs on UAE as well as physical Amigas.

Refs:

[UAE]
[WinUAE]
[Cygwin]
[Cross Compilers]
[68000 reference]

I would suggest QEMU for m68k emulation.

(The system emulator you want in QEMU is "Coldfire" - that's what Freescale calls the successor to the m68k architecture).

There are a few new projects that use hardware simulated 68000 cpus, the C-One project, the Minimig (Mini Amiga) project and the Natami (Native Amiga) project - they are new 68k compatible Amiga systems.

C One, reconfigurable computer, Minimig, in development, prototypes done: FPGA Arcade and Natami.

The Easy68k http://www.easy68k.com simulator might help you.

The uClinux project started on a m68k board. They may have the tools you need...

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top