Re: Cortex-M3 failing certain kernel tests

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: Cortex-M3 failing certain kernel tests

David Fernandez
I found a similar problem. Seems that the tests expect 10ms tick period
to be configured.

I made a patch for that, using a couple of conversion functions
to/from ticks from/to time that were available in the test code, or maybe
in some ecos code... I'll have to check that, to avoid dependency with the
timer tick.

Seems that there is nobody attending the list that would look
into submitting patches this days, so I'll see if I can put together the
mods I did for this thing this monday and post them on the list.

Regards.
David Fernandez

Enviado con Aquamail para Android
http://www.aqua-mail.com



--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

Reply | Threaded
Open this post in threaded view
|

Re: Cortex-M3 failing certain kernel tests

Grant Edwards-6
On 2013-09-28, David Fernandez <[hidden email]> wrote:

> I found a similar problem. Seems that the tests expect 10ms tick period
> to be configured.
>
> I made a patch for that, using a couple of conversion functions
> to/from?ticks from/to time that were available in the test code, or
> maybe in some?ecos code... I'll have to check that, to avoid
> dependency with the timer?tick.
>
> Seems that there is nobody attending the list that would look
> into?submitting patches this days, so I'll see if I can put together
> the mods I?did for this thing this monday and post them on the list.

When I have some spare time, I was going to try to fix the CDL so that
the "picky" tests would only be built when the requirements for the
test were met.  I'm probably not going to have time to work on that
for some weeks....

--
Grant


--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

Reply | Threaded
Open this post in threaded view
|

Re: Cortex-M3 failing certain kernel tests

David Fernandez
In reply to this post by David Fernandez
Grant,

This is what I did for pmutex3.c which has the same problem. I did not
found the same problem in kmutex3.c... may be it was kind of fixed in
the cvs pulled version I'm using.

Nevertheless, this should be kind of generic, the conversion functions
come from posix private code in ecos, but they can be put as test
helper code using other than timespec for normal kernel tests.

I've used a macro that can be replaced with an expression of the
numerator and denominator time tick parameters, to use the
"simplified" code when the tick is set to 10ms, but I guess that
having conversion functions is better.

$ cvs diff -U5 packages/compat/posix/current/tests/pmutex3.c
Index: packages/compat/posix/current/tests/pmutex3.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/compat/posix/current/tests/pmutex3.c,v
retrieving revision 1.2
diff -U 5 -r1.2 pmutex3.c
--- packages/compat/posix/current/tests/pmutex3.c       29 Jan 2009
17:47:52 -0000     1.2
+++ packages/compat/posix/current/tests/pmutex3.c       30 Sep 2013
12:03:27 -0000
@@ -58,10 +58,14 @@
 #ifdef CYGPKG_ISOINFRA
 # include <sys/types.h>
 # include <pthread.h>
 # include <semaphore.h>
 # include <time.h>
+typedef cyg_uint64      cyg_tick_count;
+externC void cyg_ticks_to_timespec( cyg_tick_count ticks, struct
timespec *tp );
+externC cyg_tick_count cyg_timespec_to_ticks( const struct timespec *tp,
+                                              cyg_bool roundup);
 # include <unistd.h>
 #endif

 #if !defined(CYGPKG_POSIX_PTHREAD)
 #define NA_MSG "POSIX threads not enabled"
@@ -332,11 +336,15 @@
     // better, so that is what we will do.  Must be a busy-wait.
     then = cyg_current_time();
     do {
         now = cyg_current_time();
         // Wait longer than the delay in t3 waiting on go_flag
+#if     defined(CYGOPT_POSIX_MUTEX3_10MS_DELAY)
+    } while ( now < (then + cyg_timespec_to_ticks(&sleeptime, false)) );
+#else /*defined(CYGOPT_POSIX_MUTEX3_10MS_DELAY)*/
     } while ( now < (then + 3) );
+#endif/*defined(CYGOPT_POSIX_MUTEX3_10MS_DELAY)*/

 #ifdef _POSIX_THREAD_PRIO_INHERIT
     CYG_TEST_INFO( "Checking for mutex priority inheritance" );
     CYG_TEST_CHECK( 1 == t3ran, "Thread 3 did not run" );
     CYG_TEST_CHECK( 1 == got_it, "Thread 1 did not get the mutex" );
@@ -418,12 +426,16 @@
     // Emulate resume behaviour
     sem_wait( &hold[id] );
     if( all_exit ) return 0;

     // one tick sleep time
+#if     defined(CYGOPT_POSIX_MUTEX3_10MS_DELAY)
     sleeptime.tv_nsec = 10000000;
     sleeptime.tv_sec = 0;
+#else /*defined(CYGOPT_POSIX_MUTEX3_10MS_DELAY)*/
+    cyg_ticks_to_timespec(1, &sleeptime);
+#endif/*defined(CYGOPT_POSIX_MUTEX3_10MS_DELAY)*/

     CYG_TEST_INIT();
     CYG_TEST_INFO( "Control Thread running" );

     // Go through the 27 possibilitied of resuming the extra threads

--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss