cleaned up the output from the stm32 downloader code
diff --git a/aos/build/download_externals.sh b/aos/build/download_externals.sh
index f33eced..ee3cd2d 100755
--- a/aos/build/download_externals.sh
+++ b/aos/build/download_externals.sh
@@ -6,11 +6,13 @@
 . $(dirname $0)/tools_config
 COMPILED=${EXTERNALS}/../compiled-arm
 
-export CC=arm-linux-gnueabihf-gcc-4.7
-export CXX=arm-linux-gnueabihf-g++-4.7
-export CFLAGS=-mcpu="cortex-a8 -mfpu=neon"
-export CXXFLAGS=-mcpu="cortex-a8 -mfpu=neon"
-export OBJDUMP=arm-linux-gnueabihf-objdump
+CROSS_COMPILE=arm-linux-gnueabihf-
+
+export CC=${CROSS_COMPLIE}gcc-4.7
+export CXX=${CROSS_COMPLIE}g++-4.7
+export CFLAGS="-mcpu=cortex-a8 -mfpu=neon"
+export CXXFLAGS="-mcpu=cortex-a8 -mfpu=neon"
+export OBJDUMP=${CROSS_COMPLIE}objdump
 # Flags that should get passed to all configure scripts.
 # Some of them need to set LDFLAGS separately to work around stupid configure
 # scripts, so we can't just set that here.
diff --git a/aos/common/logging/logging_impl.cc b/aos/common/logging/logging_impl.cc
index a76c28a..980f65a 100644
--- a/aos/common/logging/logging_impl.cc
+++ b/aos/common/logging/logging_impl.cc
@@ -120,6 +120,16 @@
 
 }  // namespace internal
 
+StreamLogImplementation::StreamLogImplementation(FILE *stream)
+    : stream_(stream) {}
+
+void StreamLogImplementation::DoLog(log_level level, const char *format,
+                                    va_list ap) {
+  LogMessage message;
+  internal::FillInMessage(level, format, ap, &message);
+  internal::PrintMessage(stream_, message);
+}
+
 void LogImplementation::DoVLog(log_level level, const char *format, va_list ap,
                    int levels) {
   Context *context = Context::Get();
diff --git a/aos/common/logging/logging_impl.h b/aos/common/logging/logging_impl.h
index 1416fe1..18f35bc 100644
--- a/aos/common/logging/logging_impl.h
+++ b/aos/common/logging/logging_impl.h
@@ -114,6 +114,17 @@
   LogImplementation *next_;
 };
 
+// A log implementation that dumps all messages to a C stdio stream.
+class StreamLogImplementation : public LogImplementation {
+ public:
+  StreamLogImplementation(FILE *stream);
+
+ private:
+  virtual void DoLog(log_level level, const char *format, va_list ap);
+
+  FILE *const stream_;
+};
+
 // Adds another implementation to the stack of implementations in this
 // task/thread.
 // Any tasks/threads created after this call will also use this implementation.
diff --git a/bbb_cape/src/flasher/stm32_flasher.cc b/bbb_cape/src/flasher/stm32_flasher.cc
index 646657b..73f778c 100644
--- a/bbb_cape/src/flasher/stm32_flasher.cc
+++ b/bbb_cape/src/flasher/stm32_flasher.cc
@@ -19,6 +19,8 @@
 
 int main(int argc, char **argv) {
   ::aos::logging::Init();
+  ::aos::logging::AddImplementation(
+      new ::aos::logging::StreamLogImplementation(stdout));
 
   if (argc < 2) {
     fputs("Need an argument saying which target to download.\n", stderr);
@@ -70,7 +72,7 @@
       }
       start_address |= value << (12 - (4 * i));
     }
-    printf("%x\n", start_address);
+    LOG(INFO, "start address = 0x%x\n", start_address);
   }
 
   parser_t *parser = &PARSER_HEX;
@@ -106,7 +108,6 @@
 
   unsigned int last_byte = parser->size(p_st);
   unsigned int size = last_byte - start_address;
-  printf("%x\n", size);
 
   // An array of the sizes of each sector.
   static const uint32_t kSectorSizes[12] = {0x4000, 0x4000, 0x4000, 0x4000,
@@ -126,7 +127,6 @@
     }
     if (address == start_address) break;
   }
-  printf("starting with sector %d\n", start_sector);
 
   // The first sector that we're not going to erase.
   int end_sector = 0;
@@ -138,7 +138,6 @@
           size, start_address);
     }
   }
-  printf("not erasing sector %d\n", end_sector);
 
   if (!stm32_erase_memory(stm, start_sector, end_sector - start_sector)) {
     LOG(FATAL, "failed to erase memory\n");
@@ -186,7 +185,7 @@
     if (memcmp(buffer, compare_buffer, length) != 0) {
       printf("\n");
       for (size_t i = 0; i < length; ++i) {
-        printf("want %x have %x\n", buffer[i], compare_buffer[i]);
+        LOG(DEBUG, "want %x have %x\n", buffer[i], compare_buffer[i]);
       }
       LOG(FATAL, "verify from 0x%x to 0x%x failed\n",
           address, address + length);
@@ -199,7 +198,7 @@
   printf("\n");
 
   if (init_bl_exit(stm, serial, NULL /* GPIO sequence */)) {
-    printf("done!\n");
+    LOG(INFO, "all done\n");
   } else {
     LOG(FATAL, "init_bl_exit failed\n");
   }