[En-Nut-Discussion] [r5282] Added context_fpu.c for cm3

bon at elektron.ikp.physik.tu-darmstadt.de bon at elektron.ikp.physik.tu-darmstadt.de
Tue Sep 10 11:02:25 CEST 2013

>>>>> "Michael" == Michael Fischer <fischermi at t-online.de> writes:

    Michael> Hello List, I have added a context_fpu.c but not fully
    Michael> tested. Please can someone check it too? I am not sure if
    Michael> fpscr, the Floating Point Status register must be saved too in
    Michael> case of a context switch.

    Michael> The context switch is still working, this was tested with
    Michael> CrossWorks for ARM. But I have not test it with floating point
    Michael> calculation in different threads.

    Michael> The file was checked in that someone can take a look too.
Hello Michael,

the inner working was not my subject so long, but on a first glance it looks
good. However it should not be a new file, but derived from
arch/cm3/os/context.c in two steps:
== first your correction, unrelated to the FPU work
@@ -110,11 +129,16 @@
 void NutThreadSwitch(void)
     /* Save CPU context. */
-    asm volatile (                      /* */
+    __asm__ volatile (                  /* */


      * Setup the switch frame.
+    memset(sf, 0x00, sizeof(SWITCHFRAME)); 
== then your FPU work, perhaps guarded by some configuration option like
     "CONTEXT_FPU" or some better name and that option available the

That way the history for the file is preserved.

Do you have some idea about the impact of the FPU register saving with
regard to the thread switch time?

Otherwise, please also read README.contributing about the svn:eol-style
attribute "native". Your files are checked in with CR/LF line ending.

Uwe Bonnes                bon at elektron.ikp.physik.tu-darmstadt.de

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------

More information about the En-Nut-Discussion mailing list