What RTS files are required for a Zero Footprint Profile

Moderators: dhowells, RobertKleczek, Lucretia

What RTS files are required for a Zero Footprint Profile

Postby Lucretia » Tue Oct 14, 2014 4:22 pm

(or a bare metal profile)

Taken from my TAMP repo, the following files re required to build a RTS for bare metal, this can be used for OS dev as well as MCU work, where the MCU has very few resources. This gives you a very basic runtime, not a lot of Ada is allowed:

Ada.ads, gnat.ads

Empty root packages, all pure.

system.ads

Edited to disallow certain things like exception handling forcing all exceptions to call Last_Chance_Handler.

a-unccon.ads, a-uncdea.ads

Everything insice Ada.Unchecked_Conversion and Ada.Unchecked_Deallocation is a compiler intrinsic and therefore handled by the compiler.

s-atacco.ads & s-atacco.adb

System.Address_To_Access_Conversions

Compiler intrinsic code again, but the body is empty, this is because GNAT's styling flags indicat that it requires one. This can be turned off, I just didn't get around to it.

s-maccod.ads

Again, System.Machine_Code is a compiler intrinsic package allowing the user to inline assembly language.

s-stoele.ads & s-stoele.adb

Further compiler intrinsics are defined by System.Storage_Elements but also some support functions using those intrinsics are in the body.

last_chance_handler.ads & last_chance_handler.adb

This function really should do something along the lines of dump out the registers and maybe the stack to serial/screen.etc. and then halt the processor.

interfac.ads

The usual Ada Interfaces package which gives us a load of machine types and intrinsics again.

g-souinf.ads

GNAT.Source_Info gives more compiler intrinsics to give the user access to source line information from the compiler. A very useful package that could be used with the Last_Chance_Handler.

If you wanted Interfaces.C you would need to add a secondary stack implementation so that indefinite types could be returned from functions as this package uses that feature. This would be more useful to an embedded project where there was a C library which was to be used as a basis.

Luke.
Lucretia
 
Posts: 2
Joined: Tue Oct 14, 2014 3:54 pm

Re: What RTS files are required for a Zero Footprint Profile

Postby RE: » Fri May 01, 2015 9:22 am

Thanks Lucretia for this useful info.

I'd like to add some comments, mostly off my head and from my experience with the early days of AVR-Ada.

gnat.ads

This is not strictly needed, but does not add any run-time code.

s-unstyp.ads

Package System.Unsigned_Types adds operations on Unsigned as compiler intrinsics. Unsigned types are often required in the low level interface layers to the hardware. You will miss this one.

s-bitops.ads s-bitops.adb

Package System.Bit_Ops adds operations on packed bit strings. All operations are inlined, so they don't need run-time support. You need these operations if you want to access single bits in a byte (or word). From AVR-Ada:

Code: Select all
   --  Bit_Number indexes the single bits in a byte
   type Bit_Number is range 0 .. 7;

   --  Give access to every single bit in a byte as a boolean.
   type Bits_In_Byte is array (Bit_Number) of Boolean;
   pragma Pack (Bits_In_Byte);
   for Bits_In_Byte'Size use 8;
   --  It permits expressions like:
   --     Frame_Rate_Reg : Bits_In_Byte;
   --  begin
   --     Frame_Rate_Reg := (LCDCD0_Bit => True,
   --                        LCDCD1_Bit => True,
   --                        LCDCD2_Bit => True,
   --                        LCDPS0_Bit => False,
   --                        LCDPS1_Bit => False,
   --                        LCDPS2_Bit => False,
   --                        others     => False);


a-charac.ads a-chlat1.ads a-chlat9.ads

Ada.Characters and some children aren't needed. They don't need run-time support as they only contain constant definitions. Might be useful sometimes.

Have fun
RE
RE:
 
Posts: 3
Joined: Thu Apr 02, 2015 6:40 am

Re: What RTS files are required for a Zero Footprint Profile

Postby sjw » Mon Jun 22, 2015 5:42 am

RE: wrote:s-bitops.ads s-bitops.adb

Package System.Bit_Ops adds operations on packed bit strings. All operations are inlined, so they don't need run-time support. You need these operations if you want to access single bits in a byte (or word). [/code]


The operations don’t appear to be inlined in current compiler releases; and the comments for most of the operations say e.g.

Code: Select all
   --  Bitwise "and" of given bit string with result being placed in Result.
   --  The and operation is allowed to destroy unused bits in the last byte,
   --  i.e. to leave them set in an undefined manner. Note that Left, Right
   --  and Result always have the same length in bits (Len).


The “undefined manner” sounds dangerous.
sjw
 
Posts: 3
Joined: Thu Mar 19, 2015 9:48 pm


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron