   ASSERT(file.write(msg, strlen(msg)) == (int) size);
   ASSERT(file.close());
   stop = RTC::millis();
+  ms = stop - start;
   trace << PSTR("Open/Write/Close file:");
-  trace << stop - start << PSTR(" ms") << endl;
+  trace << ms << PSTR(" ms") << endl;
+  trace.flush();
 
   // Reopen and read the message. Measure total time
   start = RTC::millis();
   ASSERT(file.open("NISSE.TXT", O_READ));
   ASSERT(file.is_open());
-  int c;
   while ((c = file.getchar()) != -1) trace << (char) c;
   ASSERT(file.close());
   stop = RTC::millis();
+  ms = stop - start;
   trace << PSTR("Open/Read/Close file:");
-  trace << stop - start << PSTR(" ms") << endl;
+  trace << ms << PSTR(" ms") << endl;
   trace << endl;
+  trace.flush();
 
   ASSERT(sd.end());
   ASSERT(true == false);

  // IOStream cout(&file);
  // cout.print((void*) NULL, 1024, IOStream::hex);
  stop = RTC::millis();
  trace << PSTR("Write file (") << K_BYTE << PSTR(" KByte):");
  trace << stop - start << PSTR(" ms") << endl;
  trace << endl;

  // Measure time to close a file
  start = RTC::millis();
  ASSERT(file.close());
  stop = RTC::millis();
  trace << PSTR("Close file:") << stop - start << PSTR(" ms") << endl;
  FAT16::ls(trace, FAT16::LS_DATE | FAT16::LS_SIZE);
  trace << endl;

  // Reopen the time and measure the time to read a smaller buffer (256 byte)
  ASSERT(file.open("TMP.TXT", O_READ));
  size = 0;
  start = RTC::millis();
  while ((count = file.read(buf, sizeof(buf))) > 0) size += count;
  // int c;
  // while ((c = file.getchar()) != -1) trace << (char) c;
  stop = RTC::millis();
  ASSERT(file.close());
  trace << PSTR("Read file (") << size / 1024 << PSTR(" KByte):");
  trace << stop - start << PSTR(" ms") << endl;
  trace << endl;

  // Remove the file and list
  start = RTC::millis();
  ASSERT(FAT16::rm("TMP.TXT"));
  stop = RTC::millis();
  trace << PSTR("Remove file:") << stop - start << PSTR(" ms") << endl;
  FAT16::ls(trace, FAT16::LS_DATE | FAT16::LS_SIZE);
  trace << endl;

  // Open a new file and write a short message. Measure total time
  start = RTC::millis();

#include "Cosa/Watchdog.hh"
#include "Cosa/Memory.h"

// #define USE_SD_ADAPTER
#define USE_SD_DATA_LOGGING_SHIELD
//#define USE_ETHERNET_SHIELD
//#define USE_TFT_ST7735

#if defined(WICKEDDEVICE_WILDFIRE) || defined(USE_SD_ADAPTER)
