This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Some success (was "Re: How do I use GNAT to develop an OS kernel?")

So, I got my old source to build and boot under grub. I now have my old
hello world style Ada kernel.

I had to remove the "pragma Restrictions(No_Elaboration_Code);" lines
from all the source files that I had and also the "pragma
Suppress_Initialization" lines I had in there (I honestly can't even
remember why I had that in there at all).

I included the following in a new gnat.adc file:

-- Basic stuff.
pragma Restrictions(No_Obsolescent_Features);
pragma Restrictions(No_Exceptions);
pragma Restrictions(No_Recursion);

-- Memory management.
pragma Restrictions(No_Allocators);
pragma Restrictions(No_Local_Allocators);
pragma Restrictions(No_Unchecked_Deallocation);
--pragma Restrictions(No_);

-- Make sure we don't have tasking or any of it's features enabled.
pragma Restrictions(Max_Tasks => 0);
pragma Restrictions(No_Protected_Types);
pragma Restrictions(No_Delay);
pragma Restrictions(No_Task_Hierarchy);
pragma Restrictions(No_Abort_Statements);
pragma Restrictions(No_Implicit_Heap_Allocations);
pragma Restrictions(No_Asynchronous_Control);

I'm sure there are more restrictions I can use here.

So far the kernel is around 4-5KB in size when stripped, I definitely
think there's more stuff to get rid of from the linker script and the
gnat.adc file.

My kernel will require some basic console/serial IO but I haven't
decided whether to port across the IO or add in No_IO as well. 

I still have a number of questions regarding this feat:

1) If I use the Max_Tasks = 0, does this imply that all other tasking
restrictions are also set or do I have to do this manually? i.e. I have
"No_Protected_Types" enabled up there, is this done for me when
Max_Tasks = 0?

2) Can anybody think of any further restrictions I can use to make sure
that my kernel builds with the minimum of RT?

3) On bare hardware can I reasonably assume that System.Address = access
type or do I still require the use of

4) Can I reasonably use tagged types for this project? Will it require
any RT packages? If so, which ones?

5) Is elaboration order still an issue for a kernel? Should my entry
point be the "main" that gnatbind creates for me? But, won't that
include arg[cv] (which I don't need for a kernel)?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]