comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: Ravenscar-sfp and interrupt priorities on Cortex-M4
Date: Fri, 13 Feb 2015 10:06:57 +0000
Date: 2015-02-13T10:06:57+00:00	[thread overview]
Message-ID: <lyd25ektvi.fsf@pushface.org> (raw)
In-Reply-To: 6c8a59ee-d011-4d9f-999b-54cb0d7cf40a@googlegroups.com

Patrick Noffke <patrick.noffke@gmail.com> writes:

> I am porting the GNAT Ravenscar-sfp runtime to work with the TI TM4C
> MCU, using the STM32F4 implementation as a starting point.

Good stuff!

> The file system-xi-cortexm4-sfp.ads defines Interrupt_Priority range
> from 241 to 255, and this should be 249 to 255 for the TM4C MCU.
> Because the available range is processor-dependent, this file should
> probably be renamed to something like system-xi-stm32f4.ads and
> system-xi-tm4c.ads, etc., and the appropriate file selected in
> build-rts.sh.

I'm working with FreeRTOS (for STM32F4), which supports priorities from
0 to 7 out of the box. STM's Hardware Abstraction Layer disapproves of
applications using hardware interrupt priorities 4 .. 1 (4 for
SysTick_Handler), so I've mapped hardware interrupt priorities 15 .. 5
to Ada interrupt priorities 8 .. 18. I'm working on support for
different boards!

   Max_Priority           : constant Positive := 7;
   Max_Interrupt_Priority : constant Positive := 8 + (15 - 5);

   subtype Any_Priority       is Integer range 0 .. Max_Interrupt_Priority;
   subtype Priority           is Any_Priority
     range Any_Priority'First .. Max_Priority;
   subtype Interrupt_Priority is Any_Priority
     range Priority'Last + 1 .. Any_Priority'Last;

   Default_Priority : constant Priority :=
     (Priority'First + Priority'Last) / 2;

(Note, this is adapted from ARM 2012, rather than AdaCore's)

> I copied file s-bbbosu-stm32f4.adb to s-bbbosu-tm4c.adb and had to
> then change the To_PRI and To_Priority functions to multiply and
> divide by 32, respectively.

Which base distribution are you working with? Doesn't look like the GPL
one, which doesn't have any of the files you mention.

  reply	other threads:[~2015-02-13 10:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-12 20:38 Ravenscar-sfp and interrupt priorities on Cortex-M4 Patrick Noffke
2015-02-13 10:06 ` Simon Wright [this message]
2015-02-13 15:10   ` Patrick Noffke
2015-02-13 18:40     ` 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