Re: about retarget option..
here is explaination with summary
The higher-level input/output, such as the functions fscanf() and fprintf(), and the C++ object std::cout, are not target-dependent. However, the higher-level functions perform input/output by calling lower-level functions that are target-dependent. To retarget input/output, you can either avoid these higher-level functions or redefine the lower-level functions.
You can provide your own implementation of C Library functions that make use of target hardware, and that are automatically linked in to your image in favor of the C library implementations. For example, you might have a peripheral I/O device such as a UART, and you might want to override the library implementation of fputc(), that writes to the debugger console, with one that outputs to the UART. Because this implementation of fputc() is linked in to the final image, the entire printf() family of functions prints out to the
UART.