2

I have a running ARM CortexA9 board with FreeRTOS and I need to add a old and large library written in ADA. I have successfully generated the library and implemented it in the code but I'm struggling with some problems;

First off, what RTS profile are permitted with FreeRTOS between the following ?

  • zfp
  • Ravenscar_sfp
  • Ravenscar_full

1 Answers1

5

You’re proposing to use the GNAT CE 2019 arm-elf compiler to compile the Ada source (-mcpu=cortex-a9 is OK) & link the result with your non-ada code.

I don’t think you could use the AdaCore Ravenscar runtimes that come with that compiler, because they assume they are in charge of the board and run their own tasking/interrupt handling code, not FreeRTOS.

I’ve been maintaining a FreeRTOS-based runtime for some lower-end Cortex-M boards, which does support the Ravenscar profile, quite like the AdaCore sfp runtimes. I don’t think it’d be a huge amount of work to adapt it for your use case.

On the other hand, if your Ada code (and the Ada code it depends on) don’t involve tasking or rely on finalization or exceptions, you may well not need much in the way of runtime support; the zfp runtimes would act as a basis.

Simon Wright
  • 25,108
  • 2
  • 35
  • 62
  • Thank you Simon for your answer. In fact the Ada code is full of exceptions so at present the only profile that compiles without any warning is the Ravenscar_full. Is there a possibility to use exception with the ZFP profile? – marcoDiroccho Jan 14 '20 at 13:05
  • 1
    The only sorts of exceptions allowed with ZFP are (a) those that get handled in the same scope where they’re raised, or (b) those that never get raised. The second sort are those that are there for protection against bad conditions that you take care to make sure never happen. I ran `arm-eabi-gnatbind` on a very simple package using `ravenscar-full-stm32f4`, it called in a **lot** of tasking -related stuff from the RTS. Whether that would stop it actually running is a different matter – Simon Wright Jan 14 '20 at 16:55
  • The concern is that handling an exception has (in general) to take account of possible impacts on tasking, which may involve e.g. suspending interrupts; also impacts on finalization. This all makes exception handing a PITA for compiler/RTS builders – Simon Wright Jan 14 '20 at 17:25