Compare commits

..

12 Commits

Author SHA1 Message Date
Folkert Kevelam
687f519373 Initial commit 2025-06-28 21:51:15 +02:00
Folkert Kevelam
da845fb44a Initial commit 2025-06-28 21:47:09 +02:00
Folkert Kevelam
ee9b469c90 Change compilation switches 2025-06-27 20:32:59 +02:00
Folkert Kevelam
b899c9f4ce Add Packed bytes for working with 2025-06-25 23:17:52 +02:00
Folkert Kevelam
181e2815f4 Initial commit: 2025-06-24 22:42:28 +02:00
Folkert Kevelam
7edee9f7cc Adding required switches for cortex-m0+ 2025-06-24 22:41:59 +02:00
Folkert Kevelam
abede4a41c Initial commit 2025-06-24 22:38:09 +02:00
Folkert Kevelam
b5d7749cf2 Initial commit 2025-06-24 22:37:52 +02:00
Folkert Kevelam
efb48f02cf Change to Aspect definitions 2025-06-24 22:37:30 +02:00
Folkert Kevelam
2a3a411197 Add gprbuild for runtime 2025-06-24 22:36:31 +02:00
Folkert Kevelam
4e9879c6a1 Initial commit 2025-06-23 20:34:39 +02:00
Folkert Kevelam
dd8a75390b Initial commit 2025-06-23 20:34:28 +02:00
8 changed files with 329 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
.build
adalib

View File

@ -0,0 +1,171 @@
with System;
package Interfaces.RP2040
with Pure is
ROM_Base : constant System.Address :=
System'To_Address (16#00000000#);
XIP_Base : constant System.Address :=
System'To_Address (16#10000000#);
XIP_No_Alloc_Base : constant System.Address :=
System'To_Address (16#11000000#);
XIP_No_Cache_Base : constant System.Address :=
System'To_Address (16#12000000#);
XIP_No_Alloc_No_Cache_Base : constant System.Address :=
System'To_Address (16#13000000#);
XIP_CTRL_Base : constant System.Address :=
System'To_Address (16#14000000#);
XIP_SRAM_Base : constant System.Address :=
System'To_Address (16#15000000#);
XIP_SRAM_End : constant System.Address :=
System'To_Address (16#15004000#);
XIP_SSI_Base : constant System.Address :=
System'To_Address (16#18000000#);
SRAM_Base : constant System.Address :=
System'To_Address (16#20000000#);
SRAM_Striped_Base : constant System.Address :=
System'To_Address (16#20000000#);
SRAM_Striped_End : constant System.Address :=
System'To_Address (16#20040000#);
SRAM_0_Base : constant System.Address :=
System'To_Address (16#21000000#);
SRAM_1_Base : constant System.Address :=
System'To_Address (16#21010000#);
SRAM_2_Base : constant System.Address :=
System'To_Address (16#21020000#);
SRAM_3_Base : constant System.Address :=
System'To_Address (16#21030000#);
SRAM_4_Base : constant System.Address :=
System'To_Address (16#20040000#);
SRAM_5_Base : constant System.Address :=
System'To_Address (16#20041000#);
SRAM_End : constant System.Address :=
System'To_Address (16#20042000#);
SYSINFO_Base : constant System.Address :=
System'To_Address (16#40000000#);
SYSCFG_Base : constant System.Address :=
System'To_Address (16#40004000#);
Clocks_Base : constant System.Address :=
System'To_Address (16#40008000#);
Resets_Base : constant System.Address :=
System'To_Address (16#4000C000#);
PSM_Base : constant System.Address :=
System'To_Address (16#40010000#);
IO_Bank_0_Base : constant System.Address :=
System'To_Address (16#40014000#);
IO_QSPI_Base : constant System.Address :=
System'To_Address (16#40018000#);
Pads_Bank_0_Base : constant System.Address :=
System'To_Address (16#4001c000#);
Pads_QSPI_Base : constant System.Address :=
System'To_Address (16#40020000#);
XOSC_Base : constant System.Address :=
System'To_Address (16#40024000#);
PLL_SYS_Base : constant System.Address :=
System'To_Address (16#40028000#);
PLL_USB_Base : constant System.Address :=
System'To_Address (16#4002C000#);
BUSCTRL_Base : constant System.Address :=
System'To_Address (16#40030000#);
UART_0_Base : constant System.Address :=
System'To_Address (16#40034000#);
UART_1_Base : constant System.Address :=
System'To_Address (16#40038000#);
SPI_0_Base : constant System.Address :=
System'To_Address (16#4003C000#);
SPI_1_Base : constant System.Address :=
System'To_Address (16#40040000#);
I2C_0_Base : constant System.Address :=
System'To_Address (16#40044000#);
I2C_1_Base : constant System.Address :=
System'To_Address (16#40048000#);
ADC_Base : constant System.Address :=
System'To_Address (16#4004C000#);
PWM_Base : constant System.Address :=
System'To_Address (16#40050000#);
Timer_Base : constant System.Address :=
System'To_Address (16#40054000#);
Watchdog_Base : constant System.Address :=
System'To_Address (16#40058000#);
RTC_Base : constant System.Address :=
System'To_Address (16#4005C000#);
ROSC_Base : constant System.Address :=
System'To_Address (16#40060000#);
VREG_And_Chip_Reset_Base : constant System.Address :=
System'To_Address (16#40064000#);
TBMAN_Base : constant System.Address :=
System'To_Address (16#40068000#);
DMA_Base : constant System.Address :=
System'To_Address (16#50000000#);
USBCTRL_Base : constant System.Address :=
System'To_Address (16#50100000#);
USBCTRL_DPRAM_Base : constant System.Address :=
System'To_Address (16#50100000#);
USBCTRL_REGS_Base : constant System.Address :=
System'To_Address (16#50110000#);
PIO_0_Base : constant System.Address :=
System'To_Address (16#50200000#);
PIO_1_Base : constant System.Address :=
System'To_Address (16#50300000#);
XIP_AUX_Base : constant System.Address :=
System'To_Address (16#50400000#);
SIO_Base : constant System.Address :=
System'To_Address (16#D0000000#);
PPB_Base : constant System.Address :=
System'To_Address (16#E0000000#);
end Interfaces.RP2040;

View File

@ -0,0 +1,18 @@
package Interfaces
with Pure is
type Integer_32 is range -2**31 .. 2**31 - 1;
type Unsigned_32 is mod 2**32;
function Shift_Left (Value : Unsigned_32; Amount : Natural)
return Unsigned_32 with Import, Convention => Intrinsic;
function Shift_Right (Value : Unsigned_32; Amount : Natural)
return Unsigned_32 with Import, Convention => Intrinsic;
function Shift_Right_Arithmetic (Value : Unsigned_32; Amount : Natural)
return Unsigned_32 with Import, Convention => Intrinsic;
function Rotate_Left (Value : Unsigned_32; Amount : Natural)
return Unsigned_32 with Import, Convention => Intrinsic;
function Rotate_Right (Value : Unsigned_32; Amount : Natural)
return Unsigned_32 with Import, Convention => Intrinsic;
end Interfaces;

View File

@ -0,0 +1,13 @@
package System.Unsigned_Types with
Pure is
type Packed_Byte is mod 2 ** 8
with Universal_Aliasing;
for Packed_Byte'Size use 8;
type Packed_Bytes1 is array (Natural range <>) of aliased Packed_Byte
with Suppress_Initialization;
for Packed_Bytes1'Alignment use 1;
for Packed_Bytes1'Component_Size use Packed_Byte'Size;
end System.Unsigned_Types;

View File

