Torsten Knodt
Torsten Knodt

Reputation: 746

How can I install the ZFP (Zero Foot Print) RTS (Run Time System) for AVR with the Alire package manager for Ada?

How can I install the ZFP (Zero Foot Print) RTS (Run Time System) for AVR with the Alire package manager for Ada?

My project file, I think correctly, contains:

project Avr is
   for Runtime("Ada") use "zfp";
   for Target use "avr-elf";
end Avr;

alire.toml hopefully correction contains:

[[depends-on]]
gnat_avr_elf = ">=11.2.4"

Unfortunately, when running alr build, I get:

gprconfig: can't find a toolchain for the following configuration:
gprconfig: language 'ada', target 'avr-elf', runtime 'zfp'

I found documentation for programming AVR with Ada, but this assumes that I build the tool-chain myself and not have a package manager at least providing the GNU tool-chain.

The same applies to Programming Arduino with Ada.

Upvotes: 0

Views: 335

Answers (2)

Torsten Knodt
Torsten Knodt

Reputation: 746

https://github.com/Fabien-Chouteau/bare_runtime is very adaptable and can at least be brought to build.

However, the following changes are required:

diff --git a/bare_runtime.gpr b/bare_runtime.gpr
index 1f6059c..69b4dd6 100644
--- a/bare_runtime.gpr
+++ b/bare_runtime.gpr
@@ -13,7 +13,7 @@ project Bare_Runtime is
   for Library_Dir use "adalib";
   for Object_Dir use "obj";
 
-  for Source_Dirs use ("src");
+  for Source_Dirs use ("src", "config");
 
   package Naming is
      for Spec_Suffix ("Asm_CPP") use ".inc";
@@ -39,6 +39,26 @@ project Bare_Runtime is
        & ("-g");
      for Switches ("raise-gcc.c") use Target_Options.ALL_CFLAGS
        & ("-fexceptions");
+     for Switches ("s-stoele.adb") use Target_Options.ALL_ADAFLAGS
+       & ("-gnatwn");
+     for Switches ("s-secsta.adb") use Target_Options.ALL_ADAFLAGS
+       & ("-gnatwn");
+     for Switches ("s-memtyp.ads") use Target_Options.ALL_ADAFLAGS
+       & ("-gnatwn");
+     for Switches ("s-memory.adb") use Target_Options.ALL_ADAFLAGS
+       & ("-gnatwn");
+     for Switches ("s-fatsfl.ads") use Target_Options.ALL_ADAFLAGS
+       & ("-gnatwn");
+     for Switches ("s-fatllf.ads") use Target_Options.ALL_ADAFLAGS
+       & ("-gnatwn");
+     for Switches ("s-fatlfl.ads") use Target_Options.ALL_ADAFLAGS
+       & ("-gnatwn");
+     for Switches ("s-fatflt.ads") use Target_Options.ALL_ADAFLAGS
+       & ("-gnatwn");
+     for Switches ("a-tags.adb") use Target_Options.ALL_ADAFLAGS
+       & ("-gnatwn");
+     for Switches ("a-elchha.adb") use Target_Options.ALL_ADAFLAGS
+       & ("-gnatwn");
 
      --  Don't inline System.Machine_Reset otherwise we can loose our common
      --  exit system.
diff --git a/src/s-memory.adb b/src/s-memory.adb
index bcb4494..a3d3f93 100644
--- a/src/s-memory.adb
+++ b/src/s-memory.adb
@@ -31,7 +31,7 @@
 
 --  Simple implementation for use with ZFP
 
-pragma Restrictions (No_Elaboration_Code);
+--  pragma Restrictions (No_Elaboration_Code);
 --  This unit may be linked without being with'ed, so we need to ensure
 --  there is no elaboration code (since this code might not be executed).

The issue seems to be that the GCC/ GNAT toolchain for AVR seems to have unsupported combinations of word sizes for addresses and/ or basic datatypes.

So far I did not investigate that further, but still wanted to document the status.

FYI, I did not do any testing so far, so this is really just compiling and most probably will not run without issues.

To include that, call alr with --use=./bare_runtime bare_runtime, where I assume that you have the code for the bare_runtime as a sub-folder in your project.

Upvotes: 0

RREE
RREE

Reputation: 101

Currently, there is no maintained runtime for AVR. You can get the compiler but no runtime through the alr toolchain command. (which is a bit useless then)

I ran the AVR-Ada project until sometimes around 2013 and we had a RTS which was close to today's ZFP with some additional routines for fast integer to string conversion and delay until commands. I haven't built the runtime myself since a long time. Didn't know that someone is interested.

Upvotes: 1

Related Questions