parent
d43a5a6ef1
commit
d3f5a369a7
|
@ -10,11 +10,10 @@
|
||||||
using Genode::log;
|
using Genode::log;
|
||||||
|
|
||||||
|
|
||||||
extern "C" void add(int a, int b, int *result)
|
extern "C" void print_add(int a, int b, int *result)
|
||||||
{
|
{
|
||||||
log("add called with a=", a, ", b=", b, ", result at address ",
|
log("add called with a=", a, ", b=", b, ", result at address ",
|
||||||
(void*)result);
|
(void*)result);
|
||||||
*result = a + b;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
package body add_package is
|
||||||
|
|
||||||
|
procedure Add(A: in Integer;
|
||||||
|
B: in Integer;
|
||||||
|
R: out Integer)
|
||||||
|
is
|
||||||
|
procedure ext_c_print_add(a, b : Integer; result : out Integer);
|
||||||
|
pragma import(C, ext_c_print_add, "print_add");
|
||||||
|
begin
|
||||||
|
ext_c_print_add(A, B, R);
|
||||||
|
R := A + B;
|
||||||
|
end Add;
|
||||||
|
|
||||||
|
end add_package;
|
|
@ -0,0 +1,4 @@
|
||||||
|
package add_package is
|
||||||
|
procedure Add(A: in Integer; B: in Integer; R: out Integer);
|
||||||
|
end add_package;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
-- \date 2009-09-23
|
-- \date 2009-09-23
|
||||||
--
|
--
|
||||||
|
|
||||||
with test_package;
|
with add_package;
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Main program
|
-- Main program
|
||||||
|
@ -16,13 +16,10 @@ procedure main is
|
||||||
--
|
--
|
||||||
-- Declarations of external C functions
|
-- Declarations of external C functions
|
||||||
--
|
--
|
||||||
procedure ext_c_add(a, b : Integer; result : out Integer);
|
|
||||||
pragma import(C, ext_c_add, "add");
|
|
||||||
|
|
||||||
procedure ext_c_print_int(a : Integer);
|
procedure ext_c_print_int(a : Integer);
|
||||||
pragma import(C, ext_c_print_int, "print_int");
|
pragma import(C, ext_c_print_int, "print_int");
|
||||||
|
|
||||||
begin
|
begin
|
||||||
ext_c_add(13, 14, result);
|
add_package.Add(13, 14, result);
|
||||||
ext_c_print_int(result);
|
ext_c_print_int(result);
|
||||||
end main;
|
end main;
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
* Declaration of the Ada main procedure
|
* Declaration of the Ada main procedure
|
||||||
*/
|
*/
|
||||||
extern "C" void _ada_main(void);
|
extern "C" void _ada_main(void);
|
||||||
|
extern "C" void add_package__add(int, int, int*);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make the linker happy
|
* Make the linker happy
|
||||||
|
@ -21,6 +22,11 @@ extern "C" void __gnat_eh_personality()
|
||||||
Genode::warning(__func__, " not implemented");
|
Genode::warning(__func__, " not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" void __gnat_rcheck_CE_Overflow_Check()
|
||||||
|
{
|
||||||
|
Genode::warning(__func__, " not implemented");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wrapper for the Ada main program
|
* Wrapper for the Ada main program
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
TARGET = test-ada
|
TARGET = test-ada
|
||||||
SRC_ADA = main.adb
|
SRC_ADA = main.adb add_package.adb
|
||||||
SRC_CC = add.cc startup.cc
|
SRC_CC = add.cc startup.cc
|
||||||
LIBS = base
|
LIBS = base
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
package test_package
|
|
||||||
is
|
|
||||||
|
|
||||||
type some_range_t is range 1..99;
|
|
||||||
|
|
||||||
end test_package;
|
|
Loading…
Reference in New Issue