Skip to content

Commit

Permalink
Community 2021 (#386)
Browse files Browse the repository at this point in the history
* Update for GNAT Community 2021

* Update workflow for CE2021
  • Loading branch information
Fabien-Chouteau authored May 26, 2021
1 parent f100ce7 commit 0ccb49f
Show file tree
Hide file tree
Showing 73 changed files with 1,228 additions and 919 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: ada-actions/toolchain@ce2020
- uses: ada-actions/toolchain@ce2021
with:
distrib: community
- uses: ada-actions/toolchain@ce2020
- uses: ada-actions/toolchain@ce2021
with:
distrib: community
target: arm-elf
- uses: ada-actions/toolchain@ce2020
- uses: ada-actions/toolchain@ce2021
with:
distrib: community
target: riscv32-elf
Expand All @@ -31,10 +31,10 @@ jobs:
runs-on: windows-latest
steps:
- uses: actions/checkout@v1
- uses: ada-actions/toolchain@ce2020
- uses: ada-actions/toolchain@ce2021
with:
distrib: community
- uses: ada-actions/toolchain@ce2020
- uses: ada-actions/toolchain@ce2021
with:
distrib: community
target: arm-elf
Expand All @@ -43,10 +43,10 @@ jobs:
with:
python-version: '3.x'
- name: Remove built-in arm-eabi Ravenscar run-times
run: rm -Recurse -Force "d:\a\_temp\gnat-2020-20200818-arm-elf-windows64-bin\arm-eabi\lib\gnat\ravenscar*"
run: rm -Recurse -Force "d:\a\_temp\gnat-2021-20210519-arm-elf-windows64-bin\arm-eabi\lib\gnat\ravenscar*"
shell: pwsh
- name: Remove built-in arm-eabi ZFP run-times
run: rm -Recurse -Force "d:\a\_temp\gnat-2020-20200818-arm-elf-windows64-bin\arm-eabi\lib\gnat\zfp*"
run: rm -Recurse -Force "d:\a\_temp\gnat-2021-20210519-arm-elf-windows64-bin\arm-eabi\lib\gnat\zfp*"
shell: pwsh

- run: python $PWD/scripts/install_dependencies.py
Expand Down
32 changes: 18 additions & 14 deletions boards/HiFive1/hifive1_zfp.gpr
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ library project HiFive1_ZFP is

Linker_Switches := ("-T", Project'Project_dir & "/src/zfp/link.ld");
for Target use "riscv32-elf";
for Runtime ("Ada") use "zfp-rv32imc";
for Runtime ("Ada") use "zfp-rv32imac";

package Device_Configuration is
for CPU_Name use "RISC-V32";
Expand All @@ -79,27 +79,31 @@ library project HiFive1_ZFP is
for Size ("RAM") use "16K";

for Boot_Memory use "board_flash";
for User_Tag ("hifive1_uart_root") use "268513280";
for User_Tag ("qemu_sifive_test_exit") use "True";
end Device_Configuration;

Vendor := "SiFive"; -- From board definition
Max_Mount_Points := "2"; -- From default value
Architecture := "RISC-V"; -- From board definition
Board := "HiFive1"; -- From command line
Boot_Memory := "board_flash"; -- From default value
Max_Mount_Name_Length := "128"; -- From default value
Runtime_Profile := "zfp"; -- From command line
Device_Name := "FE310"; -- From board definition
CPU_Core := "RISC-V32"; -- From mcu definition
Device_Family := "FE3"; -- From board definition
Has_Ravenscar_SFP_Runtime := "False"; -- From board definition
Runtime_Name := "zfp-rv32imc"; -- From default value
Device_Name := "FE310"; -- From board definition
Has_Custom_Memory_Area_1 := "False"; -- From default value
Has_Ravenscar_Full_Runtime := "False"; -- From board definition
CPU_Core := "RISC-V32"; -- From mcu definition
Board := "HiFive1"; -- From command line
Has_Ravenscar_SFP_Runtime := "False"; -- From board definition
Has_ZFP_Runtime := "True"; -- From board definition
Max_Mount_Name_Length := "128"; -- From default value
Max_Mount_Points := "2"; -- From default value
Max_Path_Length := "1024"; -- From default value
Number_Of_Interrupts := "0"; -- From default value
Has_Custom_Memory_Area_1 := "False"; -- From default value
Runtime_Name := "zfp-rv32imac"; -- From default value
Runtime_Name_Suffix := "rv32imac"; -- From board definition
Runtime_Profile := "zfp"; -- From command line
Use_Startup_Gen := "True"; -- From command line
Max_Path_Length := "1024"; -- From default value
Runtime_Name_Suffix := "rv32imc"; -- From board definition
Architecture := "RISC-V"; -- From board definition
Vendor := "SiFive"; -- From board definition
hifive1_uart_root := "268513280"; -- From board definition
qemu_sifive_test_exit := "True"; -- From board definition

-- Project source directories
Src_Dirs_Root := "../..";
Expand Down
28 changes: 15 additions & 13 deletions boards/HiFive1/src/zfp/adl_config.ads
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
-- This package was generated by the Ada_Drivers_Library project wizard script
package ADL_Config is
Vendor : constant String := "SiFive"; -- From board definition
Max_Mount_Points : constant := 2; -- From default value
Architecture : constant String := "RISC-V"; -- From board definition
Board : constant String := "HiFive1"; -- From command line
Boot_Memory : constant String := "board_flash"; -- From default value
Max_Mount_Name_Length : constant := 128; -- From default value
Runtime_Profile : constant String := "zfp"; -- From command line
Device_Name : constant String := "FE310"; -- From board definition
CPU_Core : constant String := "RISC-V32"; -- From mcu definition
Device_Family : constant String := "FE3"; -- From board definition
Has_Ravenscar_SFP_Runtime : constant String := "False"; -- From board definition
Runtime_Name : constant String := "zfp-rv32imc"; -- From default value
Device_Name : constant String := "FE310"; -- From board definition
Has_Custom_Memory_Area_1 : constant Boolean := False; -- From default value
Has_Ravenscar_Full_Runtime : constant String := "False"; -- From board definition
CPU_Core : constant String := "RISC-V32"; -- From mcu definition
Board : constant String := "HiFive1"; -- From command line
Has_Ravenscar_SFP_Runtime : constant String := "False"; -- From board definition
Has_ZFP_Runtime : constant String := "True"; -- From board definition
Max_Mount_Name_Length : constant := 128; -- From default value
Max_Mount_Points : constant := 2; -- From default value
Max_Path_Length : constant := 1024; -- From default value
Number_Of_Interrupts : constant := 0; -- From default value
Has_Custom_Memory_Area_1 : constant Boolean := False; -- From default value
Runtime_Name : constant String := "zfp-rv32imac"; -- From default value
Runtime_Name_Suffix : constant String := "rv32imac"; -- From board definition
Runtime_Profile : constant String := "zfp"; -- From command line
Use_Startup_Gen : constant Boolean := True; -- From command line
Max_Path_Length : constant := 1024; -- From default value
Runtime_Name_Suffix : constant String := "rv32imc"; -- From board definition
Architecture : constant String := "RISC-V"; -- From board definition
Vendor : constant String := "SiFive"; -- From board definition
hifive1_uart_root : constant := 268513280; -- From board definition
qemu_sifive_test_exit : constant Boolean := True; -- From board definition
end ADL_Config;
65 changes: 61 additions & 4 deletions boards/HiFive1/src/zfp/crt0.S
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
/*********/
/* .data */
/*********/
.section .data.argv
argv_str:
.ascii "main\0"

.align 4
argv:
.word argv_str
.word 0

/**********/
/* _start */
/**********/
Expand All @@ -13,6 +25,7 @@ _start:
.option pop
la sp, __stack_end


/* Load data section */
.type _startup_copy_data,@function
_startup_copy_data:
Expand Down Expand Up @@ -43,22 +56,66 @@ _startup_clear_bss:
2:
.size _startup_clear_bss, . - _startup_clear_bss


/* Call static constructors */
.weak __libc_init_array
la t0, __libc_init_array
beq t0, zero, .skip_libc_init
jalr t0
.skip_libc_init:

/* Call main, with argc, argv */
la a0, 1
la a1, argv
call main

/* Save main's return value */
mv t0, a0

/* static destructors */
.weak __libc_fini_array
la t0, __libc_fini_array
beq t0, zero, .skip_libc_fini
jalr t0
.skip_libc_fini:

/* Restore main's return value */
mv a0, t0

call __gnat_exit
2: j 2b




.globl __gnat_exit
.type __gnat_exit,@function
.globl _abort
.type abort,@function
abort:
__gnat_exit:

/* Use ebreak on RISC-V32 until QEMU is updated to 4.0 */
ebreak
/* Write to the SiFive Test device on QEMU to shutdown */
li t0, 0x5555
li t1, 0x100000
sw t0, (t1)

j __gnat_exit

/* Weak alias _exit to __gnat_exit */
.weak _exit
.set _exit,__gnat_exit
.set _exit,__gnat_exit


.globl putchar
.type putchar,@function
putchar:
li t1, 268513280
li t1, 0x10013000
li t2, 0x80000000
.loop:
lw t3, 0(t1)
and t3, t3, t2
bnez t3, .loop

sb a0, 0(t1)
ret
55 changes: 49 additions & 6 deletions boards/HiFive1/src/zfp/link.ld
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

/* This is a RISC-V specific version of this file */

_DEFAULT_STACK_SIZE = 2*1024;
_DEFAULT_STACK_SIZE = 0x1000;

OUTPUT_ARCH("riscv")

Expand All @@ -14,21 +15,63 @@ MEMORY

SECTIONS
{
/***************/
/* board_flash */
/***************/
.text :
{
KEEP (*(SORT_NONE(.start)))
*(.text .text.* .gnu.linkonce.t*)
*(.gnu.warning)
} > board_flash

.eh_frame_hdr :
{
*(.eh_frame_hdr)
} > board_flash

.eh_frame :
{
__EH_FRAME__ = .;
KEEP(*(.eh_frame))
LONG(0);
} > board_flash

.gcc_except_table :
{
*(.gcc_except_table .gcc_except_table.*)
} > board_flash

.init_array :
{
PROVIDE_HIDDEN (__init_array_start = .);
KEEP (*(SORT(.init_array.*)))
KEEP (*(.init_array*))
PROVIDE_HIDDEN (__init_array_end = .);
} > board_flash

.fini_array :
{
PROVIDE_HIDDEN (__fini_array_start = .);
KEEP (*(SORT(.fini_array.*)))
KEEP (*(.fini_array*))
PROVIDE_HIDDEN (__fini_array_end = .);
} > board_flash

.rodata :
{
*(.rdata)
*(.rodata .rodata.* .gnu.linkonce.r*)
. = ALIGN(0x4);
__rom_end = .;
} > board_flash

} > board_flash
/**********************/
/* End of board_flash */
/**********************/

/*******/
/* RAM */
/*******/
.data :
{
__data_start = .;
Expand Down Expand Up @@ -63,8 +106,6 @@ SECTIONS
*/
__data_load = LOADADDR(.data);



.bss (NOLOAD): {
. = ALIGN(0x8);
__bss_start = .;
Expand All @@ -91,8 +132,10 @@ SECTIONS
__heap_end = ORIGIN(RAM) + LENGTH(RAM);
__bss_end = .;
} > RAM

__bss_words = (__bss_end - __bss_start) >> 2;
/**************/
/* End of RAM */
/**************/

/* DWARF debug sections.
Symbols in the DWARF debugging sections are relative to the beginning
Expand Down
32 changes: 18 additions & 14 deletions boards/HiFive1_rev_B/hifive1_rev_b_zfp.gpr
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ library project HiFive1_rev_B_ZFP is

Linker_Switches := ("-T", Project'Project_dir & "/src/zfp/link.ld");
for Target use "riscv32-elf";
for Runtime ("Ada") use "zfp-rv32imc";
for Runtime ("Ada") use "zfp-rv32imac";

package Device_Configuration is
for CPU_Name use "RISC-V32";
Expand All @@ -79,27 +79,31 @@ library project HiFive1_rev_B_ZFP is
for Size ("RAM") use "16K";

for Boot_Memory use "board_flash";
for User_Tag ("hifive1_uart_root") use "268513280";
for User_Tag ("qemu_sifive_test_exit") use "True";
end Device_Configuration;

Vendor := "SiFive"; -- From board definition
Max_Mount_Points := "2"; -- From default value
Architecture := "RISC-V"; -- From board definition
Board := "HiFive1_rev_B"; -- From command line
Boot_Memory := "board_flash"; -- From default value
Max_Mount_Name_Length := "128"; -- From default value
Runtime_Profile := "zfp"; -- From command line
Device_Name := "FE310"; -- From board definition
CPU_Core := "RISC-V32"; -- From mcu definition
Device_Family := "FE3"; -- From board definition
Has_Ravenscar_SFP_Runtime := "False"; -- From board definition
Runtime_Name := "zfp-rv32imc"; -- From default value
Device_Name := "FE310"; -- From board definition
Has_Custom_Memory_Area_1 := "False"; -- From default value
Has_Ravenscar_Full_Runtime := "False"; -- From board definition
CPU_Core := "RISC-V32"; -- From mcu definition
Board := "HiFive1_rev_B"; -- From command line
Has_Ravenscar_SFP_Runtime := "False"; -- From board definition
Has_ZFP_Runtime := "True"; -- From board definition
Max_Mount_Name_Length := "128"; -- From default value
Max_Mount_Points := "2"; -- From default value
Max_Path_Length := "1024"; -- From default value
Number_Of_Interrupts := "0"; -- From default value
Has_Custom_Memory_Area_1 := "False"; -- From default value
Runtime_Name := "zfp-rv32imac"; -- From default value
Runtime_Name_Suffix := "rv32imac"; -- From board definition
Runtime_Profile := "zfp"; -- From command line
Use_Startup_Gen := "True"; -- From command line
Max_Path_Length := "1024"; -- From default value
Runtime_Name_Suffix := "rv32imc"; -- From board definition
Architecture := "RISC-V"; -- From board definition
Vendor := "SiFive"; -- From board definition
hifive1_uart_root := "268513280"; -- From board definition
qemu_sifive_test_exit := "True"; -- From board definition

-- Project source directories
Src_Dirs_Root := "../..";
Expand Down
Loading

0 comments on commit 0ccb49f

Please sign in to comment.