<div dir="ltr"><div dir="ltr">Hi,<div>we ran those tests and they all passed.</div><div><br></div><div>I was debugging to follow what's going on with the state of the task in _Event_Seize and</div><div>when trying to step over _Thread_Dispatch_enable( cpu_self ) call at the end of the function I got this in the debugger</div><div><p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US"><br></span></p><p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US">0x80acf38->_Heap_Walk->_Heap_Walk_check_control->_Heap_Walk_check_free_list->_Thread_Handler->_CPU_Thread_Idle_body</span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US">heapwalk.c:331->heapwalk.c:240->heapwalk.c:105->threadhandler.c:95->armv7-thread-idle.c:33</span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US"> </span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US"> </span><span style="font-size:11pt">    if ( free_block->prev != prev_block ) {</span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US">     
(*printer)(</span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US">       
source,</span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US">       
true,</span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US">       
"free block 0x%08x: invalid previous block 0x%08x\n",</span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US">       
free_block,</span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US">       
free_block->prev</span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US">    
 );</span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US"> </span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US">     
return false;</span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US">   
}</span></p><p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US"><br></span></p><p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US">what does that mean? is this a memory corruption of some kind ?</span></p><p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US">it seems the message </span>"free block 0x%08x: invalid previous block 0x%08x\n" is printed somewhere, but I don't know</p><p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">how to see these messages in RTEMS, is there a command like dmesg in Linux ?</p><p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><br></p></div><div>regards,</div><div>Catalin</div><div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Oct 9, 2018 at 10:00 AM Sebastian Huber <<a href="mailto:sebastian.huber@embedded-brains.de">sebastian.huber@embedded-brains.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 09/10/2018 08:48, Catalin Demergian wrote:<br>
> Hi,<br>
> I put more debugging effort into this.<br>
><br>
> I think it's all about the Wait.flags value when the ISR is arriving.<br>
> For Wait.flags=BLOCKED or Wait.flags=INTEND_TO_BLOCK things are working<br>
> (yes, _Thread_Unblock is called from _Event_Seize properly), but when <br>
> Wait.flags=READY<br>
> things don't work because the conditions in if block <br>
> from _Event_Surrender are not met and<br>
> nobody calls _Thread_Unblock; even if more ISRs arrive, Wait.flags <br>
> remains READY and the<br>
> thread is not put on the CPU anymore.<br>
><br>
> 1. how can Wait.flags be READY before the ISR is arriving ?<br>
<br>
The wait flag name is THREAD_WAIT_STATE_READY_AGAIN. This is a state <br>
after a blocking operation. Such a thread is ready and either executes <br>
or the scheduler decided that it is not important enough and a higher <br>
priority thread executes.<br>
<br>
> 2. on the else of the if block I tried to put unblock=true to unblock <br>
> my task<br>
>   if (<br>
>     _Event_Is_blocking_on_event( the_thread, wait_class )<br>
>       && _Event_Is_satisfied( the_thread, pending_events, &seized_events )<br>
>   ) {<br>
> , I did see _Thread_Unblock called, but in _Thread_Clear_state <br>
> _Scheduler_Unblock was not called<br>
> because the_thread->current_state = 0.<br>
> do I have to set something else besides unblock=true to unblock my task ?<br>
<br>
I am not sure if this is really the problem area indicated by the failed <br>
assertion in one of your previous e-mails:<br>
<br>
assertion "first != _Chain_Tail( &ready_queues[ index ] )" failed: file <br>
"../../cpukit/../../../stm32f7/lib/include/rtems/score/schedulerpriorityimpl.h", <br>
line 166, function: _Scheduler_priority_Ready_queue_first<br>
<br>
This assertion tells you that the scheduler data structures are corrupt. <br>
The thread wait flags are a different domain.<br>
<br>
There are tests which specifically test the event send/receive conditions:<br>
<br>
testsuites/sptests/spintrcritical10<br>
testsuites/sptests/spintrcritical11<br>
testsuites/sptests/spintrcritical18<br>
testsuites/sptests/spintrcritical21<br>
<br>
I would run at least these tests on your board. I normally run all tests <br>
during a BSP development.<br>
<br>
-- <br>
Sebastian Huber, embedded brains GmbH<br>
<br>
Address : Dornierstr. 4, D-82178 Puchheim, Germany<br>
Phone   : +49 89 189 47 41-16<br>
Fax     : +49 89 189 47 41-09<br>
E-Mail  : <a href="mailto:sebastian.huber@embedded-brains.de" target="_blank">sebastian.huber@embedded-brains.de</a><br>
PGP     : Public key available on request.<br>
<br>
Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.<br>
<br>
</blockquote></div>