alire-project / GNAT-FSF-builds

Builds of the GNAT Ada compiler from FSF GCC releases
MIT License
32 stars 9 forks source link

gnat-riscv32-elf support? #48

Closed dinkelk closed 1 year ago

dinkelk commented 1 year ago

Do the gnat-riscv64-elf* releases only compile for 64-bit riscv? I think I am confused because I see references to 32-bit versions of the riscv ie.

$ ls gnat-riscv64-elf-linux64-12.2.0-1/riscv64-elf/lib
rv32i      rv32iac    rv32im     rv32imac   rv32imafc  etc...

Would gnat-riscv64-elf-linux64-12.2.0-1/bin/riscv64-elf-gcc also compile for a 32-bit rv32imac architecture given the correct compiler flags? If not, can a gnat-riscv32-elf release be made available that would support that?

JeremyGrosser commented 1 year ago

The riscv64 toolchain supports 32 bit targets as well. Some notes about this and other things I discovered with the ESP32C3: https://www.reddit.com/r/ada/comments/xsglin/october_2022_what_are_you_working_on/iqopzas

@Fabien-Chouteau commented there about bare_runtime, which sounds like the right approach.

dinkelk commented 1 year ago

Ah! Very interesting. Thank you.

I was also working on a "patch" to bb-runtimes to add support for a not-yet-supported riscv architecture. Do you know how the bare_runtime crate compares, and why that might be a better approach?

JeremyGrosser commented 1 year ago

With bare_runtime you set the architecture-specific gcc switches in alire.toml, rather than the RTS' runtime.xml. The bare_runtime README has some examples. I used bare_runtime for MSP430, you can see that here: https://github.com/JeremyGrosser/msp430test/blob/master/alire.toml#L22

dinkelk commented 1 year ago

That makes sense. Thank you Jeremy!