comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Jensen <hanzer@riseup.net>
Subject: How to configure GNAT GPL on x86-64 Linux for ARM ELF development
Date: Wed, 23 May 2018 06:37:44 -0000 (UTC)
Date: 2018-05-23T06:37:44+00:00	[thread overview]
Message-ID: <pe327n$28f$1@dont-email.me> (raw)

Prologue:

I would like to tinker with Ada and Spark embedded real-time software 
development. I have these two books:

https://www.amazon.com/Concurrent-Real-Time-Programming-Alan-Burns/dp/
0521866979/
https://www.amazon.com/Analysable-Real-Time-Systems-Programmed-Ada/dp/
1530265509/

And these two books are on the way:

https://www.amazon.com/Building-Parallel-Embedded-Real-Time-Applications/
dp/0521197163/
https://www.amazon.com/Building-High-Integrity-Applications-SPARK/dp/
1107656842/

To start, I have a Nucleo-144 board with an STM32F429ZIT6 MCU. 

https://www.digikey.com/product-detail/en/stmicroelectronics/NUCLEO-
F429ZI/497-16280-ND/5806777

I have installed Adacore's Gnat GPL and SPARK Discovery on Ubuntu 18.04 
LTS in: 

$HOME/.local/gnat

And I've installed gnat-gpl-2017-arm-elf-linux-bin.tar.gz in:

$HOME/.local/gnat-arm

I am following this tutorial:

http://www.inspirel.com/articles/Ada_On_Cortex.html
-------------------------------------------------------------------------

The first example in that tutorial is:

#program.ads
package Program is

   procedure Run;
   pragma Export (C, Run, "run");

end Program;

# program.adb
package body Program is

   procedure Run is
   begin
      loop
         null;
      end loop;
   end Run;

end Program;

# flash.ld
OUTPUT_FORMAT("elf32-littlearm")
OUTPUT_ARCH(arm)

SECTIONS
{
    .vectors 0x08000000 :
    {
        LONG(0x20010000)
        LONG(run + 1)
        FILL(0)
    }

    .text 0x08000200 :
    {
        *(.text)
    }
}
-------------------------------------------------------------------------

Given:

PATH="$HOME/.local/gnat-arm/bin:$PATH"; export PATH

The tutorial suggests that maybe this (below) might produce a binary 
suitable to be loaded onto the MCU:

arm-eabi-gcc -c -mcpu=cortex-m4 -mthumb program.adb
arm-eabi-ld -T flash.ld -o program.elf program.o 
arm-eabi-objcopy -O binary program.elf program.bin

This is what actually happens:

$ arm-eabi-gcc -c -mcpu=cortex-m4 -mthumb program.adb
fatal error, run-time library not installed correctly
cannot locate file system.ads
compilation abandoned

I guess that the LD_LIBRARY_PATH and GPR_PROJECT_PATH environment 
variables should be set but I don't yet understand enough to make 
reasonable guesses. 

Any advice on how to proceed would be very much appreciated! 

             reply	other threads:[~2018-05-23  6:37 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-23  6:37 Adam Jensen [this message]
2018-05-23  8:07 ` How to configure GNAT GPL on x86-64 Linux for ARM ELF development Simon Wright
2018-05-24  7:35   ` Adam Jensen
2018-05-24 12:12     ` Brian Drummond
2018-05-25  4:45       ` Adam Jensen
2018-05-25 10:50         ` Brian Drummond
2018-05-26  5:06           ` Adam Jensen
2018-05-26 23:58             ` Brian Drummond
2018-05-27  8:26               ` Jacob Sparre Andersen
2018-05-30 19:52             ` JLotty
2018-05-30 21:58               ` Simon Wright
2018-06-03 23:21                 ` JLotty
2018-06-04  7:11                   ` Simon Wright
2018-05-25  3:29   ` Adam Jensen
2018-05-25  7:55     ` Simon Wright
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox