Hi,
I’ve written a small program which is targeting the embedded-stm32f429disco runtime and have come across an issue related to tasks accessing a protected object.
The details of the program aren’t too important for this I reckon (characters that get generated randomly from a task get printed into a minicom console via a series of daisy-chained USARTs) but consider the following:
task type Character_Stream with Priority => System.Max_Priority;
task type Character_Stream_Consumer with Priority => System.Max_Priority - 1;
task type USART_Consumer with Priority => System.Max_Priority - 2;
and then:
protected Buffer with Priority => System.Max_Priority is
procedure Put (C : Character ; OK : out Boolean);
procedure Get (C : out Character ; OK : out Boolean);
.........................................................................
.........................................................................
with Character_Stream and Character_Stream_Consumer both calling the Put and Get procedures respectively (the buffer is declared as a straight object than a type).
Now, the moment Character_Stream calls Put the program traps immediately and through some weird machinery of __gnat_last_chance_handler and local exception handling (allowed in Ravenscar) which can be the topic of a separate post, I managed to narrow this down to procedure Lock (Object : Protection_Access) inside System.Tasking.Protected_Objects in ./arm-eabi/lib/gnat/embedded-stm32f429disco/gnarl/s-taprob.adb:
where the explicit raise takes place.
But that conditional is for > and not for >= which as the comment above explains is perfectly fine, so the call from Character_Stream should be accepted, shouldn’t it?
Does the protected object need to be configured with a specific ceiling protocol or something like that?
Any thoughts? - Thanks!


