From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Ravenscar-sfp and interrupt priorities on Cortex-M4 Date: Fri, 13 Feb 2015 10:06:57 +0000 Organization: A noiseless patient Spider Message-ID: References: <6c8a59ee-d011-4d9f-999b-54cb0d7cf40a@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="4eba6dd55c03f4a8d448cad2a88d67ef"; logging-data="29779"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/NAC1KzvWDFnpJpgGmd1olRcTg9NAzf3w=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (darwin) Cancel-Lock: sha1:jfHuZwQ+dhmRQ0UAA7jb+/1ggkw= sha1:/fO6tV++r1jO8OMueARqtG34cj8= Xref: news.eternal-september.org comp.lang.ada:24956 Date: 2015-02-13T10:06:57+00:00 List-Id: Patrick Noffke 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.