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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.236.23.74 with SMTP id u50mr15950233yhu.13.1432983007999; Sat, 30 May 2015 03:50:07 -0700 (PDT) X-Received: by 10.140.98.138 with SMTP id o10mr182372qge.33.1432983007959; Sat, 30 May 2015 03:50:07 -0700 (PDT) Path: buffer1.nntp.dca1.giganews.com!border1.nntp.dca1.giganews.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!z60no4639174qgd.1!news-out.google.com!k20ni45025qgd.0!nntp.google.com!z60no4639172qgd.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sat, 30 May 2015 03:50:07 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=105.237.62.132; posting-account=orbgeAkAAADzWCTlruxuX_Ts4lIq8C5J NNTP-Posting-Host: 105.237.62.132 References: <9ad1fcdc-cdf9-4ff0-aa7e-051d53b6736a@googlegroups.com> <7d56e720-5e91-4950-b4ae-29d7ddbdc11a@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <2d9213b2-dc45-4ace-be1b-0436bfa43690@googlegroups.com> Subject: Re: longest path through a task From: jan.de.kruyf@gmail.com Injection-Date: Sat, 30 May 2015 10:50:07 +0000 Content-Type: text/plain; charset=ISO-8859-1 Xref: number.nntp.giganews.com comp.lang.ada:193400 Date: 2015-05-30T03:50:07-07:00 List-Id: On Friday, May 29, 2015 at 6:31:27 PM UTC+2, Simon Wright wrote: > > > Just did some measurements (clumsily) using the Cortex-M4 counter as > > in [1], and from entering the Ada handler to the triggered task > > starting to execute averaged at 1200 cycles (6.7 us) with -Og, 1070 > > cycles (5.9 us) with -O2. There is some code in the C handler to > > redirect to the Ada handler: see [2], starting at line 236. > > The code in the C handler takes 150 cycles. > > So, for my FreeRTOS-based RTS, interrupt to Ada handler is 150 cycles, > Ada handler to task is 1200 cycles, grand total 1350 cycles or 7.5 > microseconds (core clock 180 MHz). > > I understand that a 1-millisecond tick is inadequate for some control > applications (though the Crazyflie seems to do OK with FreeRTOS); maybe > one could use one of the other timers on the STM32F4 to act as the basis > for the hard control loop, while retaining the Ada tasking for less > demanding aspects? Yes a person can, You can also modify the runtime. it is in bbbosu.adb: ----------------------- -- Sys_Tick Handling -- ----------------------- -- We use the Sys_Tick timer as a periodic timer with 1 kHz rate. This -- is a trade-off between accurate delays, limited overhead and maximum -- time that interrupts may be disabled. Tick_Period : constant Timer_Interval := Clock_Frequency / 1000; ----------------- But from too much looking at that code I got squint eyes ;) In any case based on that comment and my experience I thought I will construct a single thread multitask environment, which is easy. The programming for a novice will be a bit more complex especially when you have hard deadlines. It is basically just a choice. I did find a write-up from Brega on the Xoberon runtime, I am still looking for the code. In any case they did have multi-threading but mixed it with hard task dead times, and some more tricks, quite a feat. Now back to my kernel module, I am making good progress, but it is hairy, at least if you want to have any runtime at all. And I cant use gnat for linking either. So I do every step by hand. cheers, j.