From: Simon Wright <simon@pushface.org>
Subject: Re: silly ravenscar question
Date: Thu, 26 Feb 2015 14:57:10 +0000
Date: 2015-02-26T14:57:10+00:00 [thread overview]
Message-ID: <lyoaog3em1.fsf@pushface.org> (raw)
In-Reply-To: fcafdbca-be65-41ab-a437-7b616cbc1279@googlegroups.com
jan.de.kruyf@gmail.com writes:
> On Wednesday, February 25, 2015 at 7:50:17 PM UTC+2, Simon Wright wrote:
> Was it you that had read the Gnat spec for the STM34 x-compiler? About
> memory allocation and that? cause I did not find it.
In the gnat-gpl-2014-arm-elf-linux-bin.tar.gz look at
lib/gnat/arm-eabi/ravenscar-sfp-stm32f4/adainclude/s-memory.ads (as I've
said elsewhere, what an odd place to find it!)
> I had a first look at the zfp package. Do you know what would be
> missing in the language there?
My equivalent has
pragma Restrictions (No_Allocators);
pragma Restrictions (No_Delay);
pragma Restrictions (No_Dispatch);
pragma Restrictions (No_Enumeration_Maps);
pragma Restrictions (No_Exception_Propagation);
pragma Restrictions (No_Finalization);
pragma Restrictions (No_Implicit_Dynamic_Code);
pragma Restrictions (No_Protected_Types);
pragma Restrictions (No_Recursion);
pragma Restrictions (No_Secondary_Stack);
pragma Restrictions (No_Tasking);
> Because the interrupt latencies in the Ravenscar implementation are
> NOT pleasant. Adacore has long and involved things before we get to
> the handler.
My version has the Cortex handler registered as an invocation of my
dummy_handler macro:
/* Pointer to the interrupt handler wrapper created by Ada; the
'object' is the actual PO. */
typedef void (*handler_wrapper)(void *object);
/* Array, to be indexed from Ada as Interrupt_ID (0 .. 90), of handler
wrappers. The index values also match IRQn_Type, in
$CUBE/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f429xx.h.
Called from the weak IRQ handlers defined below if not null.
The Ada side will register handlers here; see
System.Interupts.Install_Restricted_Handlers. */
handler_wrapper _gnat_interrupt_handlers[91] = {0, };
/* Parallel array containing the actual parameter to be passed to the
handler wrapper.
Implemented as parallel arrays rather than array of structs to be
sure that interrupt_handlers[] is initialized. */
void * _gnat_interrupt_handler_parameters[91] = {0, };
#define dummy_handler(name, offset) \
__attribute__((weak)) void name() \
{ \
if (_gnat_interrupt_handlers[offset]) { \
_gnat_interrupt_handlers[offset] \
(_gnat_interrupt_handler_parameters[offset]); \
} else { \
while (1) {}; \
} \
}
and the Ada handler (as reported by -gnatdg, and the same as for the
AdaCore RTS) is
procedure buttons__button__handlerP (_object : in out
buttons__buttonTV) is
begin
%push_constraint_error_label ()
%push_program_error_label ()
%push_storage_error_label ()
$system__tasking__protected_objects__single_entry__lock_entry (
_object._object'unchecked_access);
buttons__button__handlerN (_object);
$system__tasking__protected_objects__single_entry__service_entry
(_object._object'unchecked_access);
%pop_constraint_error_label
%pop_program_error_label
%pop_storage_error_label
return;
end buttons__button__handlerP;
I don't know how the % lines translate to code; for me, the Lock_Entry
call will find that we're in an ISR and do nothing; the HandlerN is the
code you wrote; and Service_Entry will check to see whether (the) entry
has been released and execute its code as well if so.
HTH!
next prev parent reply other threads:[~2015-02-26 14:57 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-24 9:07 silly ravenscar question jan.de.kruyf
2015-02-24 10:29 ` Dmitry A. Kazakov
2015-02-24 11:11 ` jan.de.kruyf
2015-02-24 13:38 ` Dmitry A. Kazakov
2015-02-25 8:48 ` jan.de.kruyf
2015-02-25 10:46 ` Dmitry A. Kazakov
2015-02-25 17:35 ` jan.de.kruyf
2015-02-25 17:55 ` Dmitry A. Kazakov
2015-02-26 8:48 ` jan.de.kruyf
2015-02-26 9:47 ` Dmitry A. Kazakov
2015-02-26 12:07 ` jan.de.kruyf
2015-02-26 19:09 ` jan.de.kruyf
2015-02-27 8:58 ` Dmitry A. Kazakov
2015-02-28 19:57 ` jan.de.kruyf
2015-03-01 9:27 ` Dmitry A. Kazakov
2015-03-03 8:42 ` jan.de.kruyf
2015-03-03 10:57 ` Dmitry A. Kazakov
2015-02-24 11:02 ` Jacob Sparre Andersen
2015-02-24 11:23 ` jan.de.kruyf
2015-02-24 13:43 ` Bob Duff
2015-02-25 9:07 ` jan.de.kruyf
2015-02-25 17:50 ` Simon Wright
2015-02-26 7:35 ` jan.de.kruyf
2015-02-26 14:57 ` Simon Wright [this message]
2015-02-26 19:36 ` jan.de.kruyf
2015-02-27 8:45 ` Simon Wright
2015-02-27 9:59 ` jan.de.kruyf
2015-02-28 9:57 ` Simon Wright
2015-02-28 19:08 ` jan.de.kruyf
2015-02-28 20:23 ` Simon Wright
2015-03-03 8:52 ` jan.de.kruyf
2015-02-24 15:30 ` Brad Moore
2015-02-24 16:52 ` Simon Wright
2015-02-25 3:01 ` Dennis Lee Bieber
2015-02-24 11:22 ` slos
2015-02-24 12:16 ` jan.de.kruyf
2015-02-24 11:24 ` J-P. Rosen
2015-02-24 12:10 ` jan.de.kruyf
2015-02-24 13:58 ` 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