Ada Bare Bones: Difference between revisions

From OSDev.wiki
Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content deleted Content added
Line 6: Line 6:


==Preface==
==Preface==

This tutorial is based on my multiboot kernel which I developed some time ago and placed on my site [http://www.archeia.com/an-ada95-hello-world-style-kernel.html].


One of the first things people ask on the Ada IRC channel on Freenode is "Can Ada be used for OS development?" to which the answer is a resounding '''yes'''. But there are 2 problems:
One of the first things people ask on the Ada IRC channel on Freenode is "Can Ada be used for OS development?" to which the answer is a resounding '''yes'''. But there are 2 problems:
Line 14: Line 16:
Therefore these users don't understand what it takes to get the compiler into a useable state.
Therefore these users don't understand what it takes to get the compiler into a useable state.


As you may have seen from other bare bones tutorials on this site, they state that you must have a compiler built which can handle [[ELF]] files, the usual way is by building GCC which targets i386-elf or some other similar architecture. The problem here is that GNAT will not build for these targets out of the box without messing with it's makefile.
As you may have seen from other bare bones tutorials on this site, they state that you must have a compiler built which can handle [[ELF]] files, the usual way is by building GCC which targets i386-elf or some other similar architecture. The problem here is that GNAT will not build for these targets out of the box without messing with it's makefile. You have to do this as the makefile builds the RTS and then the gnat tools (gnatmake, gnatbind, et al).

So, for this tutorial, we will use the system GNAT compiler to build for i386 and later I will show how to build an arm-elf compiler and tools.


==GNAT and the Ada runtime system (RTS)==
==GNAT and the Ada runtime system (RTS)==

Revision as of 12:35, 13 June 2012

Difficulty level

Medium
Kernel Designs
Models
Other Concepts

In this tutorial we will compile a simple Ada kernel and boot it.

WAIT! Have you read Getting Started, Beginner Mistakes, and some of the related OS theory?

Preface

This tutorial is based on my multiboot kernel which I developed some time ago and placed on my site [1].

One of the first things people ask on the Ada IRC channel on Freenode is "Can Ada be used for OS development?" to which the answer is a resounding yes. But there are 2 problems:

  1. The people asking this question are new to Ada, and
  2. GNAT is not the easiest compiler to build.

Therefore these users don't understand what it takes to get the compiler into a useable state.

As you may have seen from other bare bones tutorials on this site, they state that you must have a compiler built which can handle ELF files, the usual way is by building GCC which targets i386-elf or some other similar architecture. The problem here is that GNAT will not build for these targets out of the box without messing with it's makefile. You have to do this as the makefile builds the RTS and then the gnat tools (gnatmake, gnatbind, et al).

So, for this tutorial, we will use the system GNAT compiler to build for i386 and later I will show how to build an arm-elf compiler and tools.

GNAT and the Ada runtime system (RTS)

Configuring the RTS

Files

startup.s

multiboot.ads

vga_console.ads and vga_console.adb

kernel.adb

linker.ld