diff --git a/src/lv6MainArgs.ml b/src/lv6MainArgs.ml
index 9bdb880608c36139bdb74af41211dea5025cf141..c2dec7b6bb9b8dcbfe3e4be72e232228dd064991 100644
--- a/src/lv6MainArgs.ml
+++ b/src/lv6MainArgs.ml
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 20/03/2015 (at 14:40) by Erwan Jahier> *)
+(* Time-stamp: <modified the 23/03/2015 (at 15:37) by Erwan Jahier> *)
 (*
 Le manager d'argument adapté de celui de lutin, plus joli
 N.B. solution un peu batarde : les options sont stockées, comme avant, dans Global,
@@ -377,7 +377,7 @@ let mkoptab (opt:t) : unit = (
     mkopt opt ~hide:true
       ["--2c-wcet";"-2cw7"]
       (Arg.Unit (fun i -> opt.gen_c <- true; opt.gen_wcet <- true))
-      ["generates a main file for computing wcet. (forces -2c)"]
+      ["generates a main file for computing the wcet. (forces -2c)"]
     ;
 
     mkopt opt ~hide:true
@@ -415,7 +415,7 @@ let mkoptab (opt:t) : unit = (
     mkopt opt ~hide:true
       ["--2c-no-switch"]
       (Arg.Unit (fun () -> global_opt.soc2c_no_switch <-true))
-      ["Use if-then-else instead of switch when generating C codes"]
+      ["Use if-then-else instead of switches when generating C codes"]
     ;
     mkopt opt ~hide:true
       ["-interface"]
diff --git a/src/soc2c.ml b/src/soc2c.ml
index 12bb9ec64642ad2c9eed12dc5cc7968022e85321..5a42dfe5ac19ed4199f5711b82111d048f7c081d 100644
--- a/src/soc2c.ml
+++ b/src/soc2c.ml
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 20/03/2015 (at 15:54) by Erwan Jahier> *)
+(* Time-stamp: <modified the 24/03/2015 (at 09:38) by Erwan Jahier> *)
 
 
 (* let put (os: out_channel) (fmt:('a, unit, string, unit) format4) : 'a = *)
@@ -385,7 +385,7 @@ int main(){" ^ (
   " ^ (if SocUtils.is_memory_less soc then ctx^"_type* ctx = &"^ctx^";\n"
     else ctx^"_type* ctx = "^ ctx^"_new_ctx(NULL);")
         )
-        | Lv6MainArgs.HeapStack -> ("
+        | Lv6MainArgs.Heap | Lv6MainArgs.HeapStack -> ("
           /* Context allocation */
   " ^ (if SocUtils.is_memory_less soc then ctx^""
     else ctx^"_type* ctx ;\n"^ ctx^"_reset(ctx);")
@@ -393,16 +393,26 @@ int main(){" ^ (
     ));
     let inputs_fmt  = List.map (fun (_,t) -> type_to_format_string t) inputs_io in
     let outputs_fmt = List.map (fun (_,t) -> type_to_format_string t) outputs_io in
-    if io_transmit_mode () = Lv6MainArgs.Stack 
-    then
-      let i =  fst (List.split inputs) in
-      let o = List.map (fun (n,t) -> match t with Data.Array(_,_) -> n | _ ->"&"^n) outputs in
-      let io = String.concat "," (i@o) in
-      let io = if SocUtils.is_memory_less soc then io else if io = "" then "ctx" else io^",ctx" in
-      putc ("  " ^ step^"("^io^");
+    (match io_transmit_mode () with
+      | Lv6MainArgs.Stack ->
+        let i =  fst (List.split inputs) in
+        let o = List.map (fun (n,t) -> match t with Data.Array(_,_) -> n | _ ->"&"^n) outputs in
+        let io = String.concat "," (i@o) in
+        let io = if SocUtils.is_memory_less soc then io else if io = "" then "ctx" else io^",ctx" in
+        putc ("  " ^ step^"("^io^");
   return 0; 
 }
-");
+"
+        );
+      | Lv6MainArgs.HeapStack -> assert false
+      | Lv6MainArgs.Heap ->
+        let io = if SocUtils.is_memory_less soc then  "" else "ctx"  in
+        putc ("  " ^ step^"("^io^");
+  return 0; 
+}
+"
+        );
+    );
     close_out oc
 
 
@@ -697,20 +707,28 @@ typedef float _float;
     Printf.printf "%s has been generated.\n" loopfile;
     Printf.printf "%s has been generated.\n" hfile; 
     Printf.printf "%s has been generated.\n" cfile;
-
+    flush stdout;
     let execfile = if args.Lv6MainArgs.outfile = "" then "a.out" 
       else args.Lv6MainArgs.outfile 
     in
+    let main_file,gcc = 
+      if args.Lv6MainArgs.gen_wcet then base^"_main.c","arm-elf-gcc -O2" else loopfile,"gcc -O2"
+    in
     let gcc =
       if needs_cfile then 
-        Printf.sprintf " gcc -o %s %s %s %s" execfile cfile ext_cfile loopfile 
+        Printf.sprintf "%s -o %s %s %s %s" gcc execfile cfile ext_cfile main_file
       else 
-        Printf.sprintf "gcc  -o %s %s %s"  execfile cfile loopfile 
+        Printf.sprintf "%s -o %s %s %s"  gcc execfile cfile main_file
+    in
+    let main_step = base^"_"^args.Lv6MainArgs.main_node^"_step" in
+    let gcc = if args.Lv6MainArgs.gen_wcet then
+        (gcc ^ " > owcet.out; owcet.arm "^execfile^ " --add-prop otawa::ilp::OUTPUT_PATH="^
+           main_step^".0.lp "^main_step^" 2>&1 | grep WCET")
+      else gcc
     in
     if args.Lv6MainArgs.launch_cc then (
-      if (Sys.command gcc)=0 then 
-        print_string ("sys call: '"^gcc^"' executed with success\n")
-      else
+      print_string (gcc^"\n\n"); flush stdout;
+      if (Sys.command gcc)=0 then () else
         print_string ("sys call: '"^gcc^"' failed\n")
     ) else
       print_string ("you can compile those files doing, e.g.,\n  "^gcc^"\n");
diff --git a/test/lus2lic.sum b/test/lus2lic.sum
index 907be215f1764f42bf72260a8adbb426b37573b4..8ab482ac96986bf1b3d1412e28469686b09d3fac 100644
--- a/test/lus2lic.sum
+++ b/test/lus2lic.sum
@@ -1,5 +1,5 @@
 ==> lus2lic0.sum <==
-Test Run By jahier on Fri Mar 20 17:38:52 
+Test Run By jahier on Mon Mar 23 17:51:45 
 Native configuration is x86_64-unknown-linux-gnu
 
 		=== lus2lic0 tests ===
@@ -63,7 +63,7 @@ XFAIL: Test bad programs (assert): test_lus2lic_no_node should_fail/assert/lecte
 XFAIL: Test bad programs (assert): test_lus2lic_no_node should_fail/assert/s.lus
 
 ==> lus2lic1.sum <==
-Test Run By jahier on Fri Mar 20 17:38:57 
+Test Run By jahier on Mon Mar 23 17:51:51 
 Native configuration is x86_64-unknown-linux-gnu
 
 		=== lus2lic1 tests ===
@@ -397,7 +397,7 @@ PASS: gcc -o multipar.exec multipar_multipar.c multipar_multipar_loop.c
 PASS: /home/jahier/lus2lic/test/../utils/compare_exec_and_2c multipar.lus  {}
 
 ==> lus2lic2.sum <==
-Test Run By jahier on Fri Mar 20 17:39:36 
+Test Run By jahier on Mon Mar 23 17:52:29 
 Native configuration is x86_64-unknown-linux-gnu
 
 		=== lus2lic2 tests ===
@@ -727,7 +727,7 @@ PASS: gcc -o zzz2.exec zzz2_zzz2.c zzz2_zzz2_loop.c
 PASS: /home/jahier/lus2lic/test/../utils/compare_exec_and_2c zzz2.lus  {}
 
 ==> lus2lic3.sum <==
-Test Run By jahier on Fri Mar 20 17:40:42 
+Test Run By jahier on Mon Mar 23 17:53:38 
 Native configuration is x86_64-unknown-linux-gnu
 
 		=== lus2lic3 tests ===
@@ -1230,7 +1230,7 @@ PASS: ./myec2c {-o multipar.c multipar.ec}
 PASS: /home/jahier/lus2lic/test/../utils/test_lus2lic_no_node multipar.lus {}
 
 ==> lus2lic4.sum <==
-Test Run By jahier on Fri Mar 20 17:41:22 
+Test Run By jahier on Mon Mar 23 17:54:14 
 Native configuration is x86_64-unknown-linux-gnu
 
 		=== lus2lic4 tests ===
@@ -1726,14 +1726,14 @@ PASS: /home/jahier/lus2lic/test/../utils/test_lus2lic_no_node zzz2.lus {}
 # of unexpected failures	3
 ===============================
 # Total number of failures: 14
-lus2lic0.log:testcase ./lus2lic.tests/test0.exp completed in 4 seconds
+lus2lic0.log:testcase ./lus2lic.tests/test0.exp completed in 6 seconds
 lus2lic1.log:testcase ./lus2lic.tests/test1.exp completed in 38 seconds
-lus2lic2.log:testcase ./lus2lic.tests/test2.exp completed in 66 seconds
-lus2lic3.log:testcase ./lus2lic.tests/test3.exp completed in 38 seconds
-lus2lic4.log:testcase ./lus2lic.tests/test4.exp completed in 75 seconds
+lus2lic2.log:testcase ./lus2lic.tests/test2.exp completed in 67 seconds
+lus2lic3.log:testcase ./lus2lic.tests/test3.exp completed in 35 seconds
+lus2lic4.log:testcase ./lus2lic.tests/test4.exp completed in 70 seconds
 * Ref time: 
-0.03user 0.02system 3:45.26elapsed 0%CPU (0avgtext+0avgdata 5064maxresident)k
-160inputs+0outputs (0major+5534minor)pagefaults 0swaps
+0.02user 0.03system 3:39.59elapsed 0%CPU (0avgtext+0avgdata 5100maxresident)k
+160inputs+0outputs (0major+5553minor)pagefaults 0swaps
 * Quick time (-j 4):
-0.03user 0.02system 1:32.47elapsed 0%CPU (0avgtext+0avgdata 5104maxresident)k
-160inputs+0outputs (0major+5590minor)pagefaults 0swaps
+0.04user 0.01system 1:33.69elapsed 0%CPU (0avgtext+0avgdata 5140maxresident)k
+160inputs+0outputs (0major+5557minor)pagefaults 0swaps
diff --git a/test/lus2lic.time b/test/lus2lic.time
index 97ffa235afd87ead578b03f595b65cd8d299c46a..0a605147b12f39c9265d91575ac91acc1f8daf38 100644
--- a/test/lus2lic.time
+++ b/test/lus2lic.time
@@ -1,11 +1,11 @@
-lus2lic0.log:testcase ./lus2lic.tests/test0.exp completed in 4 seconds
+lus2lic0.log:testcase ./lus2lic.tests/test0.exp completed in 6 seconds
 lus2lic1.log:testcase ./lus2lic.tests/test1.exp completed in 38 seconds
-lus2lic2.log:testcase ./lus2lic.tests/test2.exp completed in 66 seconds
-lus2lic3.log:testcase ./lus2lic.tests/test3.exp completed in 38 seconds
-lus2lic4.log:testcase ./lus2lic.tests/test4.exp completed in 75 seconds
+lus2lic2.log:testcase ./lus2lic.tests/test2.exp completed in 67 seconds
+lus2lic3.log:testcase ./lus2lic.tests/test3.exp completed in 35 seconds
+lus2lic4.log:testcase ./lus2lic.tests/test4.exp completed in 70 seconds
 * Ref time: 
-0.03user 0.02system 3:45.26elapsed 0%CPU (0avgtext+0avgdata 5064maxresident)k
-160inputs+0outputs (0major+5534minor)pagefaults 0swaps
+0.02user 0.03system 3:39.59elapsed 0%CPU (0avgtext+0avgdata 5100maxresident)k
+160inputs+0outputs (0major+5553minor)pagefaults 0swaps
 * Quick time (-j 4):
-0.03user 0.02system 1:32.47elapsed 0%CPU (0avgtext+0avgdata 5104maxresident)k
-160inputs+0outputs (0major+5590minor)pagefaults 0swaps
+0.04user 0.01system 1:33.69elapsed 0%CPU (0avgtext+0avgdata 5140maxresident)k
+160inputs+0outputs (0major+5557minor)pagefaults 0swaps