How can I make std::cout write to Serial?
The ARM gcc libraries offer a simple way to redirect standard outputs. It is enough to implement function _write(int fd, char *ptr, int len) and it will replace the default implementation used in library to direct the standard outputs to debugger semihosting. The function must be compiled as  C to match.

#include &lt;Arduino.h&gt;
#undef max
#undef min
#include &lt;stdio.h&gt;
#include &lt;iostream&gt;

using namespace std;

extern "C" {
int _write(int fd, char *ptr, int len) {
  (void) fd;
  return Serial.write(ptr, len);
}
}

void setup() {

  Serial.begin(115200);
  while (!Serial);

  Serial.println("START");

  printf("HERE WE ARE\r\n");

  cout &lt;&lt; "TEST COUT\r\n";
  cerr &lt;&lt; "TEST ERR\r\n";
}

void loop() {

}


the #undefs undefine the Arduino macros, which are in conflict with includes used in &lt;iostream&gt;