@ -0,0 +1,39 @@
package System
with Pure is
type Name is (Light_Runtime_RP2040);
System_Name : constant Name := Light_Runtime_RP2040;
Min_Int : constant := Long_Long_Integer'First;
Max_Int : constant := Long_Long_Integer'Last;
Storage_Unit : constant := 8;
Word_Size : constant := 4 * Storage_Unit;
Memory_Size : constant := 2 ** Word_Size;
Max_Binary_Modulus : constant := 2 ** Word_Size;
Max_NonBinary_Modulus : constant := 2 ** Word_Size - 1;
type Address is private
with Preelaborable_Initialization;
Null_Address : constant Address;
function "<" (Left, Right : Address) return Boolean
with Import, Convention => Intrinsic;
function "<=" (Left, Right : Address) return Boolean
with Import, Convention => Intrinsic;
function ">" (Left, Right : Address) return Boolean
with Import, Convention => Intrinsic;
function ">=" (Left, Right : Address) return Boolean
with Import, Convention => Intrinsic;
function "=" (Left, Right : Address) return Boolean
with Import, Convention => Intrinsic;
type Bit_Order is (High_Order_First, Low_Order_First);
Default_Bit_Order : constant Bit_Order := Low_Order_First;
private
type Address is mod Memory_Size;
Null_Address : constant Address := 0;
end System;

View File

@ -0,0 +1,5 @@
generic
type Source (<>) is limited private;
type Target (<>) is limited private;
function Unchecked_Conversion (S : Source) return Target
with Pure, Import, Convention => Intrinsic;

46
runtime/runtime.gpr Normal file
View File

@ -0,0 +1,46 @@
library project Runtime is
for Languages use ("Ada");
for Library_Auto_Init use "False";
for Library_Name use "gnat";
for Library_Kind use "static";
for Library_Dir use "adalib";
for Object_Dir use ".build";
for Source_Dirs use ("adainclude");
for Target use "arm-eabi";
for Runtime ("Ada") use Runtime'Project_Dir;
package Compiler is
COMMON_FLAGS := ("-ffunction-sections", "-fdata-sections");
COMMON_FLAGS := COMMON_FLAGS & ("-g", "-Os");
ALL_ADAFLAGS :=
("-gnatwae", "-gnatpgn", "-gnatqQ", "-nostdinc", "-gnat2022")
& COMMON_FLAGS
& external_as_list ("EXTRA_ADAFLAGS", " ");
ALL_ADAFLAGS := ALL_ADAFLAGS & "-gnata";
ALL_CFLAGS :=
external_as_list("INCLUDES", " ")
& external_as_list("DEFINES", " ")
& ("-DIN_RTS", "-Dinhibit_libc") & COMMON_FLAGS;
for Switches ("C") use ALL_CFLAGS;
for Switches ("Ada") use ALL_ADAFLAGS;
end Compiler;
package Install is
for Prefix use "arm-eabi/lib/gnat/";
for Sources_Subdir use "adainclude";
for Ali_Subdir use "adalib";
for Lib_Subdir use "adalib";
for Required_Artifacts (".") use ("runtime.xml");
for Install_Project use "false";
end Install;
end Runtime;

35
runtime/runtime.xml Normal file
View File

@ -0,0 +1,35 @@
<?xml version="1.0" ?>
<gprconfig>
<configuration>
<config><![CDATA[
package Compiler is
Common_Required_Switches :=
("-mlittle-endian",
"-mcpu=cortex-m0plus", "-mthumb");
for Leading_Required_Switches ("Ada") use
Compiler'Leading_Required_Switches ("Ada") &
Common_Required_Switches;
for Leading_Required_Switches ("C") use
Compiler'Leading_Required_Switches ("C") &
Common_Required_Switches;
end Compiler;
package Linker is
for Required_Switches use Linker'Required_Switches &
("${RUNTIME_DIR(ada)}/adalib/libgnat.a") &
Compiler.Common_Required_Switches &
("-nostdlib", "-lm", "-lgcc", "-lc");
end Linker;
package Binder is
for Required_Switches ("Ada") use Binder'Required_Switches ("Ada")
& ("-nostdlib");
end Binder;
]]>
</config>
</configuration>
</gprconfig>