comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: ANN: Cortex GNAT RTS 20180419
Date: Sun, 29 Apr 2018 12:50:59 +0100
Date: 2018-04-29T12:50:59+01:00	[thread overview]
Message-ID: <lytvrus02k.fsf@pushface.org> (raw)
In-Reply-To: 2000550e-44d7-4516-a2fb-1ebcaeecf985@googlegroups.com

Jere <jhb.chat@gmail.com> writes:

> On Saturday, April 28, 2018 at 12:13:14 PM UTC-4, Simon Wright wrote:
>> There are three parallel releases at Github[1], for
>>
>> * GNAT GPL 2016/GCC 6
>> * GCC 7
>> * GNAT GPL 2017
>>
>> (three, because of changes to the interface between the compiler and the
>> RTS).
>>
>> There's not much user-visible change from the last GCC 7 release[2],
>> except that all but 2k of free store is available for the heap (the 2k
>> is used for startup and interrupt stack).
>>
>> [1] https://github.com/simonjwright/cortex-gnat-rts/releases
>> [2] https://github.com/simonjwright/cortex-gnat-rts/releases/tag/r20171016
>
> Thank you so much for keeping these up to date.  Question:
> Do you have any suggestions for pulling out a ZFP from this repo?  I know
> it isn't setup for that, but was curious if you had any tips for what
> to mainly look for.  I'm not so much worried about changing the ada files,
> but I am more interested in what types of changes (if any) should I be
> looking to do to the ld file, the gpr file, the xml file, etc.  So mostly
> the build system.  I'm probably gonna try and mod the ardiuno one as it
> is closest to my chip (an M0+).  Right now, I have been pulling from one
> of your older revisions where the ZFP was still available.

One you haven't mentioned is system.ads.

The barebones site https://wiki.osdev.org/Ada_Bare_bones wants you to
put the restrictions in gnat.adc; personally I've put them in
system.ads, that way you don't need to worry about whether your own code
will see the restrictions.

The ld script will need changing to match your board's memory map; also,
maybe, the ENTRY symbol. Not sure about the EXTERNs either.

You'll need to change runtime.xml to specify the right compiler switches
(when I give GCC8 -mcpu=cortex-m0plus it adds -mfloat-abi=soft -mthumb
-march=armv6-m automatically (from inspection of the .ali)).

build_runtime.gpr clearly won't need to reference FreeRTOS! and the
Source_Dirs will clearly change.

> Also, 2 other questions:
> If I do get something working, do I use your licensing statement in the
> files as is, or should I modify it if I modify the files?  I do plan
> on modifying quite a few of the ada ones to fit with my chip, but I had
> noticed you seemed to use the vanilla FSF copyright in your license
> statement, even though I assume you wrote some of the code in the file.

I used the FSF copyright because I've assigned copyright to the FSF
(#1016382). If you change something, I believe you can add your
copyright, so long as you redistribute on the same terms.

> It looks like you most likely use gcc for some intrinsics like memcpy.
> Do I need to worry about licensing issues if I build with GNAT GPL 2017
> using a modified version of your RTS if it links in functions like memcpy?
> I can supply my own if so, they just won't be as efficient if I do.

libgcc is used for things such as long addition, multiplication etc not
supported by the hardware.

GCC uses functions normally supplied by libc as discussed in [1]. The
only part of the RTS that this affects is Startup, in

      --  Copy data to SRAM
      Data_In_Sram := Data_In_Flash;
      --  Initialize BSS in SRAM
      Bss := (others => 0);

(the second array assignment uses memset()).

You could change this to do byte-by-byte copy (AdaCore's RTSs do this in
assembly) but of course your own code (and even libgnat) might use the
libc functions (Interfaces.C uses memcpy), and there is no way I can see
to tell GCC not to do this.

Of course you could build your own, but I've got round this by using
newlib. ISTR writing up how to build newlib for GNAT GPL, but where...?
Anyway, I'm currently using newlib 2.5.0 and building as in [2]. I
_think_ the gpl branch would do the job. FYI, newlib works out what cpu
versions to build from the compiler capabilities, as reported by e.g.
arm-eabi-gcc -print-multi-lib.

[1] https://docs.adacore.com/gnathie_ug-docs/html/gnathie_ug/gnathie_ug/using_gnat_pro_features_relevant_to_high_integrity.html#array-and-record-assignments-and-the-high-integrity-profiles
[2] https://sourceforge.net/u/simonjwright/buildingarmeabi/code/ci/default/tree/


  reply	other threads:[~2018-04-29 11:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-28 16:13 ANN: Cortex GNAT RTS 20180419 Simon Wright
2018-04-28 21:01 ` Jere
2018-04-29 11:50   ` Simon Wright [this message]
2018-05-01 23:47     ` Jere
2018-05-02  8:10     ` 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