   uint32_t us = RTC::micros() - start;
   ASSERT(flash.is_ready());
   ASSERT(res == sizeof(data));
-  trace << PSTR("write: dest = ") << addr 
+  trace << PSTR("write: dest = ") << hex << addr 
 	<< PSTR(", bytes = ") << sizeof(data)
 	<< PSTR(", us = ") << us 
 	<< PSTR(", Kbyte/s = ") << 1000.0 * sizeof(data) / us

	<< endl;

  // Read a block from the flash; measure time
  uint8_t buf[256];
  static uint32_t src = 0L;
  uint32_t start = RTC::micros();
  int res = flash.read(buf, src, sizeof(buf));

  start = RTC::micros();
  res = flash.write(addr, buf, sizeof(buf));
  us = RTC::micros() - start;
  ASSERT(res == sizeof(buf));
  trace << PSTR("write: dest = ") << hex << addr 
	<< PSTR(", bytes = ") << sizeof(buf)
	<< PSTR(", us = ") << us 
	<< PSTR(", Kbyte/s = ") << 1000.0 * sizeof(buf) / us
	<< endl;
  SLEEP(5);

  // Locate end of file in first sector; binary search
  start = RTC::micros();
  uint16_t bit = 0x8000;
  uint32_t last = 0L;
  do {
    addr = last | bit;
    res = flash.read(&data, addr, sizeof(data));
    if (res != sizeof(data)) break;
    if (data != 0xff) last |= bit;
    bit >>= 1;
  } while (bit != 0);
  us = RTC::micros() - start;
  ASSERT(res == sizeof(data));
  ASSERT(flash.read(&data, last, sizeof(data)) == sizeof(data));
  trace << PSTR("bsearch: last = ") << hex << last
	<< PSTR(", data = ") << hex << data
	<< PSTR(", ms = ") << us / 1000.0 
	<< endl;
  ASSERT(flash.read(&data, last + 1, sizeof(data)) == sizeof(data));
  ASSERT(data == 0xff);
  SLEEP(5);

  // Locate end of file in first sector; reverse search
  start = RTC::micros();
  last = 0x10000L;
  for (uint8_t i = 0; i < 128; i++) {
    last -= sizeof(buf);
    res = flash.read(&buf, last, sizeof(buf));
    if (res != sizeof(buf)) break;
    uint16_t j = sizeof(buf) - 1;
    while (buf[j] == 0xff) if (j == 0) break; else j--;
    if (j == 0) continue;
    last += j;
    break;
  }
  us = RTC::micros() - start;
  ASSERT(res == sizeof(buf));
  ASSERT(flash.read(&data, last, sizeof(data)) == sizeof(data));
  trace << PSTR("rsearch: last = ") << hex << last
	<< PSTR(", data = ") << hex << data
	<< PSTR(", ms = ") << us / 1000.0
	<< endl;
  ASSERT(flash.read(&data, last + 1, sizeof(data)) == sizeof(data));
  ASSERT(data == 0xff);
  SLEEP(5);
}

